Server-side configuration
1. Mount the disc image
Mkdir/mnt/cdrom
Mount/dev/sr0
2. Build Apache Server
Yum-y Install httpd
Service httpd Restart
Chkconfig httpd on
3. Copy disc image to www directory
Mkdir-p/var/www/html/yum/centos
cp-rp/mnt/cdrom/*/var/www/html/yum/centos
4. Installing Createrepo
Yum-y Install Createrepo
Createrepo/var/www/html/yum/centos
Client Configuration
Modify the Centos-base.repo file
vi/etc/yum.repos.d/ Centos-base.repo
The BaseURL with enabled 1 is set to server-side IP
Baseurl= Http://192.168.1.60/yum/CentOS
# Centos-base.repo
#
# The Mirror system uses the connecting IP address of the client and the
# Update status of each mirror to pick mirrors that is updated to and
# Geographically close to the client. You should the use of this for CentOS updates
# Unless you is manually picking other mirrors.
#
# If The mirrorlist= does not work for you, as a fall back to you can try the
# remarked out Baseurl= line instead.
#
#
[Base]
name=centos-$releasever-base
Baseurl= Http://192.168.1.60/yum/CentOS
Gpgcheck=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
Enabled=1
#released Updates
[Updates]
name=centos-$releasever-updates
Baseurl= Http://192.168.1.60/yum/CentOS
Gpgcheck=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
Enabled=1
#additional packages that could be useful
[Extras]
name=centos-$releasever-extras
Baseurl= Http://192.168.1.60/yum/CentOS
Gpgcheck=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
Enabled=1
#additional packages that extend functionality of existing packages
[Centosplus]
name=centos-$releasever-plus
Baseurl= Http://192.168.1.60/yum/CentOS
Gpgcheck=0
Enabled=1
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
#contrib-packages by Centos Users
[Contrib]
name=centos-$releasever-contrib
mirrorlist= http://mirrorlist.centos.org/?release= $releasever &arch= $basearch &repo=contrib&infra=$ Infra
#baseurl =http://mirror.centos.org/centos/$releasever/contrib/$basearch/
Gpgcheck=1
Enabled=0
Gpgkey=file:///etc/pki/rpm-gpg/rpm-gpg-key-centos-6
This article is from the "System Operations" blog, please be sure to keep this source http://coolshell.blog.51cto.com/10748053/1698592
Build a local area network CentOS Yum Server