1.把完整版镜像ISO文件加载到光驱。
2.创建挂载路径:
[root@localhost ~]# mkdir /mnt/cdrom
3.挂载ISO镜像到设置好的挂载路径:
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom
4.进入本地YUM源配置文件夹:
[root@localhost ~]# cd /etc/yum.repos.d
5.删除该文件夹下所有repos文件:
[root@localhost yum.repos.d]# rm *.repo
6.创建一个新配置文件CentOS-Sources.repo
[root@localhost yum.repos.d]# vi CentOS-Sources.repo
7.编辑该配置文件内容如下:
[base-source]
name=CentOS-$releasever - Base Sources
baseurl=file:///mnt/cdrom
gpgcheck=0
enabled=1
gpgkey=file:///mnt/cerom/RPM-GPG-KEY-CentOS-7
8.保存文件退出后,更新YUM源:
[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache
9.验证
[root@localhost yum.repos.d]# yum list
.....
xorg-x11-server-Xephyr.x86_64 1.19.5-5.el7 base-source
xorg-x11-server-Xorg.x86_64 1.19.5-5.el7 base-source
xorg-x11-server-common.x86_64 1.19.5-5.el7 base-source
xorg-x11-server-utils.x86_64 7.7-20.el7 base-source
xorg-x11-utils.x86_64 7.5-22.el7 base-source
xorg-x11-xauth.x86_64