rpm軟件包管理工具詳解

Linux常見的軟件包分爲兩種:源代碼包(Source Code)、二進制包(Binary Code);源代碼包是沒有經過編譯的包,需要經過GCC、C++編譯器環境才能運行,二進制包無需編譯,可直接安裝使用。

rpm 二進制包說明:
vsftpd-3.0.2-21.e17.x86_64.rpm
vsftpd 包名稱/軟件名
3.0.2 版本號
21 小版本號
e17 給哪個系統使用 (el6 表示centos6使用 el7表示centos7使用)
x86_64 系統架構 i386(32位)  x86_64(64位)
rpm 包名後綴名


使用RPM工具可以對軟件包進行快速安裝、卸載、修復、更新、查詢。

1、安裝
-ivh 安裝軟件包
--force 強制安裝
--nodeps 忽略依賴關係

2、卸載
-e 卸載軟件包


3、修復
rpm -ivh 包名  --replacepkgs


4、更新
rpm -Uvh 升級軟件包


5、查詢
查詢軟件是否安裝
rpm -q vsftpd
-q 準確查詢
-qa 全名查詢

高級命令

》》查詢列出所有配置文件
rpm -qc vsftpd

/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf


》》查詢列出軟件包中的所有文件清單

rpm -ql vsftpd

/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/lib/systemd/system-generators/vsftpd-generator
/usr/lib/systemd/system/vsftpd.service
/usr/lib/systemd/system/vsftpd.target
/usr/lib/systemd/system/[email protected]
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-3.0.2
/usr/share/doc/vsftpd-3.0.2/AUDIT
/usr/share/doc/vsftpd-3.0.2/BENCHMARKS
/usr/share/doc/vsftpd-3.0.2/BUGS
/usr/share/doc/vsftpd-3.0.2/COPYING
/usr/share/doc/vsftpd-3.0.2/Changelog
/usr/share/doc/vsftpd-3.0.2/EXAMPLE
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-3.0.2/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-3.0.2/FAQ
/usr/share/doc/vsftpd-3.0.2/INSTALL
/usr/share/doc/vsftpd-3.0.2/LICENSE
/usr/share/doc/vsftpd-3.0.2/README
/usr/share/doc/vsftpd-3.0.2/README.security
/usr/share/doc/vsftpd-3.0.2/REWARD
/usr/share/doc/vsftpd-3.0.2/SECURITY
/usr/share/doc/vsftpd-3.0.2/SECURITY/DESIGN
/usr/share/doc/vsftpd-3.0.2/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-3.0.2/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-3.0.2/SECURITY/TRUST
/usr/share/doc/vsftpd-3.0.2/SIZE
/usr/share/doc/vsftpd-3.0.2/SPEED
/usr/share/doc/vsftpd-3.0.2/TODO
/usr/share/doc/vsftpd-3.0.2/TUNING
/usr/share/doc/vsftpd-3.0.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

》》查詢/驗證文件屬於的軟件包
rpm -qf /etc/vsftpd/vsftpd.conf
vsftpd-3.0.2-22.el7.x86_64


》》查看軟件安裝後詳細信息

rpm -qi vsftpd
Name        : vsftpd                       Relocations: (not relocatable)
Version     : 2.2.2                             Vendor: CentOS
Release     : 24.el6                        Build Date: Wed 22 Mar 2017 08:14:03 PM CST
Install Date: Mon 28 Aug 2017 10:39:30 PM CST      Build Host: c1bm.rdu2.centos.org
Group       : System Environment/Daemons    Source RPM: vsftpd-2.2.2-24.el6.src.rpm
Size        : 348208                           License: GPLv2 with exceptions
Signature   : RSA/SHA1, Thu 23 Mar 2017 11:03:17 PM CST, Key ID 0946fca2c105b9de
Packager    : CentOS BuildSystem <http://bugs.centos.org>
URL         : http://vsftpd.beasts.org/
Summary     : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.

》》列出RPM軟件包的描述信息
rpm -qpi vsftpd-3.0.2-21.e17.x86_64.rpm

[root@centos7 ~]# rpm -qp vsftpd-3.0.2-21.el7.x86_64.rpm 
vsftpd-3.0.2-21.el7.x86_64
[root@centos7 ~]# rpm -qpi vsftpd-3.0.2-21.el7.x86_64.rpm 
Name        : vsftpd
Version     : 3.0.2
Release     : 21.el7
Architecture: x86_64
Install Date: (not installed)
Group       : System Environment/Daemons
Size        : 356228
License     : GPLv2 with exceptions
Signature   : RSA/SHA256, 2016年11月21日 星期一 04時58分43秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : vsftpd-3.0.2-21.el7.src.rpm
Build Date  : 2016年11月06日 星期日 03時43分17秒
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : https://security.appspot.com/vsftpd.html
Summary     : Very Secure Ftp Daemon
Description :
vsftpd is a Very Secure FTP daemon. It was written completely from
scratch.

》》查看RPM軟件包的安裝腳本
rpm -qp --scripts vsftpd-3.0.2-21.e17.x86_64.rpm
postinstall scriptlet (using /bin/sh):


if [ $1 -eq 1 ] ; then 
        # Initial installation 
        systemctl preset vsftpd.service >/dev/null 2>&1 || : 
fi
preuninstall scriptlet (using /bin/sh):


if [ $1 -eq 0 ] ; then 
        # Package removal, not upgrade 
        systemctl --no-reload disable vsftpd.service > /dev/null 2>&1 || : 
        systemctl stop vsftpd.service > /dev/null 2>&1 || : 
fi 




if [ $1 -eq 0 ] ; then 
        # Package removal, not upgrade 
        systemctl --no-reload disable vsftpd.target > /dev/null 2>&1 || : 
        systemctl stop vsftpd.target > /dev/null 2>&1 || : 
fi
postuninstall scriptlet (using /bin/sh):


systemctl daemon-reload >/dev/null 2>&1 || : 
if [ $1 -ge 1 ] ; then 
        # Package upgrade, not uninstall 
        systemctl try-restart vsftpd.service >/dev/null 2>&1 || : 
fi


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章