二進位軟體包管理RPM、YUM) 原始碼包安裝 指令碼安裝Shell或Java指令碼) Debian系Linux軟體包管理簡介
一、RPM包管理RPM軟體包的一個例子:sudo-1.8.6p3-7.el6.x86_64.rpm其中包括軟體名(sudo),版本號碼( 1.8.6p3),發行號( 7.el6),和硬體平台( x86_64)。650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42KI0-0.png" height="60" data-media-type="image" data-inited="true" />1) 卸載# rpm -e sudo注意:如果其它軟體包有依賴關係,卸載時會產生提示資訊,可使用--nodeps強行卸載。650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42H004-1.png" height="100" data-media-type="image" data-inited="true" />
2)安裝# rpm -ivh /mnt/cdrom/Packages/sudo-1.8.6p3-7.el6.x86_64.rpm掛載光碟片:mkdir /mnt/cdrommount /dev/cdrom /mnt/cdrom查詢:rpm -q sudorpm -qa | grep samba650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M018-2.png" height="178" data-media-type="image" data-inited="true" />其他安裝選項:--excludedocs不安裝軟體包中的文檔檔案--prefix PATH將軟體包安裝到由PATH指定的路徑下--test只對安裝進行測試,並不實際安裝
A. 軟體包已被安裝[root@localhost ~]# rpm -ivh /mnt/cdrom/Packages/sudo-1.8.6p3-7.el6.x86_64.rpm Preparing... ########################################### [100%] package sudo-1.8.6p3-7.el6.x86_64 is already installed如果覆蓋安裝該軟體包,可以在命令列上使用--replacepkgs 選項。650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42L342-3.png" height="100" data-media-type="image" data-inited="true" />
B. 檔案衝突如果要安裝的軟體包中有一個檔案已在安裝其它軟體包時安裝,會出現以下錯誤資訊:# rpm -ivh sudo-1.7.2p1-5.el5.i386.rpmconflicts with file from bark-3.2-1lsudo-1.7.2p1-5.el5.i386.rpm cannot be installed要想讓RPM 忽略該錯誤資訊, 請使用--replacefiles命令列選項。
C.未解決依賴關係RPM軟體包可能依賴於其它軟體包,在安裝了特定的軟體包之後才能安裝該軟體包。# rpm -ivh sudo-1.7.2p1-5.el5.i386.rpmfailed dependencies:sudo is needed by bark-3.2-1l你必須安裝完所依賴的軟體包,才能解決這個問題,強制安裝使用--nodeps 選項。
3)升級# rpm -Uvh sudo-1.8.6p3-7.el6.x86_64.rpm
4)查詢選項:-a 查詢所有已安裝的軟體包.-f 查詢檔案所屬軟體包-p 查詢軟體包-i 顯示軟體包資訊-l 顯示軟體包中的檔案清單-d 顯示被標註為文檔的檔案清單-c 顯示被標註為設定檔的檔案清單
RPM查詢應用案例:1、查詢檔案隸屬的軟體包:rpm -qf650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42GJ4-4.png" height="115" data-media-type="image" data-inited="true" />
2、查詢軟體包資訊:rpm -qi、rpm -qip650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42KA2-5.png" height="424" data-media-type="image" data-inited="true" />
查詢未安裝RPM包資訊650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M041-6.png" height="463" data-media-type="image" data-inited="true" />
3、查詢軟體包安裝檔案:rpm -ql、rpm -qlp查詢軟體包安裝系統位置650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42G2L-7.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42K220-8.png" height="484" data-media-type="image" data-inited="true" />
4、查詢軟體包協助文檔:rpm -qd650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42J2N-9.png" height="287" data-media-type="image" data-inited="true" />
5、查詢軟體包設定檔:rpm -qc650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M295-10.png" height="126" data-media-type="image" data-inited="true" />
5)校正# rpm -V 軟體名稱? 5 檔案的md5校正值? S 檔案大小? L 連結檔案? T 檔案的建立時間? D 裝置檔案? U 檔案的使用者? G 檔案的使用者組?M 檔案的許可權
[root@localhost ~]# rpm -V sudoS.5....T. d /usr/share/doc/sudo-1.8.6p3/sample.sudo.conf顯示sudo軟體包自從安裝好後/usr/share/doc/sudo-1.8.6p3/sample.sudo.conf檔案大小,MD5值,建立時間更改過。650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42LJ8-11.png" height="484" data-media-type="image" data-inited="true" />
6)軟體包檔案提取解壓所有檔案到目前的目錄# rpm2cpio initscripts-8.45.30-2.el5.centos.i386.rpm | cpio -idv解壓指定檔案到目前的目錄# rpm2cpio initscripts-8.45.30-2.el5.centos.i386.rpm | cpio -idv ./etc/inittab650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M340-12.png" height="184" data-media-type="image" data-inited="true" />
二、YUM包管理應用yum的好處: 自動解決軟體包依賴關係 方便的軟體包升級
安裝yum install650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42LS5-13.png" height="465" data-media-type="image" data-inited="true" />
檢測升級yum check-update650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42L031-14.png" height="108" data-media-type="image" data-inited="true" />
升級yum update650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M0W-15.png" height="389" data-media-type="image" data-inited="true" />
軟體包查詢yum list650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42J000-16.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42Jc6-17.png" height="314" data-media-type="image" data-inited="true" />
軟體包資訊yum info650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42L358-18.png" height="413" data-media-type="image" data-inited="true" />
卸載yum remove650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42MI7-19.png" height="390" data-media-type="image" data-inited="true" />
協助yum -help、man yum650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42H622-20.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42KJ3-21.png" height="484" data-media-type="image" data-inited="true" />
三、原始碼包安裝應用舉例proftpd):# tar -xzvf proftpd-1.3.5rc3.tar.gz解壓解包)# cd proftpd-1.3.5rc3# ./configure --prefix=/usr/local/proftpd配置)# make 編譯)# make install 安裝)軟體:http://www.proftpd.org650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42L148-22.png" height="319" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M304-23.png" height="88" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M403-24.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42HS9-25.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42G964-26.png" height="364" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42HZ1-27.png" height="405" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42HF6-28.png" height="327" data-media-type="image" data-inited="true" />
四、指令碼安裝應用舉例webmin、OpenOffice )# tar -zxvf webmin-1.630.tar.gz# cd webmin-1.630# vi README# ./setup.sh軟體:http://www.webmin.cn/download.html650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42K616-29.png" height="484" data-media-type="image" data-inited="true" />650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42GG9-30.png" height="427" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42M138-31.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42KX2-32.png" height="484" data-media-type="image" data-inited="true" />
650) this.width=650;" title="clipboard.png" src="http://www.bkjia.com/uploads/allimg/131227/1J42H4b-33.png" />650) this.width=650;" style="border-bottom:0px;border-left:0px;border-top:0px;cursor:default;border-right:0px" title="clipboard" border="0" alt="clipboard" src="http://www.bkjia.com/uploads/allimg/131227/1J42KK4-34.png" height="435" data-media-type="image" data-inited="true" />
五、APT包管理搜尋軟體包apt-cache search軟體包資訊apt-cache show安裝apt-get installreinstall、-f)刪除apt-get removeautoremove、--purge)更新軟體源apt-get update更新已安裝包apt-get upgrade
END
本文出自 “王乾De技術部落格” 部落格,請務必保留此出處http://redking.blog.51cto.com/27212/1240452