香港CTG CN2三网精品,平均延迟40ms。
Linux更换阿里云源教程
发布时间:2024-05-07 21:25
阅读量:2073
Linux系统默认yum为美国节点,可更换为阿里云yum提高下载速度:
为了在CentOS系统上更换为阿里云的YUM源,你需要按照以下步骤操作:
- 备份当前的YUM源配置文件。
- 删除或重命名
/etc/yum.repos.d
目录下的其他.repo文件。 - 下载阿里云的CentOS YUM源配置文件。
- 运行YUM源更新命令。
以下是具体的命令:
bash# 1. 备份当前的YUM源配置文件
sudo mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
# 2. 下载阿里云的CentOS YUM源配置文件
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 3. 运行YUM源更新命令
sudo yum clean all
sudo yum makecache
确保替换的YUM源配置文件中的版本与你的CentOS版本相匹配。如果你使用的是CentOS 8,那么应该下载对应的阿里云CentOS 8 YUM源配置文件。
Ubuntu更换阿里云软件源
1. 备份
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
2.修改
sudo vim /etc/apt/sources.list
将source.list文件内容替换成下面的
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
3. 更新
sudo apt-get update