In a production environment not connected to an external network, also commonly need to install a lot of dependencies on the basis of some software installation, it is common practice to use a local configuration system image source yum, yum install dependencies used, but generally less mirror big, if only for the installation of a two mirror yum package configuration a source of time and effort, we can advance in their own way can be connected to the external network test environment using the host country reposync synchronization source download cache yum rpm package to a local machine, use createrepo command to make a local network yum repository.
Testing the host operating system: centos7.4 x64,2c4G, 100G system disk, 1T data disk. Lvm partition format, a single data disk LV, mount / data directory.
reposync command is a python script. Yum-utils contained in the package. Therefore, if we want to use reposync command when you need to install yum-utils package.
Use the following command: yum install yum-utils
reposync -r repository name (usually base) -p target directory
No small door installation partners own yum-utils
1. repository installation and management tools apache-utils yum
yum yum the install the httpd-utils the createrepo -Y
systemctl enable the httpd
systemctl Start the httpd
2. Create a file directory
mkdir -p / the Data / Website / CentOS / 6 /
mkdir -p / the Data / Website / CentOS / 7 /
mkdir -p / the Data / Website / EPEL /
3. Modify /etc/yum.repos.d/CentOS-Base.repo
## centos7
[base7]
name=CentOS-7-os-cmiot.local baseurl=http://mirrors.163.com/centos/7/os/x86_64/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #released updates [updates7] name=CentOS-7-updates-cmiot.local baseurl=http://mirrors.163.com/centos/7/updates/x86_64/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 #additional packages that may be useful [extras7] name=CentOS-7-extras-cmiot.local baseurl=http://mirrors.163.com/centos/7/extras/x86_64/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7 ## centos6 [base6] name=CentOS-6-os-cmiot.local baseurl=http://mirrors.163.com/centos/6/os/x86_64/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates6] name=CentOS-6-updates-cmiot.local baseurl=http://mirrors.163.com/centos/6/updates/x86_64/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #additional packages that may be useful [extras6] name=CentOS-6-extras-cmiot.local baseurl=http://mirrors.163.com/centos/6/extras/x86_64/ gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 ## epel [epel6] name=CentOS-6-epel-cmiot.local baseurl=https://mirrors.aliyun.com/epel/6/x86_64/ gpgcheck=0 [epel7] name=CentOS-7