將原有/etc/yum.repos.d/目錄下的文件名全部改為(*.bak),如(紅色標記) [root@localhost ~]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ls CentOS-Base.repo.bak CentOS-C ...
將原有/etc/yum.repos.d/目錄下的文件名全部改為(*.bak),如(紅色標記)
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# ls
CentOS-Base.repo.bak CentOS-CR.repo.bak CentOS-Debuginfo.repo.bak CentOS-fasttrack.repo.bak CentOS-Media.repo CentOS-Sources.repo.bak CentOS-Vault.repo.bak
[root@localhost yum.repos.d]# mv CentOS-Media.repo CentOS-Media.repo.bak
[root@localhost yum.repos.d]# yum clean all
將CentOS 7 鏡像文件拷到 /media 目錄下
上傳CentOS7 ISO文件到/media/目錄下,新建目錄/media/cdrom,並將ISO文件掛載到/media/cdrom
[root@localhost media]# mkdir -p /media/cdrom
[root@localhost media]# ls
cdrom CentOS-7-x86_64-Everything-1503-01.iso
[root@localhost media]# mount -t auto /media/CentOS-7-x86_64-Everything-1503-01.iso /media/cdrom/
[root@localhost media]# ls /media/cdrom/
CentOS_BuildTag EFI EULA GPL images isolinux LiveOS Packages repodata RPM-GPG-KEY-CentOS-7 RPM-GPG-KEY-CentOS-Testing-7 TRANS.TBL
本地yum源配置
在/etc/yum.repos.d/路徑下新建一個文件 CentOS-Media.repo,將以下內容複製到文件中即可;
1 # CentOS-Media.repo 2 # 3 [c6-media] 4 name=CentOS-$releasever - Media 5 baseurl=file:///media/cdrom 6 gpgcheck=1 7 enabled=1 8 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7 9 #如果不需要gpgcheck,可讓gpgcheck=0,然後註釋掉最後一行即可。