Instance
As the company server only two machines can access the external network, the other in the intranet of the machine if you want to install some of the toolkit is more troublesome, so decided to access the network of machines to make a yum warehouse. The following is an example.
Host ip:120.120.120.111 (server) that can access the extranet
Intranet host ip:192.168.75.76 (client)
On the server:
1. Create a Directory
#mkdir-P/var/ftp/pup/centos7/packages
#mkdir/var/ftp/pup/centos7/updates
2, use wget download 163yum source on the CENTOS7 in the installation package
Download the base package first
#cd/var/ftp/pup/centos7/packages
#wget-nd-np-l1-r http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages/
Download down is the index.html file, because it will not be downloaded with this file, it used a more stupid way
#cat index.html |awk-f "[><]" ' {print ' wget http://mirrors.163.com/centos/7.2.1511/os/x86_64/Packages /"$" >./file.sh
Check that the statements in file.sh are in the form of a wget+ path, and then use the following statement to download
#sh./file.sh
Here is the download update package
#cd/var/ftp/pup/centos7/updates
#wget-nd-np-l1-r http://mirrors.163.com/centos/7.2.1511/updates/x86_64/Packages/
#cat index.html |awk-f "[><]" ' {print ' wget http://mirrors.163.com/centos/7.2.1511/updates/x86_64/ Packages/"$" >./file.sh
#sh./file.sh
3. Create a Yum repository
#createrepo/var/ftp/pup/centos7/packages
#createrepo/var/ftp/pup/centos7/updates
After running the above two statements, the Repodata directory is created under the packages and updates directory, which records the Yum server information
Since the server can connect to the extranet, there is no need to change the repo file in the local YUM.REPOS.D directory so that the server local Yum repository is configured
In client:
1. Configuring Yum Files
#cat >/etc/yum.repos.d/centos7-openstack.repo <<eof
[Base]
Enabled = 1
Name = Rhel7-base-local
BaseURL = Ftp://120.120.120.111/pub/centos7.2/Packages
Gpgcheck = 0
Gpgkey = Ftp://120.120.120.111/pub/centos7.2/RPM-GPG-KEY-redhat-release
[Updates]
Enabled = 1
Name= rhel7-updates-local
BaseURL = Ftp://120.120.120.111/pub/centos7.2/updates
Gpgcheck = 0
Gpgkey = Ftp://120.120.120.111/pub/centos7.2/RPM-GPG-KEY-redhat-release
Eof
2. Clear the Yun Cache
#yum Clean All
3. Install with Yum
#yum Install GCC
Displays the hints that can be installed, proving that your Yum repository is ready for use.
Attention:
1, if the configuration is two Yum warehouse directory, then two directories will need to use Createrepo for the Yum warehouse creation, or in the client side Yum installation error, indicating that one of the warehouse directory does not have permission to access
2, the default directory of FTP is/VAR/FTP, if you need to change this directory, you need to modify the/etc/passwd ftp corresponding row directory records, such as the/var/ftp directory modified to/usr/ftp, as follows
Ftp:x:14:50:ftp User:/var/ftp/:/sbin/nologin
Ftp:x:14:50:ftp User:/usr/ftp/:/sbin/nologin
After the modification, the server side needs to set up the Yum repository in the new FTP directory, the client side of the Yum configuration file will also be modified to the latest FTP directory address, otherwise the Yum warehouse can not be used.
Reference documents:
RedHat configuration of the Linux local Yum source http://www.linuxidc.com/Linux/2013-08/88217.htm
RedHat 6.2 Linux modified yum source free to use CentOS Source http://www.linuxidc.com/Linux/2013-07/87383.htm
Configuring the Epel Yum source http://www.linuxidc.com/Linux/2012-10/71850.htm
Redhat local Yum source configuration http://www.linuxidc.com/Linux/2012-11/75127.htm
configuration file description for Yum http://www.linuxidc.com/Linux/2013-04/83298.htm
RedHat 6.1 under Install yum (graphic) http://www.linuxidc.com/Linux/2013-06/86535.htm
YUM installation and cleanup http://www.linuxidc.com/Linux/2013-07/87163.htm
Installing the local Yum Source instance