任务:搭建一台局域网的CentOS的基于http服务的yum服务器,用于局域网的CentOS更新用。
现在的情况:有CentOS-5.5-i386-bin-DVD镜像一个,服务器可以上外网。其它的CentOS机子均不可。
搭建环境:VMware workstation server的IP:192.168.132.32
【准备工作】
CentOS_Server所需安装的软件包:
yum-3.2.19-18.el5.centos (默认已安装)
yum-metadata-parser-1.1.2-2.el5 (默认已安装)
yum-fastestmirror-1.1.16-13.el5.centos (默认已安装)
yum-updatesd-0.9-2.el5 (默认已安装)
createrepo-0.4.11-3.el5 未安装
yum-arch-2.2.2-2.el5.kb.noarch.rpm (此包需要去网站下载例如http://rpm.pbone.net/) 未安装
httpd-2.2.3-22.el5.centos (默认已安装)
----说明:所有套件的版本号可能不同,但是都是来自DVD包的。
CentOS_Client所需安装的软件包:
yum-3.2.19-18.el5.centos
yum-metadata-parser-1.1.2-2.el5
【yum server搭建】
(1)建立放置RPM的位置
# mkdir -p /var/www/html/yum/centos/5.5/os/i386
# mkdir -p /var/www/html/yum/centos/5.5/updates/i386
----目前只建立这两个,还有其它的等这两个实验成功后再加入。
(2)针对目前的yum server 来更新套件 (用上海交大的ftp)
# mirrordir -v ftp://ftp2.tnc.edu.tw/pub1/centos/5.5/os/i386 /var/www/html/yum/centos/5.5/os/i386
# mirrordir -v ftp://ftp2.tnc.edu.tw/pub1/centos/5.5/updates/i386 /var/www/html/yum/centos/5.5/updates/i386
(3)分析RPM 产生headers资料夹
# yum-arch /var/www/html/yum/centos/5.5/os/i386
# yum-arch /var/www/html/yum/centos/5.5/updates/i386
(4)createrepo 产生 XML metadata,在目录下产生 repodata 文件夹
# createrepo /var/www/html/yum/centos/5.5/os/i386
# createrepo /var/www/html/yum/centos/5.5/updates/i386
【client 设定】
# cd /etc/yum.repos.d
# cp CentOS-Base.repo CentOS-Base.repo.old
# vim CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://192.168.132.32/yum/centos/5.5/os/i386
gpgcheck=1
gpgkey=http://192.168.132.32/yum/centos/5.5/os/i386/RPM-GPG-KEY-centos5
#released updates
[updates]
name=CentOS-$releasever - Updates
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://192.168.132.32/yum/centos/5.5/updates/i386
gpgcheck=1
gpgkey=http://192.168.132.32/yum/centos/5.5/updates/i386/RPM-GPG-KEY-centos5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://192.168.132.32/yum/centos/5.5/extras/i386
gpgcheck=1
gpgkey=http://192.168.132.32/yum/centos/5.5/extras/i386/RPM-GPG-KEY-centos5