配置RHEL和centOS的阿里云镜像源

备份

sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

编辑 YUM 仓库配置文件

sudo vi /etc/yum.repos.d/CentOS-Base.repo

配置内容:

[base]
name=CentOS-7 - Base - Aliyun
baseurl=http://mirrors.aliyun.com/centos/7/os/ b a s e a r c h / g p g c h e c k = 1 g p g k e y = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / 7 / o s / basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/7/os/ basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/7/os/basearch/RPM-GPG-KEY-CentOS-7

[updates]
name=CentOS-7 - Updates - Aliyun
baseurl=http://mirrors.aliyun.com/centos/7/updates/ b a s e a r c h / g p g c h e c k = 1 g p g k e y = h t t p : / / m i r r o r s . a l i y u n . c o m / c e n t o s / 7 / o s / basearch/ gpgcheck=1 gpgkey=http://mirrors.aliyun.com/centos/7/os/ basearch/gpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/7/os/basearch/RPM-GPG-KEY-CentOS-7

编辑 EPEL 仓库配置文件 epel.repo
sudo vi /etc/yum.repos.d/epel.repo

编辑内容:

[epel]
name=Extra Packages for Enterprise Linux 7 - b a s e a r c h − A l i y u n b a s e u r l = h t t p : / / m i r r o r s . a l i y u n . c o m / e p e l / 7 / basearch - Aliyun baseurl=http://mirrors.aliyun.com/epel/7/ basearchAliyunbaseurl=http://mirrors.aliyun.com/epel/7/basearch
failovermethod=priority
enabled=1
gpgcheck=0
gpgkey=http://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-7

清理缓存

sudo yum clean all

生成缓存(重新生成缓存,以验证配置是否正确)

sudo yum makecache

尝试安装软件:

sudo yum install tftp-server tftp

你可能感兴趣的:(centos,阿里云,linux)