Linuxのアップデートサーバを作る。

yumアップデートサーバを作ってみる。
やっぱ検証機と本番機でアップデートの内容が変わると意味ないしねー。
自前で立てて管理しよう^^;


(1)Webサーバの用意


[root@L1 bozu]# yum install httpd

Updated:
httpd.i386 0:2.2.3-43.el5.centos.3

Dependency Updated:
httpd-manual.i386 0:2.2.3-43.el5.centos.3 mod_ssl.i386 1:2.2.3-43.el5.centos.3

Complete!

[root@L1 yum.repos.d]# /sbin/service httpd start
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
[ OK ]
[root@L1 yum.repos.d]# /sbin/chkconfig httpd on

                                                                                                      • -

格納ディレクトリの作成
[root@L1 bozu]# mkdir -p /var/www/html/centos/5/os/i386/

(2)リポジトリの同期


[root@L1 bozu]# yum install yum-utils

Installed:
yum-utils.noarch 0:1.1.16-14.el5.centos.1

Complete!
[root@L1 bozu]#

[root@L1 bozu]# reposync -r updates -n -d -p /var/www/html/centos/5/os/i386/

xulrunner-devel-unstable-1.9.0.19-1.el5_5.i386.rpm | 3.5 MB 00:01
[updates: 479 of 479 ] Downloading RPMS/yelp-2.16.0-26.el5.i386.rpm
yelp-2.16.0-26.el5.i386.rpm | 581 kB 00:00
[root@L1 bozu]#

(3)リポジトリの作成

[root@L1 yum.repos.d]# yum install createrepo

[root@L1 yum.repos.d]# cd /var/www/html/centos/5/os/i386/
[root@L1 5]# pwd
/var/www/html/centos/5/os/i386/
[root@L1 5]# createrepo $PWD
479/479 - updates/RPMS/selinux-policy-devel-2.4.6-279.el5_5.2.noarch.rpm .rpm
Saving Primary metadata
Saving file lists metadata
Saving other metadata

「-r updates」 をつけないとすべてダウンロードします。
容量がすごく大きくなります(ですが、初回は全部落としましょう)

(4)yumの設定変更


[root@L1 bozu]# cd /etc/yum.repos.d/
[root@L1 yum.repos.d]# cp -ip ./CentOS-Base.repo CentOS-Base.repo.org

[root@L1 yum.repos.d]# vi ./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-$releasever - Base
gpgcheck=1
baseurl=http://10.83.62.201/centos/$releasever/os/$basearch/
gpgkey=http://10.83.62.201/centos/$releaserver/os/$basearch/

#released updates
[updates]
name=CentOS-$releasever - Updates
gpgcheck=1
baseurl=http://10.83.62.201/centos/$releasever/os/$basearch/
gpgkey=http://10.83.62.201/centos/$releaserver/os/$basearch/

[addons]
name=CentOS-$releasever - Addons
gpgcheck=1
baseurl=http://10.83.62.201/centos/$releasever/os/$basearch/
gpgkey=http://10.83.62.201/centos/$releaserver/os/$basearch/

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
gpgcheck=1
baseurl=http://10.83.62.201/centos/$releasever/os/$basearch/
gpgkey=http://10.83.62.201/centos/$releaserver/os/$basearch/

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
gpgcheck=1
enabled=0
baseurl=http://10.83.62.201/centos/$releasever/os/$basearch/
gpgkey=http://10.83.62.201/centos/$releaserver/os/$basearch/

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
gpgcheck=1
enabled=0
baseurl=http://10.83.62.201/centos/$releasever/os/$basearch/
gpgkey=http://10.83.62.201/centos/$releaserver/os/$basearch/