Ubuntu之更换apt源

说明:本人使用的是ubuntu18.0.4LTS。

系统默认的源是http://cn.archive.ubuntu.com/ubuntu/,因为是国外的,下载东西特别慢,所以我们可以更换国内的源来提高速度。国内的源阿里云、豆瓣等,我使用的是阿里的。

关于apt的一些设置都在/etc/apt/sources.list里,这也是我们要改的文件。首先,为了避免我们操作错误和有后悔药吃,先保存原来的配置文件。cp sources.list sources.list.backup。然后编辑sources.list,vim sources.list 。 然后把里面的内容全部删除了。添加

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

保存之后,可以用apt-get update测试一下,出现mirrors.aliyun.com即成功。

其他版本可以参考https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.53322f70ViZYJa。

其中ubuntu 18.04(bionic) 就是ubuntu18.0.4LTS

发布了10 篇原创文章 · 获赞 0 · 访问量 213

猜你喜欢

转载自blog.csdn.net/qq_41084438/article/details/103844366
今日推荐