【CentOS 7筆記27】,三種方法安裝軟件包之rpm安裝#

shallow丿ovelinux


安裝軟件包的三種方法

  • rpm工具
  • yum工具
  • 源碼包
[root@localhost ~]# mount /dev/cdrom /mnt
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
	CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
	EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL
[root@localhost mnt]# cd Packages/
[root@localhost Packages]# ls
	#本地全部rpm包

rpm包格式:

包名-主版本號.次版本號.修正版本號-發佈版本號-平臺.rpmgit

常見的rpm工具使用方式

rpm -ivh zsh-*.rpm #安裝可視化vim

rpm -Uxh zsh-*.rpm #升級可視化centos

rpm -qa #查詢全部包工具

rpm -e 包名 #需安裝先依賴包ui

[root@localhost Packages]# rpm -e ppp
	error: Failed dependencies:
		ppp = 2.4.5 is needed by (installed) NetworkManager-1:0.9.9.1-13.git20140326.4dba720.el7.x86_64
[root@localhost Packages]# rpm -e NetworkManager
	error: Failed dependencies:
		NetworkManager(x86-64) = 1:0.9.9.1-13.git20140326.4dba720.el7 is needed by (installed) NetworkManager-tui-1:0.9.9.1-13.git20140326.4dba720.el7.x86_64

rpm -q 包名 #查詢是否安裝code

[root@localhost Packages]# rpm -q wget
	wget-1.14-15.el7_4.1.x86_64
[root@localhost Packages]# rpm -q vim
	package vim is not installed

rpm -qi 包名 #查詢包信息server

[root@localhost Packages]# rpm -qi wget
	Name        : wget
	Version     : 1.14
	Release     : 15.el7_4.1
	Architecture: x86_64
	Install Date: Tue 14 Nov 2017 05:59:46 AM CST
	Group       : Applications/Internet
	Size        : 2055533
	License     : GPLv3+
	Signature   : RSA/SHA256, Fri 27 Oct 2017 01:54:42 AM CST, Key ID 24c6a8a7f4a80eb5
	Source RPM  : wget-1.14-15.el7_4.1.src.rpm
	Build Date  : Fri 27 Oct 2017 12:50:51 AM CST
	Build Host  : c1bm.rdu2.centos.org
	Relocations : (not relocatable)
	Packager    : CentOS BuildSystem <http://bugs.centos.org>
	Vendor      : CentOS
	URL         : http://www.gnu.org/software/wget/
	Summary     : A utility for retrieving files using the HTTP or FTP protocols
	Description :
	GNU Wget is a file retrieval utility which can use either the HTTP or
	FTP protocols. Wget features include the ability to work in the
	background while you are logged out, recursive retrieval of
	directories, file name wildcard matching, remote file timestamp
	storage and comparison, use of Rest with FTP servers and Range with
	HTTP servers to retrieve files over slow or unstable connections,
	support for Proxy servers, and configurability.

rpm -ql 包名 #查詢包會安裝什麼文件ip

[root@localhost Packages]# rpm -ql wget
	/etc/wgetrc
	/usr/bin/wget
	/usr/share/doc/wget-1.14
	/usr/share/doc/wget-1.14/AUTHORS
	/usr/share/doc/wget-1.14/COPYING
	/usr/share/doc/wget-1.14/MAILING-LIST
	/usr/share/doc/wget-1.14/NEWS
	/usr/share/doc/wget-1.14/README
	/usr/share/doc/wget-1.14/sample.wgetrc
	/usr/share/info/wget.info.gz
	/usr/share/locale/be/LC_MESSAGES/wget.mo
	/usr/share/locale/bg/LC_MESSAGES/wget.mo
	/usr/share/locale/ca/LC_MESSAGES/wget.mo
	/usr/share/locale/cs/LC_MESSAGES/wget.mo
	/usr/share/locale/da/LC_MESSAGES/wget.mo
	/usr/share/locale/de/LC_MESSAGES/wget.mo
	/usr/share/locale/el/LC_MESSAGES/wget.mo
	/usr/share/locale/en_GB/LC_MESSAGES/wget.mo
	/usr/share/locale/eo/LC_MESSAGES/wget.mo
	/usr/share/locale/es/LC_MESSAGES/wget.mo
	/usr/share/locale/et/LC_MESSAGES/wget.mo
	/usr/share/locale/eu/LC_MESSAGES/wget.mo
	/usr/share/locale/fi/LC_MESSAGES/wget.mo
	/usr/share/locale/fr/LC_MESSAGES/wget.mo
	/usr/share/locale/ga/LC_MESSAGES/wget.mo
	/usr/share/locale/gl/LC_MESSAGES/wget.mo
	/usr/share/locale/he/LC_MESSAGES/wget.mo
	/usr/share/locale/hr/LC_MESSAGES/wget.mo
	/usr/share/locale/hu/LC_MESSAGES/wget.mo
	/usr/share/locale/id/LC_MESSAGES/wget.mo
	/usr/share/locale/it/LC_MESSAGES/wget.mo
	/usr/share/locale/ja/LC_MESSAGES/wget.mo
	/usr/share/locale/lt/LC_MESSAGES/wget.mo
	/usr/share/locale/nb/LC_MESSAGES/wget.mo
	/usr/share/locale/nl/LC_MESSAGES/wget.mo
	/usr/share/locale/pl/LC_MESSAGES/wget.mo
	/usr/share/locale/pt/LC_MESSAGES/wget.mo
	/usr/share/locale/pt_BR/LC_MESSAGES/wget.mo
	/usr/share/locale/ro/LC_MESSAGES/wget.mo
	/usr/share/locale/ru/LC_MESSAGES/wget.mo
	/usr/share/locale/sk/LC_MESSAGES/wget.mo
	/usr/share/locale/sl/LC_MESSAGES/wget.mo
	/usr/share/locale/sr/LC_MESSAGES/wget.mo
	/usr/share/locale/sv/LC_MESSAGES/wget.mo
	/usr/share/locale/tr/LC_MESSAGES/wget.mo
	/usr/share/locale/uk/LC_MESSAGES/wget.mo
	/usr/share/locale/vi/LC_MESSAGES/wget.mo
	/usr/share/locale/zh_CN/LC_MESSAGES/wget.mo
	/usr/share/locale/zh_TW/LC_MESSAGES/wget.mo
	/usr/share/man/man1/wget.1.gz

rpm -qf 路徑 #查詢路徑是由哪一個包安裝的ci

[root@localhost Packages]# rpm -qf /usr/bin/vi
	vim-minimal-7.4.160-1.el7.x86_64

[root@localhost Packages]# which ls
	alias ls='ls --color=auto'
		/usr/bin/ls
[root@localhost Packages]# rpm -qf `which ls | tail -1 | cut -f 2`
	coreutils-8.22-11.el7.x86_64
相關文章
相關標籤/搜索