1.光盘文件放入光驱设备
2.挂载光驱设备
[root@localhost ~]# mkdir /mydvd
[root@localhost ~]# mount /dev/cdrom /mydvd
[root@localhost ~]# ls /mydvd
3.书写客户端配置文件
[root@localhost ~]# rm -rf /etc/yum.repos.d/*
[root@localhost ~]# vim /etc/yum.repos.d/mydvd.repo
[centos]
baseurl=file:///mydvd
gpgcheck=0
[root@localhost ~]# yum -y install xorg-x11-apps
[root@localhost ~]# rpm -q xorg-x11-apps
[root@localhost ~]# yum -y install dhcp
4.完成开机自动挂载
]# blkid /dev/cdrom #查看 光驱设备文件系统类型
]# vim /etc/fstab #添加一行配置
/dev/cdrom /mydvd iso9660 defaults 0 0
]# umount /mydvd
]# mount -a #进行检测
]# ls /mydvd
]# yum -y install bind #测试安装软件包
5.开机自动挂载修改UUID内容
[root@localhost ~]# df -h /boot #查看设备挂载情况
文件系统 容量 已用 可用 已用% 挂载点
/dev/sda1 1014M 172M 843M 17% /boot
[root@localhost ~]# blkid /dev/sda1
/dev/sda1: UUID="8e57ee09-0d60-4da9-87a0-83bb4a62587d" TYPE="xfs"
[root@localhost ~]# vim /etc/fstab #vmware虚拟机
/dev/sda1 /boot xfs defaults 0 0
[root@localhost ~]# vim /etc/fstab #KVM虚拟机
/dev/vda1 /boot xfs defaults 0 0
[root@localhost ~]# reboot #重启系统
[root@localhost ~]# yum repolist #检测yum仓库
6.Yum常见错误:清空/var/run/yum.pid文件内容
[root@localhost ~]# yum repolist
已加载插件:fastestmirror, langpacks
/var/run/yum.pid 已被锁定,PID 为 2446 的另一个程序正在运行。
Another app is currently holding the yum lock; waiting for it to exit...
另一个应用程序是:PackageKit
内存: 33 M RSS (378 MB VSZ)
已启动: Fri May 13 09:37:12 2022 - 00:07之前
状态 :睡眠中,进程ID:2446
Loading mirror speeds from cached hostfile
源标识 源名称 状态
centos linux 10,072
repolist: 10,072
[root@localhost ~]# > /var/run/yum.pid #清空文件内容
[root@localhost ~]# yum clean all #清空yum缓存
[root@localhost ~]# yum repolist #列出仓库信息