四 定制apt-rpm
(1)添加软件资源列表
在apt-rpm系统里面添加软件资源非常容易,只需要按照提供apt服务的服务器的说明在/etc/apt/sources.list里面加入对网站的描述即可。这一行参数的格式为:
rpm uri distribution [component1] [componenent2] [...]
其中,uri为软件资源的地址,可以是http,ftp,file等URL地址,distribution是redhat发行版本,如 7.2,7.3,8.0等等,后面的component可以忽略。有时候可能只对某软件资源的一或几部分部分感兴趣,那么可以在这里明确指出。
例如添加http://apt.unl.edu/ 提供的redhat KDE 3.1的测试软件包,只需要在sources.list里面添加一行:
rpm ftp://apt.unl.edu/apt/ 8.0 kde3-test
就将该网站的kde3部分加入了列表。
下面是一些目前可以用于redhat 的apt-rpm软件资源列表,把它们加入你的 /etc/apt/sources.list 文件就可以通过apt-rpm使用他们提供的redhat软件更新和维护了,参看网站说明。(前面是网站名,后面是适用redhat版本和简介)
http://apt.freshrpms.net/ - Red Hat Linux 6.2, 7.x 、8.0and 9.0 repositories (with all freshrpms included of course!)
http://www.linux.cz/apt-rpm/ - Red Hat Linux 7.x repositories (with all freshrpms included too!)
http://apt-rpm.tuxfamily.org/ - Red Hat Linux 6.2, 7.x 、8.0and 9.0 repositories
http://apt.nlc.no/apt/ - Red Hat Linux 6.2, 7.x and Rawhide repositories
http://ftp.uninett.no/pub/linux/apt/ - Red Hat Linux 6.2, 7.x、8.0and 9.0 and Rawhide repositories
http://redhat.usu.edu/ - Red Hat Linux 7.2, 7.3 and 8.0 repositories
ftp://mirror.pa.msu.edu/apt/ - Red Hat Linux 7.2, 7.3 and 8.0 repositories
http://apt-rpm.codefactory.se/ - Red Hat Linux 7.2, 7.3 and 8.0 and gnomehide repositories
http://apt.42h.de/ - Red Hat Linux 7.2, 7.3 and 8.0 repositories
http://apt.toggletext.com.au/ - A few Red Hat Linux 7.2 custom packages
http://people.ecsc.co.uk/~matt/repository.html - Lots of custom Red Hat Linux 8.0 GNOME 2 and related packages
http://ftp-stud.fht-esslingen.de/apt/ - Red Hat Linux 7.x, 8.x and rawhide
http://apt.unl.edu/ - Red Hat Linux 7.3 and 8.0
http://kde-redhat.sourceforge.net/ - KDE for Red Hat project
(2)把redhat安装盘添加到软件源
有的时候需要从redhat安装光盘或者iso文件安装、卸载软件,这时可以把redhat安装光盘设置为软件源。这种工作方式需要首先扫面安装光盘上的软件包,并在 /var/lib/apt/cdroms.list文件中建立光盘软件列表。
如果使用redhat光盘,只需要把光盘插入光驱,下面命令会自动mount光盘并建立列表
[root@linux root]# apt-cdrom add
如果是使用ISO文件安装,首先mount ISO文件到mount-point,把mount point输入,就可以自动搜索RPM软件列表了。
[root@linux root]# apt-cdrom -m -d mount-point add
如果是解开的硬盘映像安装,只需要把路径输入,就可以自动搜索RPM软件列表了。
[root@linux root]# apt-cdrom -m -d path add
五、 架设简易 APT 服务器 (这里只讲解Redhat 9)
注意:在进行下面操作前请先确认自己的 apache 已经在正常运做,且 /var 至少还有 2G 的空间
1.为什么要架设 APT 服务器
当我们安装 freshrpms 的 apt,安装、升级都是透过网络联机到 freshrpms 下载档案。若只维护一台服务器,还好,可是若有十台服务器,就需要花原本十倍的时间和频宽来做同样的事情,再加上若连外(美国)的频宽不充裕,这要如何是好,所以当有多台服务器要维护的时候,架设一台 APT 服务器,似乎是不错的选择。
2.安装 apt:
http://ftp.freshrpms.net/pub/freshrpms/redhat/9/apt/
请安装这网站内最新的 apt
线上安装:rpm -ivh http://ftp.freshrpms.net/pub/freshrpms/redhat/9/apt/apt-0.5.5cnc5-fr2.i386.rpm
3.建置放置 Red Hat Linux 9 相关 rpm 的资料夹
mkdir -p /var/www/html/redhat/9
mkdir /var/www/html/redhat/9/RPMS.os
mkdir /var/www/html/redhat/9/RPMS.updates
4.将整个 Red Hat Linux 9 的 binary rpm 复制到 /var/www/html/redhat/9/RPMS.os 资料夹(底下提供二种方法,请依自己状况挑选一种方法执行)
方法一:从光盘片复制(当手上有 Red Hat Linux 9 光盘片的时候可以用这个方法)
mount /mnt/cdrom
cp -f /mnt/cdrom/RedHat/RPMS/* /var/www/html/redhat/9/RPMS.os/
umount /mnt/cdrom
依照上面方法,复制第二片、第三片光盘片内的 rpm
方法二:从 iso 文件复制(当计算机内有 Red Hat Linux 9 iso 档的时候可以用这个方法用)
mkdir /mnt/iso
mount -o loop shrike-i386-disc1.iso /mnt/iso
cp /mnt/iso/RedHat/RPMS/* /var/www/html/redhat/9/RPMS.os/
umount /mnt/iso
mount -o loop shrike-i386-disc2.iso /mnt/iso
cp -f /mnt/iso/RedHat/RPMS/* /var/www/html/redhat/9/RPMS.os/
umount /mnt/iso
mount -o loop shrike-i386-disc3.iso /mnt/iso
cp -f /mnt/iso/RedHat/RPMS/* /var/www/html/redhat/9/RPMS.os/
umount /mnt/iso
5.将 Red Hat Linux 9 updates 的 rpm 复制到 /var/www/html/redhat/9/RPMS.updates 资料夹
cd /var/www/html/redhat/9/RPMS.updates
wget ftp://linux.sinica.edu.tw/pub1/redhat/updates/9/en/os/i386/*(若网络频宽不高,会花很久时间,请耐心等候)
redhat 6.2
http://ftp.freshrpms.net/pub/freshrpms/redhat/6.2/apt/apt-0.5.4cnc7-fr0.62.1.i386.rpm
redhat 7.2
http://ftp.freshrpms.net/pub/freshrpms/redhat/7.2/apt/apt-0.3.19cnc55-fr7.i386.rpm
redhat 7.3
http://ftp.freshrpms.net/pub/freshrpms/redhat/7.3/apt/apt-0.5.4cnc9-fr0.1.rh73.i386.rpm
redhat 8.0
http://ftp.freshrpms.net/pub/freshrpms/redhat/8.0/apt/apt-0.5.4cnc9-fr1.i386.rpm
redhat 9.0
http://ftp.freshrpms.net/pub/freshrpms/redhat/9/apt/apt-0.5.5cnc6-fr1.i386.rpm
rpm http://people.ecsc.co.uk/ ~matt/downloads/apt/fedora-2-i386 production
![]() |

