Centos 7
在系统中输入以下命令
cd /etc/yum.repos.d/
wget http://mirrors.aliyun.com/repo/Centos-7.repo
mv Centos-7.repo CentOS-Base.repo
yum update -y
ubuntu
修改 /etc/apt/sources.list
为如下内容:
# $Codename 需要替换为具体的版本名称
deb http://mirrors.aliyun.com/ubuntu/ $Codename main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $Codename-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $Codename-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ $Codename-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ $Codename-backports main restricted universe multiverse
$Codename 的具体值可以通过 lsb_release -a
命令查看
替换文件后运行 sudo apt-get update
即可完成软件源替换。