文章目录
前言
今天安装了ubuntu20.04,使用系统默认的软件源的话安装软件的速度太慢了,这里记录下ubuntu20.04更换国内软件源的步骤。
一、软件源是什么?
软件源是linux系统免费的应用程序安装仓库,很多应用软件都会收录到这个仓库里面。按类型分有以下类型:
- 软件仓库:各类软件的二进制安装包和源代码
- ISO镜像:各发行版的ISO文件
二、更换步骤
1.更换须知
ubuntu20.04系统的软件源配置文件路径为:/etc/apt/sources.list
2.配置文件备份
2.1执行以下命令对配置文件备份:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.2执行以下命令编辑配置文件:
sudo vim /etc/apt/sources.list
2.3把配置文件里面的内容全部删掉
在vim的一般模式下按顺序执行以下2个命令:
- gg :光标跳转到该文件行首
- dG : 删除光标行及其以下行的全部内容。(注:d为删除,G为光标跳转到末尾行)
2.4 把以下内容拷贝到配置文件中:
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
然后保存退出
2.5更新源&&更新软件
执行以下命令更新源和软件:
sudo apt-get update && sudo apt-get upgrade
总结
以上就是记录ubuntu20.04更换国内软件源的方法,如有错误的地方请指出。