This article mainly introduces how linux uses local iso as The yum source in virtual machines. For more information, see
Linux in a virtual machine sometimes cannot connect to the internet. to facilitate the installation of various packages, we investigated how to configure local yum installation.
First, mount the iso as the source to the system.
Copy codeThe code is as follows:
Mount-o loop/dev/cdrom/mnt/iso/
Or
Mount-o loop/xxx. iso/mnt/iso/
/Mnt/iso is a folder created locally in advance.
Then, import the iso. repo file to the/etc/yum. repos. d folder.
If the folder/etc/yum. repos. d contains other *. repo files, back up the files and delete them.
The content of iso. repo is as follows:
Copy codeThe code is as follows:
[Iso]
Baseurl = file: // mnt/iso
Gpgkey = file: // mnt/iso/RPM-GPG-KEY-redhat-beta
Failovermethod = priority
Enabled = 1
Gpgcheck = 0
Finally, execute yum update to update the yum source.
After the update, you can use yum to install packages.
Using yum to install a package can automatically identify the dependencies between packages, and automatically install the package in the order of dependencies, which is very convenient.