这是06年帮公司做的一个在公司内部更新redhat linux服务器
这里以Fedora3为例:
首先确定http服务是可以用
在/var/www/html/ 后建立目录yum/Fedora/Corel/3/base
建立后目录:/var/www/html/yum/Fedora/Corel/3/base
同样建立目录:/var/www/html/yum/Fedora/Corel/3/updates
将Fedora3安装盘base下所有文件抄一份到:/var/www/html/yum/Fedora/Corel/3/base
建立一个自动更新文件:yum_update.cron (文件名自定)
保存在目录/etc/cron.daily/
以下是我的内容:
##### for redhat fedora3 #####
rsync -avz rsync://rpmfind.net/linux/fedora/core/updates/3/i386/*.rpm /var/www/html/yum/Fedora/Core/3/updates
createrepo /var/www/html/yum/Fedora/Core/3/updates
##### for redhat fedora4 #####
rsync -avz rsync://rpmfind.net/linux/fedora/core/updates/4/i386/*.rpm /var/www/html/yum/Fedora/Core/4/updates
createrepo /var/www/html/yum/Fedora/Core/4/updates
##### for redhat fedora5 #####
rsync -avz rsync://rpmfind.net/linux/fedora/core/updates/5/i386/*.rpm /var/www/html/yum/Fedora/Core/5/updates
createrepo /var/www/html/yum/Fedora/Core/5/updates
##### for redhat fedora6 #####
rsync -avz rsync://rpmfind.net/linux/fedora/core/updates/6/i386/*.rpm /var/www/html/yum/Fedora/Core/6/updates
createrepo /var/www/html/yum/Fedora/Core/6/updates
##### for linux centos4.2 #####
rsync -avz rsync://rsync.oss.eznetsols.org/ftp/linux/centos/4.2/os/i386/ /var/www/html/yum/Centos/4.2/base/
rsync -avz rsync://rsync.oss.eznetsols.org/ftp/linux/centos/4.2/updates/i386/ /var/www/html/yum/Centos/4.2/updates/
##### for linux centos4.3 #####
rsync -avz rsync://rsync.oss.eznetsols.org/ftp/linux/centos/4.3/os/i386/ /var/www/html/yum/Centos/4.3/base/
rsync -avz rsync://rsync.oss.eznetsols.org/ftp/linux/centos/4.3/updates/i386/ /var/www/html/yum/Centos/4.3/updates/
rsync -avz rsync://mirrors.kernel.org/fedora/extras/3/i386/*.rpm /var/www/html/yum/Fedora/Core/3/extras/i386/
createrepo /var/www/html/yum/Fedora/Core/3/extras/i386
rsync -avz rsync://mirrors.kernel.org/fedora/extras/4/i386/*.rpm /var/www/html/yum/Fedora/Core/4/extras/i386/
createrepo /var/www/html/yum/Fedora/Core/4/extras/i386
rsync -avz rsync://mirrors.kernel.org/fedora/extras/5/i386/*.rpm /var/www/html/yum/Fedora/Core/5/extras/i386/
createrepo /var/www/html/yum/Fedora/Core/5/extras/i386
rsync -avz rsync://mirrors.kernel.org/fedora/extras/6/i386/*.rpm /var/www/html/yum/Fedora/Core/6/extras/i386/
createrepo /var/www/html/yum/Fedora/Core/6/extras/i386
##### for linux kernel v2.6 #####
rsync -avz rsync://kernel.org/pub/linux/kernel/v2.6/ /var/www/html/yum/Kernel/v2.6/
192.168.4.252是服务器IP
将首页照搬上来:
Yellowdog Updater Server
Fedora3 Fedora4 Fedora5 Fedora6 CentOS Kernel
Configuring Fedora clients There are two ways that allow you to update local Fedora clients to download updates from our new server. The first is 'yum' (command line) and second 'up2date' (graphical). Up2date uses yum anyway. To continue with yum as your solution, open the /etc/yum.repos.d/fedora.repo file in VI or you editor of choice and change the entries as below.
[base]
name=Fedora Core $releasever - $basearch - Base
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
baseurl=http://192.168.4.252/yum/Fedora/Core/3/base/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=1
download:fedora.repo(for fc3)
Open the /etc/yum.repos.d/fedora-updates.repo file and change the entries as below.
[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
baseurl=http://192.168.4.252/yum/Fedora/Core/3/updates/
#mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc/$releasever
enabled=1
gpgcheck=1
download:fedora-updates.repo(for fc3)
Save the changes to these files.
Almost there. You need to install the public key from Fedora. Enter the folowing command:
rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora
NOW you are ready. At the client, enter the following command:
yum update
Configuring Fedora clients There are two ways that allow you to update local Fedora clients to download updates from our new server. The first is 'yum' (command line) and second 'up2date' (graphical). Up2date uses yum anyway. To continue with yum as your solution, open the /etc/yum.repos.d/fedora.repo file in VI or you editor of choice and change the entries as below.
[base]
name=Fedora Core $releasever - $basearch - Base
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/$releasever/$basearch/os/
baseurl=http://192.168.4.252/yum/Fedora/Core/4/base/
#mirrorlist=http://fedora.redhat.com/download/mirrors/fedora-core-$releasever
enabled=1
gpgcheck=1
download:fedora.repo(for fc4)
Open the /etc/yum.repos.d/fedora-updates.repo file and change the entries as below.
[updates-released]
name=Fedora Core $releasever - $basearch - Released Updates
#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/core/updates/$releasever/$basearch/
baseurl=http://192.168.4.252/yum/Fedora/Core/4/updates/
#mirrorlist=http://fedora.redhat.com/download/mirrors/updates-released-fc/$releasever
enabled=1
gpgcheck=1
download:fedora-updates.repo(for fc4)
Save the changes to these files.
Almost there. You need to install the public key from Fedora. Enter the folowing command:
rpm --import /usr/share/rhn/RPM-GPG-KEY-fedora
NOW you are ready. At the client, enter the following command:
yum update