欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Ubuntu 18.04更换apt-get源的方法

程序员文章站 2024-01-24 10:09:04
使用apt-get安装时,会很慢,更换了国内的源后,就可以解决这个问题了。1. 备份sources.list文件sudo cp /etc/apt/sources.list /etc/apt/sourc...

使用apt-get安装时,会很慢,更换了国内的源后,就可以解决这个问题了。

1. 备份sources.list文件

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2. 打开sources.list文件

sudo gedit /etc/apt/sources.list

3. 删除原内容,添加下列内容

#清华源
deb bionic main restricted universe multiversedeb-src bionic main restricted universe multiversedeb bionic-updates main restricted universe multiversedeb-src bionic-updates main restricted universe multiversedeb bionic-backports main restricted universe multiversedeb-src bionic-backports main restricted universe multiversedeb bionic-security main restricted universe multiversedeb-src bionic-security main restricted universe multiversedeb bionic-proposed main restricted universe multiversedeb-src bionic-proposed main restricted universe multiverse

#阿里云源
deb bionic main restricted universe multiverse
deb bionic-security main restricted universe multiverse
deb bionic-updates main restricted universe multiverse
deb bionic-proposed main restricted universe multiverse
deb bionic-backports main restricted universe multiverse
deb-src bionic main restricted universe multiverse
deb-src bionic-security main restricted universe multiverse
deb-src bionic-updates main restricted universe multiverse
deb-src bionic-proposed main restricted universe multiverse
deb-src bionic-backports main restricted universe multiverse

这两个源都可以用,我都试过,感觉阿里云源速度更快。

4. 更新

保存sources.list文件后需要更新apt-get。

sudo apt-get update

更新完成后就可以正常使用了。

到此这篇关于ubuntu 18.04更换apt-get源的文章就介绍到这了,更多相关ubuntu 18.04更换apt-get源内容请搜索以前的文章或继续浏览下面的相关文章希望大家以后多多支持!

相关标签: Ubuntu apt-get