[root@test0001 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/centos_test0001-root 6.2G 1.3G 5.0G 21% /
devtmpfs 484M 0 484M 0% /dev
tmpfs 496M 0 496M 0% /dev/shm
tmpfs 496M 6.8M 489M 2% /run
tmpfs 496M 0 496M 0% /sys/fs/cgroup
/dev/sda1 1014M 135M 880M 14% /boot
tmpfs 100M 0 100M 0% /run/user/0
[root@test0001 ~]#
[root@test0001 ~]# ll /dev/cdrom
lrwxrwxrwx. 1 root root 3 Jul 11 13:16 /dev/cdrom -> sr0
[root@test0001 ~]#
1.挂载光盘,sr0是光盘
mount /dev/sr0 /mnt
--或者
mount -t iso9660 /dev/cdrom /mnt
mount -t iso9660 -o,loop /root/soft/CentOS-6.8-x86_64-bin-DVD1.iso /mnt
2.清除/etc/yum.repos.d 目录下得其他yum源
cd /etc/yum.repos.d
mkdir tmp
mv *.repo tmp/
3.配置yum源
vi /etc/yum.repos.d/yum.repo
[base] //yum的ID,标识,用于区分不同yum源
name=base //描述信息
baseurl=file:///mnt //前面的file://是协议,后面的/mnt是光盘挂载点
enabled=1 // 1 启动yum源,0 禁用yum源
gpgcheck=0 //1 使用公钥验证rpm包的正确性,0 不验证
4.清空yum缓存
yum clean all
5.建立yum资源缓存
yum makecache
6.生成列表
yum list
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/31397003/viewspace-2143391/ ,如需转载,请注明出处,否则将追究法律责任。