为了节省流量,提高效率,我们在机房内部署了自己的yum server。
安装httpd服务。
同步yum源到/var/www/html/linux下的目录
/usr/bin/rsync -avzL --delete--exclude=SRPMS --exclude=i386 --exclude=isos rsync://mirrors.ustc.edu.cn/centos/6/ /var/www/html/linux/centos/x86_64//usr/bin/rsync -avzL --delete rsync://mirrors.ustc.edu.cn/fedora-epel/6/x86_64 /var/www/html/linux/centos/epel/
北京在线源
添加自动化任务,每天夜里自动同步
# vi /var/spool/cron/root
01***/usr/bin/rsync -avzL --delete--exclude=SRPMS --exclude=i386 --exclude=isos rsync://mirrors.ustc.edu.cn/centos/6/ /var/www/html/linux/centos/x86_64/
01***/usr/bin/rsync -avzL --delete rsync://mirrors.ustc.edu.cn/fedora-epel/6/x86_64 /var/www/html/linux/centos/epel/
# service httpd start
在某一台机器上创建和修改以下文件
[root@vm2 yum.repos.d]# more CentOS-Base.repo # 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 are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the #mirrorlist= does not work for you, as a fall back you can try the# remarked out baseurl= line instead.##[base] name=CentOS--Base#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=os baseurl=http://172.16.1.101/linux/centos/x86_64/os/x86_64/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#released updates[updates] name=CentOS--Updates#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=updates baseurl=http://172.16.1.101/linux/centos/x86_64/updates/x86_64/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras] name=CentOS--Extras#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=extras baseurl=http://172.16.1.101/linux/centos/x86_64/extras/x86_64/ gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus] name=CentOS--Plus#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=centosplus baseurl=http://172.16.1.101/linux/centos/x86_64/centosplus/x86_64/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib] name=CentOS--Contrib#mirrorlist=http://mirrorlist.centos.org/?release=&arch=&repo=contrib baseurl=http://172.16.1.101/linux/centos/x86_64/contrib/x86_64/ gpgcheck=1 enabled=0 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6[root@vm2 yum.repos.d]# more epel.repo [epel] name=ExtraPackagesforEnterpriseLinux6- $basearch baseurl=http://172.16.1.101/linux/centos/epel/$basearch#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch failovermethod=priority enabled=1 gpgcheck=1 gpgkey=http://172.16.1.101/linux/centos/epel/RPM-GPG-KEY-EPEL-6[epel-debuginfo] name=ExtraPackagesforEnterpriseLinux6- $basearch -Debug baseurl=http://172.16.1.101/linux/centos/epel/$basearch/debug#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-6&arch=$basearch failovermethod=priority enabled=0 gpgkey=http://172.16.1.101/linux/centos/epel/RPM-GPG-KEY-EPEL-6 gpgcheck=1[epel-source] name=ExtraPackagesforEnterpriseLinux6- $basearch -Source baseurl=http://172.16.1.101/linux/centos/epel/SRPMS#mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-source-6&arch=$basearch failovermethod=priority enabled=0#gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6 gpgkey=http://172.16.1.101/linux/centos/epel/RPM-GPG-KEY-EPEL-6 gpgcheck=1
测试一下,一切正常。
原文:http://www.cnblogs.com/cmsd/p/3586407.html