歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> 為redhat增加apt軟件包管理工具

為redhat增加apt軟件包管理工具

日期:2017/2/27 14:19:14   编辑:更多Linux
  一、 簡介 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 Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done The following packages will be REMOVED: nessus-client nessus-common nessus-server 0 packages upgraded, 0 newly installed, 3 to remove(replace) and 0 not upgraded.Need to get 0B of archives. After unpacking 4863kB will be freed. Do you want to continue? [Y/n] Executing RPM (-e)... warning: /etc/nessus/nessusd.conf saved as /etc/nessus/nessusd.conf.rpmsave [root@linux root]# (2)自動下載安裝依賴包: [root@linux root]# apt-get install nessus-server Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done The following extra packages will be installed: nessus-common nmap The following NEW packages will be installed: nessus-common nessus-server nmap 0 packages upgraded, 3 newly installed, 0 to remove(replace) and 0 not upgraded.Need to get 1239kB of archives. After unpacking 4889kB will be used. Do you want to continue? [Y/n] Get:1 http://apt.freshrpms.net freshrpms/7.2/freshrpms nessus-common 1:1.1.12-fr1 [101kB] Get:2 http://apt.freshrpms.net freshrpms/7.2/freshrpms nessus-server 1:1.1.12-fr1 [895kB] Get:3 http://apt.freshrpms.net redhat/i386/7.2/os nmap 2.54BETA22-3 [243kB] Fetched 1239kB in 54s (22.8kB/s) Executing RPM (-U)... Preparing... ########################################### [100%] 1:nessus-common ########################################### [ 33%] 2:nmap ########################################### [ 66%] 3:nessus-server ########################################### [100%] [root@linux root]# (3)維護系統軟件,自動更新系統 :


[root@linux root]# apt-get upgrade Processing File Dependencies... Done Reading Package Lists... Done Building Dependency Tree... Done The following packages will be upgraded at libXML2 libxml2-devel openldap openldap-clients openldap-devel rsync 7 packages upgraded, 0 newly installed, 0 to remove(replace) and 0 not upgraded.Need to get 2132kB of archives. After unpacking 560kB will be freed. Do you want to continue? [Y/n] Get:1 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os at 3.1.8-23 [42.6kB] Get:2 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os libxml2 2.4.10-0.7x.2 [360kB] Get:3 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os libxml2-devel 2.4.10-0.7x.2 [617kB] Get:4 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os openldap 2.0.21-1 [424kB] Get:5 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os openldap-clients 2.0.21-1 [114kB] Get:6 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os openldap-devel 2.0.21-1 [462kB] Get:7 http://apt-rpm.tuxfamily.org redhat-updates-7.2/redhat/os rsync 2.4.6-8 [112kB] Fetched 2132kB in 3m8s (11.3kB/s) Executing RPM (-U)... Preparing... ########################################### [100%] 1:libxml2 ########################################### [ 14%] 2:rsync ########################################### [ 28%] 3:openldap ########################################### [ 42%] 4:openldap-clients ########################################### [ 57%] 5:openldap-devel ########################################### [ 71%] 6:at ########################################### [ 85%] 7:libxml2-devel ########################################### [100%] [root@linux root]# 二、安裝apt with rpm及其圖形界面前端Synaptic 下面簡單介紹一下如何下載和安裝apt with rpm apt with rpm可以直接到 [url]http://freshrpms.net[/url] 下載安裝,目前該站點提供了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/valhalla/apt/apt-0.5.4cnc9-fr0.1.rh73.i386.rpm redhat 8.0 http://ftp.freshrpms.net/pub/freshrpms/psyche/apt/apt-0.5.4cnc9-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會出現在“系統設置”菜單裡面。[Fixme: redhat 7.x版本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 以上所有命令都可以通過圖形界面的前端軟件Synaptic完成,圖形化的軟件使用起來更加直觀,理解了前面幾個主要命令,就可以毫無困難地使用Synaptic了,所以本文不再贅述Synaptic的使用方法了。 四 定制apt-rpm (1)添加軟件資源列表 在apt-rpm系統裡面添加軟件資源非常容易,只需要按照提供apt服務的服務器的說明在/



[root@linux root]# apt-get clean 以上所有命令都可以通過圖形界面的前端軟件Synaptic完成,圖形化的軟件使用起來更加直觀,理解了前面幾個主要命令,就可以毫無困難地使用Synaptic了,所以本文不再贅述Synaptic的使用方法了。 四 定制apt-rpm (1)添加軟件資源列表 在apt-rpm系統裡面添加軟件資源非常容易,只需要按照提供apt服務的服務器的說明在/



Copyright © Linux教程網 All Rights Reserved