1. 程式人生 > >CentOS 7 配置本地yum 源

CentOS 7 配置本地yum 源

directly enabled other rpm file dia sed eve pan

1. 加載 CentOS的ISO鏡像並掛載:

[[email protected] files]# mount /media/files/CentOS-7-x86_64-DVD-1611.iso /mnt/cdrom/
mount: /dev/loop0 寫保護,將以只讀方式掛載

2. 新建CentOS目錄並把光盤上的文件復制到該目錄下:

[[email protected] files]# mkdir /media/CentOS/
[[email protected] files]# cp -fr /mnt/cdrom/* /media/CentOS/

3. 修改yum配置文件:

[[email protected]

/* */ /]# vi /etc/yum.repos.d/CentOS-Media.repo

# CentOS-Media.repo
#
# This repo can be used with mounted DVD media, verify the mount point for
# CentOS-7. You can use this repo and yum to install items directly off the
# DVD ISO that we release.
#
# To use this repo, put in your DVD and use it with the other repos too:
# yum --enablerepo=c7-media [command]
#
# or for ONLY the media repo, do this:
#
# yum --disablerepo=\* --enablerepo=c7-media [command]

[c7-media]
name=CentOS-$releasever - Media
baseurl=file:///media/CentOS/ -->這一行改成前邊我們新建的CentOS目錄


# file:///media/cdrom/ -->這一行加#號註釋掉
# file:///media/cdrecorder/ -->這一行加#號註釋掉
gpgcheck=1
enabled=1 -->這一行把0改成1來啟用源
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

按 “i” 鍵 修改紅色標記的地方,然後輸入 :wq 保存退出。

4. 卸載鏡像:

[[email protected] /]# umount /mnt/cdrom/

2017-08-17 18:21:46 @sh hp

CentOS 7 配置本地yum 源