一、将源文件备份
初始的文件最好不要删除,避免以后可能会用到,改个名字就可以了
sudo cp /ect/apt/sources.list /etc/apt/sources.list.backup
二、将原文件中的内容清空掉,添加阿里源
最好是清空掉,不然还是有问题
sudo gedit /etc/apt/sources.list
下面源,亲测Ubuntu18.04可以用!
我在网上找的其他阿里源,被坑死了,版本较低,各种依赖错误,连gcc都依赖报错。
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-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports 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
三、更新源
//更新源
sudo apt-get update
//更新软件包
sudo apt-get upgrade
到此可以愉快的安装了