配置本地源####
建立本地源目录
[root@qingcheng-db lgp]#mkdir /mnt/cdrom
[root@qingcheng-db lgp]#mkdir /yum挂载Centos光盘
[root@qingcheng-db lgp]#mount /dev/cdrom /mnt/cdrom
[root@qingcheng-db lgp]#cp -r /mnt/cdrom/* /yum备份repo
[root@qingcheng-db lgp]#cd /etc/yum.repo.d/
[root@qingcheng-db lgp]#mkdir backup
[root@qingcheng-db lgp]#mv CentOS-Base.repo CentOS-CR.repo CentOS-Vault.repo CentOS-Vault.repo ./backup编辑Centos-Media.repo
[root@qingcheng-db lgp]#vim Centos-Media.repo
[base]
name=Centos
baseurl=file:///yum
enable=1
gpgckeck=0
gpgkey=file:///mnt/cdrom/RPM-GPG-KEY-CentOS-7
- 清除yum缓存
[root@qingcheng-db lgp]#yum clean all
配置网络源####
备份源镜像文件
[root@qingcheng-db yum.repos.d]# mv centos* ./backup下载阿里云的镜像到/etc/yum.repos.d/
[root@qingcheng-db yum.repos.d]# wget -O /etc/yum.repos.d/CentOS-Base.repo
http://mirrors.aliyun.com/repo/Centos-7.repo清除yum缓存
[root@qingcheng-db yum.repos.d]# yum clean all
[root@qingcheng-db yum.repos.d]# yum makecache