2.創建目錄結構
mkdir -p /xxxxxxx/repos/yum/fedora/base/11/i386
mkdir -p /xxxxxxx/repos/yum/fedora/updates/11/i386
注:/xxxxxxx/是任意選定的文件系統路徑
3.複製DVD的文件到到base目錄
mount -o loop,ro Fedora11-i386-DVD.iso /mnt/iso
cp -v /mnt/iso/Packages/* /xxxxxxx/repos/yum/fedora/base/11/i386
umount /mnt/iso
4.DVD光盤只包含基本的安裝包集合,如果需要所有安裝包,先執行下面:(不同鏡像任選其一)
rsync -avrt --progress rsync://ftp.jaist.ac.jp/pub/Linux/Fedora/releases/11/Everything/i386/os/Packages/ /xxxxxxx/repos/yum/fedora/base/11/i386
rsync -avrt --progress rsync://mirror.anl.gov/fedora/linux/releases/11/Everything/i386/os/Packages/ /xxxxxxx/repos/yum/fedora/base/11/i386
注1:rsync語法要求嚴格,目錄同步不能缺少源路徑最後的"/"
注2:請在http://mirrors.fedoraproject.org/publiclist/Fedora/11/頁面中中找一個合用的rsync鏡像
5.創建倉庫所需要的數據結構文件
createrepo /xxxxxxx/repos/yum/fedora/base/11/i386
會生成/xxxxxxx/repos/yum/fedora/base/11/i386/repodata目錄,裏面包含若干xml和gz文件
6.同步updates目錄
rsync -avrt --progress rsync://ftp.jaist.ac.jp/pub/Linux/Fedora/updates/11/i386/ --exclude=debug/ /xxxxxxx/repos/yum/fedora/updates/11/i386
7.生成cron任務定期自動更新updates
crontab -e (每天晚上2時40分更新)
40 2 * * * /usr/bin/rsync -avrt rsync://mirror.anl.gov/fedora/linux/updates/8/i386/ --exclude=debug/ /xxxxxxx/repos/yum/fedora/updates/11/i386
8.配置httpd供訪問
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "/var/www/html"
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory "/var/www/html">
Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerAdmin admin@localdomain
DocumentRoot /xxxxx/repos
ServerName updates.domain.net
DirectoryIndex index.html
LogLevel debug
ErrorLog logs/updates.domain.net-error_log
CustomLog logs/updates.domain.net-access_log common
<location / >
Options Indexes
Order allow,deny
allow from all
</location>
</VirtualHost>
name=Fedora $releasever - $basearch
failovermethod=priority
baseurl=http://updates.domain.net/yum/fedora/base/$releasever/$basearch
enabled=1
gpgcheck=0
[updates-local]
name=Fedora $releasever - $basearch - Updates
failovermethod=priority
baseurl=http://updates.domain.net/yum/fedora/updates/$releasever/$basearch/
enabled=1
gpgcheck=0