自建yum仓库,分别为网络源和本地源

配置本地源####

  1. 建立本地源目录
    [root@qingcheng-db lgp]#mkdir /mnt/cdrom
    [root@qingcheng-db lgp]#mkdir /yum

  2. 挂载Centos光盘
    [root@qingcheng-db lgp]#mount /dev/cdrom /mnt/cdrom
    [root@qingcheng-db lgp]#cp -r /mnt/cdrom/* /yum

  3. 备份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

  4. 编辑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
  1. 清除yum缓存
    [root@qingcheng-db lgp]#yum clean all

配置网络源####

  1. 备份源镜像文件
    [root@qingcheng-db yum.repos.d]# mv centos* ./backup

  2. 下载阿里云的镜像到/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

  3. 清除yum缓存
    [root@qingcheng-db yum.repos.d]# yum clean all
    [root@qingcheng-db yum.repos.d]# yum makecache

posted on 2018-01-11 15:57  美丽de世界  阅读(767)  评论(0编辑  收藏  举报