Create a local yum source in CentOS
Field Environment:
One host has multiple virtual machines, such as 15.32.12.122 ~ 15.32.12.130: the installation of centos6.3 is minimal. That is, many commands or libraries do not support or are unavailable. However, there is an image file on 15.32.12.129, which contains various installation files, and the path is 15.32.12.129/CentOS63/. We can open it in a browser (the premise is that the ip address of our computer must be in the same network segment). There are many packages in the directory. rpm Installation File. Now we want to create a yum local source on the computer 15.32.12.122.
When the environment is on the Internet, we can directly use the yum-y install perl Command to install the perl environment. The principle is to find the files to be installed through various images on the Internet, however, in an environment without the Internet, we can connect to an internal image through the Intranet and download it from it. http: // 15.32.12.129/CentOS63 is the internal image path.
1. Create a yum configuration file
cd /etc/yum.repos.d/
There are several. repo files, which describe the image url to be connected during installation using yum. We need to create a. repo file named local. repo here.
#vi local.repo[local_server]name=This is local repobaseurl=http://15.32.12.129/CentOS/enabeld=1gpgcheck=0
Gpgcheck = 0 indicates that the GPG-KEY is not checked. If we have copied all the required. rpm files to the 122 PC, for example, if the directory is/rpm/, we should write the following in the baseurl column:
Baseurl = file: // rpm // three slashes exist here.
2. initialize yum
Yum clean all // clear the cache yum makecache // create a new cache
However, you may find that creating a new cache fails because of the original cache. images in the repo file need to be connected over the Internet, but now the condition is that there is no Internet, so we will prompt that these image URLs cannot be found. the extension of the repo file has been changed. repo_bark, etc. move the repo file to another file:
#mkdir back#mv Cent* back/
Then there is only one local. repo file in the yum. repos. d directory, and then perform the preceding operations again.
3. You can use yum for the Installation File, such as yum-y install tar.