免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1552 | 回复: 0

为redhat增加apt软件包管理工具 [复制链接]

论坛徽章:
0
发表于 2004-10-08 20:52 |显示全部楼层

    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
为redhat增加apt软件包管理工具  
一、 简介
    redhat采用了RPM软件包管理系统,RPM软件包管理系统具有强大的编译安装功能,但是由于历史原因,RPM软件包管理系统对软件之间的依存关系没有内部定义,造成安装RPM软件时经常出现令人无法理解的软件依赖问题。
    debian系统则基于apt(Advanced Packaging Tool)工具进行软件包管理,可以自动解决并安装倚赖软件包,因此debian linux被认为是最容易管理和升级的系统,apt工具也被认为是目前最好的软件包管理工具之一。为了解决redhat包管理系统的致命问题,Conectiva Linux将apt系统移植到了使用rpm软件包管理系统的Linux系统下,使得基于RPM软件包的系统可以利用apt工具提供的自动解决倚赖关系的能力。目前已经有很多为redhat linux提供apt方式升级管理软件包的站点,如
http://freshrpms.net

http://apt.unl.edu
等等,使得redhat也成为可以利用apt工具的发行版之一,本文介绍如何在redhat linux系统安装和使用apt软件包管理工具。
    为了对apt工具的特性有一个大致的了解,下面先介绍几个使用apt with rpm管理系统的实例:
    (1)删除一个软件包时自动删除相关软件包:
    [root@linux root]# apt-get remove nessus-common
   
    2)自动下载安装依赖包:
    [root@linux root]# apt-get install nessus-server
   
    (3)维护系统软件,自动更新系统 :
    [root@linux root]# apt-get upgrade
二、APT 简易运作原理
    我们的机器安装了 APT 套件之后就成了 APT 的使用者端,当我们在安装、升级 RPM 的时候,事实上,都是透过网络连到远程的 APT 服务器去下载 RPM 回来安装的,APT 服务器我们是可以自己指定的,而 APT 使用者端也可以同时成为 APT 服务器(在第二节我们会讲到 APT 服务器的架设)
    apt-get update 指令会同步使用者端和 APT 服务器的 RPM 索引清单(package list),APT 服务器的 RPM 索引清单置于 base 资料夹内(base 数据夹是由 genbasedir 指令所产生),使用者端计算机取得 base 资料夹内的 bz2 RPM 索引清单压缩文件后,会将其解压置放于 /var/state/apt/lists/,而使用者使用 apt-get install 或 apt-get dist-upgrade 指令的时候,就会将这个资料夹内的资料和使用者端计算机内的 RPM 数据库比对,如此一来就可以知道那些 RPM 已安装、未安装、或是可以升级的,所以一旦 APT 服务器内的 RPM 有所更动,一定要记得使用 genbasedir 指令产生新的RPM索引清单。
三、安装apt with rpm及其图形界面前端synaptic
    下面简单介绍一下如何下载和安装apt with rpm
    apt with rpm可以直接到 http://freshrpms.net 下载安装,目前该站点提供了redhat 6.2, 7.x和8.0的软件升级服务,下面是几个常用redhat版本的apt下载地址:
    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命令安装:
    [root@linux root]# rpm -ihv apt-0.5.4cnc9-fr1.i386.rpm
    freshrpms.net同时提供了一个图形界面的apt-rpm接口synaptic,使用图形界面的apt更加方便,安装了apt后,可以直接利用apt安装synaptic:
    [root@linux root]# apt-get update
    [root@linux root]# apt-get install synaptic
    在几行提示之后Synaptic就安装好了,进入Xwindow,synaptic会出现在“系统设置”菜单里面。
三、使用apt
    在redhat上面使用apt和在debian下面使用几乎完全一样,配置文件在/etc/apt/,按照前面介绍安装好apt之后就可以使用并可以更新redhat提供的RPM更新以及freshrpms.net提供的更新了。主要运行命令如下:
   (1)更新软件列表,获取远程rpm服务器上的软件列表和相互依赖关系列表,所有可用软件的下载地址都在/etc/apt/sources.list里面定义,下面的多数下载操作地址也是在这里定义的。
    [root@linux root]# apt-get update
   (2)检查本地软件依赖关系合法性,由于rpm系统的问题,很多系统会存在一些依赖问题,用下面命令检查依赖关系,同时apt-get会提供一些修复方案,只有本机没有依赖关系问题了才能良好地使用apt-rpm。一个新安装的干净系统不会有依赖关系问题。
    [root@linux root]# apt-get check
   (3)安装或升级一个新软件
    [root@linux root]# apt-get install package-name
    package-name是rpm包的名字的前面部分,不包含版本号,如果选择不同的处理器类型,可以在后面添加@i686等标识。
   (4)升级所有系统软件
    [root@linux root]# apt-get upgrade
   (5)全面升级,比upgrade更加智能化的升级,同时解决升级时的一些依赖关系
    [root@linux root]# apt-get dist-upgrade
   (6)卸载软件,同时卸载依赖软件
    [root@linux root]# apt-get remove package-name
   (7)清除本地下载的rpm包,rpm包下载后保存在/var/cache/apt/archieves下面,本命令清除已下载安装过的rpm文件
    [root@linux root]# apt-get clean
   
    (8)apt-cache showpkg
    显示软件包的一些常规信息
    [root@linux root]# apt-cache showpkg openssh
   
    (9)apt-cache stats
    显示相关的统计信息显示相关的统计信息
   
    (10)apt-cache dump
    显示缓存中的每个软件包的简要描述信息
   
    (11)apt-cache unmet
    显示不符合一致性的依赖关系
   
    (12)apt-cache show
    显示指定软件包的记录信息。类似于rpm -qi
   
    (13)apt-cache search
    查找软件包,类似于rpm -qa|grep package_name
    例: apt-cache search openssh
   
    (14)apt-cache depends
    显示软件包的依赖性关系
   
    (15)apt-cache pkgnames
    列出所有的软件包
    例: $ apt-cache pkgnames openss
    openssh-askpass
    openssl096
    openssl-perl
    openssl095a
    openssl-python
    openssh-clients
    openssl-devel
    openssh-askpass-gnome
    openssh
    openssl
    openssh-server
    (16)apt-config dump 显示目前的配置信息。
    以上所有命令都可以通过图形界面的前端软件synaptic完成,图形化的软件使用起来更加直观,理解了前面几个主要命令,就可以毫无困难地使用synaptic了,所以本文不再赘述Synaptic的使用方法了。
四 定制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/
*(若网络频宽不高,会花很久时间,请耐心等候)


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/60/showart_1119.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP