搭建本地YUM源:(此文档同时实现32位和64位系统更新)
1.同步源到本地服务器
在crontab中添加如下内容,实现每天定时更新
00 01 * * * /usr/bin/rsync -avrtzH --delete --exclude=SRPMS/ --exclude=x86_64/ --exclude=isos/ rsync://rsync.muug.mb.ca/centos/5.4/ /opt/centos/i386/
00 02 * * * /usr/bin/rsync -avrtzH --delete --exclude=SRPMS/ --exclude=i386/ --exclude=isos/ rsync://rsync.muug.mb.ca/centos/5.4/ /opt/centos/x86_64/
2.搭建本地服务器(http)
在Apache中加上下面的虚拟机就OK
DocumentRoot /opt/centos
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
3,编辑本地YUM服务器所使用的.repo文件
vi /etc/yum.repos.d/CentOS-Base.repo
[updates]
name=CentOS-$releasever - updates
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[base]
name=CentOS-$releasever - base
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[fasttrack]
name=CentOS-$releasever - fasttrack
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-$releasever - extras
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-$releasever - contrib
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-$releasever - centosplus
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
[addons]
name=CentOS-$releasever - addons
baseurl=
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
4.将CentOS-Base.repo文件拷贝都本地的yum客户端的/etc/yum.repo.d目录下,覆盖掉原来的.repo文件,ok
阅读(1760) | 评论(1) | 转发(0) |