CentOS
1. 备份文件
cd /etc/yum.repos.d
sudo mv CentOS-Base.repo CentOS-Base.repo.bak
2. 下载阿里源文件
sudo wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-8.repo
3. 安装epel repo源
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
4. 清理缓存
yum clean all
5.重新生成缓存
yum makecache
6. 随后即可更新软件
sudo yum upgrade
Ubuntu
1. 备份文件
cd /etc/apt
sudo cp sources.list sources.list.backup
2. 修改源文件内容
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-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
3. 更新源
sudo apt-get update
4. 随后即可更新软件
sudo apt-get upgrade
仅用于后续参考,侵权立删!