Details how to configure the local centos7 yum source

  • 2020-05-27 07:56:57
  • OfStack

Recently, I had some trouble in using the virtual machine. Because the company has internal network management, vm could not connect to the external network, and yum could not install the software. How to solve this problem? The use of iso as the local yum source solves most package installations.

vm is installed with centos7.

1. Mount iso to vm


#mkdir /mnt/cdrom
#mount /dev/cdrom /mnt/cdrom

2. Modify the yum source configuration

yum source configuration directory "/ etc yum. repo. d/", the network is not available, so the inside of the direct delete default configuration" rm - f * ", and establish the local yum source file "local repo".

The yum source configuration file ends with repo. Here is the local.repo:


[local_server]
name=This is a local repo
baseurl=file:///mnt/cdrom
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

3. Update the yum configuration


#yum clean all
#yum makecache

Following the steps above, you are ready to use the local yum source. You can run "yum install xxx" directly when you have packages that need to be installed.


Related articles: