虚拟机设置
CD/DVD(IDE)-->使用ISO映像文件(安装包)
[[email protected] yum.repos.d]# ls -l /dev/|grep cdrom
lrwxrwxrwx. 1 root root 3 Mar 21 00:57 cdrom1 -> sr0
crw-rw----. 1 root cdrom 21, 2 Mar 21 00:57 sg2
brw-rw----+ 1 root cdrom 11, 0 Mar 21 00:57 sr0
mkdir -pv /mnt/cdrom
mount -t iso9660 /dev/cdrom /mnt/cdrom
挂载:
cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo.bak
vi /etc/yum.repos.d/CentOS-Yum-Local.repo
#
[base]
name=CentOS-$releasever - Base
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=0
baseurl ## 本地镜像文件路径
enabled=1 ## 1为启动yum源,0为禁用
gpgcheck=1 ## 1为检查GPG-KEY,0为不检查
最后执行:
Yum clean all
就可以使用YUM了。
原文地址:https://www.cnblogs.com/vzhangxk/p/11217361.html
时间: 2024-10-19 16:47:45