Linux系統下程式安裝主要采用三種方式:
1、rpm,有點類似.msi 和.exe比較類似,軟體包(相當于windows的某個程式的所有檔案)的安裝路徑和檔案名稱基本是固定的,但是他不會安裝關聯的包,就像windows下經常會讓你安裝.netframwwork包一樣,你必須已經有一定的系統環境了,你才能順利安裝rpm程式。
2、yum,有點像appstore和安卓的應用商店,yum安裝一個程式時會把關聯的程式一起安裝,確定你裝完後就可以用。
3、源碼包安裝,有點像windows裡面的visualstudio直接寫出來的原始程式,在vs中你需要把程式編譯後才能生成能夠運作的exe,這種方式就和源碼安裝程式方式類似了,我們首先要将源碼包編譯,然後安裝才能使用,這種方式較rpm方式和yum方式複雜。
接下來三篇部落格将分别讨論三種程式安裝方式的方法
一、rpm工具
rpm工具原本是Red Hat Linux發行版專門用來管理Linux各項套件的程式,由于它遵循GPL規則且功能強大友善,因而廣受歡迎,逐漸受到其他發行版的采用。
(一)rpm包名稱含義
Wiki的英文解釋:
An RPM is delivered in a single file, normally in the format:
<name>-<version>-<release>.<architecture>.rpm
such as:libgnomeuimm-2.0-2.0.0-3.i386.rpm
where <name>(包名) is libgnomeuimm, <version>(版本) is 2.0, <release> is 2.0.0-3, and <architecture> is i386.
Source code may also be distributed in RPM packages in which case the <architecture> part is specified as src as in, libgnomeuimm-2.0-2.0.0-3.src.rpm
RPMs with the noarch.rpm extension refer to packages which do not depend on a certain computer's architecture. These include graphics and text for another program to use, and programs written in interpreted programming languages such as Python programs and shell scripts.
The RPM contents also include a package label, which contains the following pieces of information:
software name
software version (the version taken from original upstream source of the software)
package release (the number of times the package has been rebuilt using the same version of the software). This field is also often used for indicating the specific distribution the package is intended for by appending strings like "mdv" (formerly, "mdk") (Mandriva Linux), "mga" (Mageia), "fc4" (Fedora Core 4), "rhl9" (Red Hat Linux 9), "suse100" (SUSE Linux 10.0) etc.
architecture for which the package was built (i386, i686, x86_64, ppc, etc.)
The package label fields do not need to match the filename.
(二)CD光牒下的rpm包
補充一下linux檢視CD光牒資訊的操作
1、首先在vmware中插入系統安裝CD光牒,标紅處選擇我們安裝系統時的那個鏡像ISO檔案。

2、在centos下挂載CD光牒
3、檢視CD光牒下的Packages目錄,我們看到該目錄下有許多的rpm包,這就是一個個的程式。
系統安裝碟iso檔案下本身包含了很多rpm包,系統安裝時可以預設安裝一些包以适應系統功能選擇的不同,比如你在這個界面中選擇FTP伺服器的話系統安裝時就會安裝FTP的相關rpm包。
(三)安裝rpm程式實際操作
指令文法:rpm [-選項] [包名或指令名]
選項:
-a, --all 查詢/驗證所有
-i, --install 安裝軟體包
-v, --verbose 提供更多的詳細資訊輸出,就是顯示過程,很多指令都有這個選項,tar、gzip等等,便于你 了解程式在幹什麼。
-U 更新軟體包
-q 查詢,比如 rpm -qa查詢系統中所有安裝的rpm包
-e, --erase 解除安裝軟體包,rpm -e +包名就可以解除安裝某個程式,注意解除安裝時會校驗依賴,如果包被依賴那麼 解除安裝不了。
下面以安裝解除安裝vsftpd.x86_64.0.3.0.2-22.el7為例示範rpm工具用法
1、查詢系統中是否安裝這個包
指令:<code>rpm -q vsftpd</code>(注意隻寫包名,一般都是最前面有一堆英文字母)
2、安裝vsftpd.x86_64.0.3.0.2-22.el7這個包
指令:<code>rpm -ivh vsftpd.x86_64.0.3.0.2-22.el7.rpm</code>(注意現在應該在/mnt/Packages目錄下,不然就要用rpm包的絕對路徑)
檢視一下,已經安裝好了
3、更新安裝的vsftp程式(較少用到的功能)
指令:<code>rpm -Uvh vsftpd-3.0.2-22.el7.x86_64.rpm</code>
4、檢視安裝的vsftpd.x86_64.0.3.0.2-22.el7.rpm包的具體資訊
指令:<code>rpm -qi vsftpd</code>
5、檢視vsftpd包含哪些檔案
指令:<code>rpm -ql vsftpd</code>
6、檢視某個指令是由哪個rpm包安裝的
指令:<code>rpm -qf /usr/bin/ls</code>(指令的絕對路徑)或者用反引号。
7、解除安裝vsftpd程式
指令:<code>rpm -evh vsftpd</code>
本文轉自 whytl 51CTO部落格,原文連結:http://blog.51cto.com/11934539/2058791