修改CentOS默认yum源为mirrors.aliyun.com

先切换到root用户下

su root

备份系统自带yum源配置文件/etc/yum.repos.d/CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载ailiyun的yum源配置文件到/etc/yum.repos.d/

CentOS7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
CentOS6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo

运行yum makecache生成缓存

yum makecache

这时候再更新系统就会看到以下mirrors.aliyun.com信息

最后修改日期:2020-07-13

作者

留言

Ubuntu系统这样配置

设置国内阿里镜像数据源
# 1.切换为超级管理员root
sudo su
# 2.编辑数据源配置文件
vim /etc/apt/sources.list

# 3. i 插入以下内容
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

# 4. Esc -> :wq 保存退出

# 5.更新配置
apt-get update

撰写回覆或留言

发布留言必须填写的电子邮件地址不会公开。