Build a local yum source server using CentOS
Build a local yum source server using CentOS
Install CentOS and configure the network environment of the system
• Configure static IP addresses
Vi/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE = eth0
TYPE = Ethernet
ONBOOT = yes
NM_CONTROLLED = yes
BOOTPROTO = static
IPADDR = 192.168.126.5
NETMASK = 255.255.255.0
GATWAY = 192.168.126.2
• Configure DNS
Vi/etc/resolv. conf
Nameserver 192.168.126.2
If it is a virtual machine, the gateway address is configured.
• Configure the Gateway
Vi/etc/sysconfig/network
NETWORKING = yes
HOSTNAME = yum
GATEWAY = 192.168.126.2
• Restart the network service
Service network restart
Install nginx
• Download nginx
Yum install nginx
If the download fails or the source is not found, you can update the third-party source for installation.
• Set to enable startup
Chkconfig nginx on
• Update nginx Configuration
Vi/etc/nginx. conf
Add the following content to http:
Autoindex on; # enable nginx directory browsing
Autoindex_exact_size off; # the file size is displayed starting from KB.
Autoindex_localtime on; # display the file modification time as the local server time
• Access nginx
Http: // 192.168.126.5
Prepare yun source data
• Get the content of the CD
Mount/dev/cdrom/mnt/
• Copy the CD file to the nginx directory
Mkdir/usr/share/nginx/html/yum
Cp-rf/mnt/*/usr/share/nginx/html/yum/
• Access nginx
Http: // 192.168.126.5/yum
Update yum source information
• Create a yum source configuration file on the client host
Vi/etc/yum. repos. d/LocalServer. repo
[Local]
Name = CentOS/localserver
Baseurl = http: // 192.168.126.5/yum/
Enabled = 1
Gpgkey = http: // 192.168.126.5/yum/RPM-GPG-KEY-CentOS-6
Gpgcheck = 1
• Set other sources to invalid
Vi CentOS-Base.repo
Add enabled = 0
• Check for updates
Yum check-update
Yum repolist
For more YUM tutorials, see the following:
RedHat 6.2 modify yum source in Linux use CentOS source for free
Configure the epel yum Source
Redhat local yum source configuration
Description of yum configuration file
Install yum in RedHat 6.1)
YUM installation and cleaning
Build yum local source on CentOS 6.4