配置RHEL(Red Hat Enterprise Linux) 8 本地yum源
一、虚拟机配置
二、配置文件
[root@localhost ~]# mkdir /yum
[root@localhost ~]# mount /dev/cdrom /yum
mount: /yum: WARNING: device write-protected, mounted read-only.
[root@localhost ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 889M 0 889M 0% /dev
tmpfs 904M 0 904M 0% /dev/shm
tmpfs 904M 18M 886M 2% /run
tmpfs 904M 0 904M 0% /sys/fs/cgroup
/dev/mapper/rhel-root 17G 3.9G 14G 23% /
/dev/sda1 1014M 170M 845M 17% /boot
tmpfs 181M 20K 181M 1% /run/user/42
tmpfs 181M 3.5M 178M 2% /run/user/0
/dev/sr0 6.7G 6.7G 0 100% /yum
[root@localhost ~]# echo "/dev/cdrom /yum iso9660 defaults 0 0" >> /etc/fstab
[root@localhost ~]# cat /etc/fstab
#
# /etc/fstab
# Created by anaconda on Tue Dec 24 05:39:07 2019
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
/dev/mapper/rhel-root / xfs defaults 0 0
UUID=e48080e4-ba01-45e5-a8fe-90ebb4c17c28 /boot xfs defaults 0 0
/dev/mapper/rhel-swap swap swap defaults 0 0
/dev/cdrom /yum iso9660 defaults 0 0
[root@localhost ~]# cd /etc/yum.repos.d/
[root@localhost yum.repos.d]# vim AppStream.repo
[AppStream]
name=AppStream
baseurl=file:///yum/AppStream
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# vim BaseOS.repo
[BaseOS]
name=BaseOS
baseurl=file:///yum/BaseOS
enabled=1
gpgcheck=0
[root@localhost yum.repos.d]# ls
AppStream.repo BaseOS.repo redhat.repo
三、生成本地缓存
dnf clean all
dnf makecache