Now if we need a large-scale deployment to wash a system, or the system needs to install a software such as Nginx software. Sometimes your environment restricts you to sisu the net, or the outside network is very slow time. We consider the establishment of local Yum warehouse, intranet machine can directly install the required software, to solve the Linux under the dependency of the package, convenient, fast.
Let's build up the underlying Yum repository:
System: centos6.5
There are many ways to build a yum repository, and we use the Yum plugin yum-downloadonly plugin to download the RPM packages we need. Use Createrepo to create a warehouse file.
Begin:
We need to install Zabbix Monitor, NIGNX Web server, but our local Yum does not have a ZABBIX,NIGNX package. We install it. Find a machine that can access the Internet:
Yum install-y yum-plugin-downloadonly Createrepo
Create warehouse Address We use/data/mirrors as a warehouse directory here.
Mkdir-p/data/mirrors/centos/6/{os,updates}/i386/rpms
Mkdir-p/data/mirrors/centos/6/{os,updates}/x86_64/rpms
After that, you can download the RPM package to the development directory:
Yum install nginx zabbix-server-y--downloadonly--downloaddir=/data/mirrors/centos/6/os/x86_64/rpms
Cp/data/mirrors/centos/6/os/x86_64/rpms/*.rpm/data/mirrors/centos/6/updates/x86_64/rpms
To create a warehouse file:
createrepo/data/mirrors/centos/6/os/x86_64/rpms/
createrepo/data/mirrors/centos/6/updates/x86_64/rpms/
To provide a Web server externally using NIGNX:
Yum install-y Nginx
Vi/etc/nginx/conf.d/mirros.conf
server {
Listen 80;
server_name centos6.dengchao.com;## #你机器的域名映射
Root/data/mirrors;
Index index.html;
}
To create a repo file:
VI Mirrors.repo
[Mbase]
Name=centos-6-base
baseurl=http://centos6.dengchao.com/centos/6/os/x86_64/
Enabled=1
Gpgcheck=0
#released Updates
[Mupdates]
Name=centos-6-Updates
baseurl=http://centos6.dengchao.com/centos/6/updates/x86_64/
Enabled=1
Gpgcheck=0
CP mirrors.repo/etc/yum.repos.d/
This is where our Yum source is built.
As long as the intranet can be connected with this machine, directly using Mirrors.repo to/etc/yum.repos.d/, you can start to install Nginx and any software you want to install
This article from "Nginx Installation Optimization" blog, declined reprint!
CentOS Create local Yum source build local Yum Warehouse Pro-Test available