CentOS 7官方源停服,配置本机光盘yum源

1、挂载系统光盘

mkdir /mnt/iso

mount -o loop /tools/CentOS-7-x86_64-DVD-1810.iso /mnt/iso

cd /mnt/iso/Packages/

rpm -ivh /mnt/iso/Packages/yum-utils-1.1.31-50.el7.noarch.rpm(图形界面安装,默契已安装)

如安装yum-utils依赖错误,按提示安装依赖包

rpm -ivh /mnt/iso/Packages/libxml2-python-2.9.1-6.el7_2.3.x86_64.rpm

rpm -ivh /mnt/iso/Packages/python-chardet-2.2.1-1.el7_1.noarch.rpm

rpm -ivh /mnt/iso/Packages/python-kitchen-1.1.1-5.el7.noarch.rpm

2、配置光盘yum

# mkdir /etc/yum.repo.d/repo_bk

# mv /etc/yum.repo.d/*.repo /etc/yum.repo.d/repo_bk

# yum-config-manager --add-repo=file:///mnt/iso

# vim /etc/yum.repo.d/mnt_iso.repo 注:也可以直新建此文件操作

[mnt_iso]

name=added from: file:///mnt/iso/

baseurl=file:///mnt/iso/

#表示启用这个源

enabled=1  

#表示对从这个源下载的rpm包不进行校验

gpgcheck=0

#表示对从这个源下载的rpm包进行校验

gpgcheck=1

gpgkey=file:///mnt/iso/RPM-GPG-KEY-CentOS-7 光盘校验证书

3、清理缓存并生成新的缓存

# yum clean all && yum makecache

# yum repolist #查看yum源是否生效

你可能感兴趣的:(linux运维,centos,linux,运维)