修改ubuntu默认源

修改文件

桌面版Ubuntu默认非root账户

可以先在 home/user/下新建一个文件source.list-new

将其写为

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

然后在命令行切换到root用户执行

cp /home/user/source.list-new /etc/apt/source.list

更新源

apt-get update

这一步报错

这是因为系统中有进程在占用apt-get

ps -ef | grep "apt-get"

可以看到

干掉他,然后继续执行

killall apt-get

apt-get update
apt-get upgrade

等一会即可

原文地址:https://www.cnblogs.com/velscode/p/13388264.html