This installation is installed with root user privileges
Check the current system version and download the corresponding image:
cat /etc/redhat-release
The current version is 8.3.
Put the downloaded image into the specified folder. Make sure that the current directory has enough disk space. This time store it in the /opt directory:
create a directory /mnt/yumcd folder, and mount the image:
mkdir /mnt/yumcd
mount /opt/CentOS-8.3.2011-x86_64-dvd1.iso /mnt/yumcd/
Check whether the mirror is mounted:
enter the /etc/yum.repos.d/ directory, and edit the yum warehouse path:
cd /etc/yum.repos.d/
Edit the CentOS-Linux-AppStream.repo file with the command (vi: edit, q: quit, wq: save) :
vi /etc/yum.repos.d/CentOS-Linux-AppStream.repo
Comment out the mirrorlist, gpgcheck=0 to turn off gpgkey verification, enabled=1 to enable the yum warehouse:
edit the CentOS-Linux-BaseOS.repo file:
vi /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
Comment out the mirrorlist, gpgcheck=0 to turn off gpgkey verification, enabled=1 to enable the yum warehouse:
edit the CentOS-Linux-Extras.repo file:
vi /etc/yum.repos.d/CentOS-Linux-Extras.repo
enabled=0 does not enable the yum repository:
yum clean all
yum makecache
(If the yum command does not exist, try using the dnf command, for example: dnf clean all)
yum repolist
Configure boot mount:
echo '/opt/CentOS-8.3.2011-x86_64-dvd1.iso /mnt/yumcd auto defaults 0 0' >> /etc/fstab
Check:
cat /etc/fstab
Restart the server, check the mount, and see the mount point, indicating that the permanent mount has been completed:
remove the mount:
umount /mnt/yumcd
注释掉/etc/fstab文件中的这一行即可:
#/opt/CentOS-8.3.2011-x86_64-dvd1.iso /mnt/yumcd auto defaults 0 0