一.备份默认源
由于默认源都在国外,速度非常慢,需要把默认的源配置文件备份后删除。
cd /etc/yum.repos.d
mkdir bak
cp *.repo bak
rm -rf *.repo
二、配置本地源(内网环境)
在非联网环境可以通过安装包光盘配置本地源。
1.挂载光盘
mkdir /mnt/centos7
mount /dev/cdrom /mnt/centos7
ls -l /mnt/centos7
返回结果:
2.创建配置文件
cd /etc/yum.repos.d
vi local.repo
配置文件:
[base]
name=Local Base
baseurl=file:///mnt/centos7
gpgcheck=1
gpgkey=file:///mnt/centos7/RPM-GPG-KEY-CentOS-7
3.更新缓存
yum clean all
yum makecache
yum repolist
三、配置网络源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all
yum makecache
yum repolist
四、配置epel源
curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum clean all
yum makecache
yum repolist
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)