Package management 3-----Basic knowledge rpm yum

RPM package management

每个RPM包都分为两部分
1文件列表    file list 
2元数据meta  data:文件大小  属性,描述信息,依赖性,等

Check the package with or without script
rpm -qp --scripts Package name

If the package is already in the system, it
will be in the database (public): /var/lib/rpm There is information about this package
such as package name and version
dependency
function Explain
the file paths and verification code information generated after the package is installed.

For example, most of the content is binary
Package management 3-----Basic knowledge rpm yum
Package management 3-----Basic knowledge rpm yum
DB, indicating that the database
used in the database file centos7 is mariadb. The
mariadb database website
mariadb.org
3. There is also the source of the third-party installation package
EPEL Source
4. Also make your own installation package for
rpmbuild

Use the rpm command to manage packages on Centos systems:
install, uninstall, upgrade, query, verify, database maintenance. The

installation
rpm itself is an external command with
Package management 3-----Basic knowledge rpm yum
many options
. rpm{-i|--indtall} [install-options]PACKAGE_FILE
-i , -- Root and installation-related options after install, such as
-v:verbose specific display process
-vv:
-h: #Display package management execution progress
Interactive installation: rpm -ivh PACKAGE_FILE...
silent installation, if installed in a script Without vh,
centos6 Package management 3-----Basic knowledge rpm yum
centos7 Package management 3-----Basic knowledge rpm yum
can also follow a lot of options
[install-options]
--test: test the installation, but do not actually execute the installation, that is, dry run mode
--nodeps: ignore dependencies
--replacepkgs | replacefiles
--nosignature: do not check Source legitimacy
--nodigest: do not check package integrity
--noscripts: do not execute package scripts
%pre: pre-install scripts; --nopre
%post: post-install scripts; --nopost
%preun: pre-uninstall scripts; -- nopreun
%postun: post-uninstall script; --nopostun
Uninstall rpm -e vsftpd -e followed by the package name directly. The
Package management 3-----Basic knowledge rpm yum
test installation is to pretend to press once and
ignore the dependency installation.
Package management 3-----Basic knowledge rpm yum
Ignore the dependency installation or it still cannot be used.
If the package is already installed, but part of the file is damaged, it needs to be installed forcefully. , because the normal installation will prompt that it has been installed --replacepkgs
[root@liang Packages 11:01:54]# rpm -ql tree We can use -ql to view the tree file which is composed of several programs. The file list of the tree file
Package management 3-----Basic knowledge rpm yum
When installing two version of the file, but when the content of the two versions of the file is the same, we will use --replacefiles
to check the validity of the package when installing the package. This file
Package management 3-----Basic knowledge rpm yum
is called the public key in the CD-ROM. The following figure is the file The content
Package management 3-----Basic knowledge rpm yum
of the public key file is imported. If it is a legal file when installing the package, it will not prompt to upgrade the
Package management 3-----Basic knowledge rpm yum
rpm package . rpm{-U|--upgrade}[install-options]PACKGE_FILE... rpm{-F| --freshen}[install-options]PACKGE_FILE... upgrade: An older version of the package is installed. Then "upgrade" the package if the older version does not exist. then "install" freshen: old version package is installed, then "upgrade" If no old version package exists, "do not perform upgrade operation" rpm -Uvh PACKAGE_FILE... rpm -Fvh PACKAGE_FIEL... -- oldpackage: downgrade










--force :强制安装

不建议升级内核,采用安装的方式,系统默认可以有多个内核版本包,其他软件包不行
rpm -ql 软件包名 -ql可以查软件包的列表
Package management 3-----Basic knowledge rpm yum
安装新文件不会覆盖老版本配置文件,但是能覆盖二进制文件,升级时候,新版本提供的同一个配置文件并不会直接覆盖老版本的配置文件,而是把新版本的文件重命名(FILENAME.rpmnew)后缀保留
包的查询
rpm {-q|--query}[select-options][query-options]
[select-options]
-a:所有包
-f:查看指定的文件由哪个程序包安装生成
-p rpmfile:针对尚未安装的程序包文件做查询操作
--whatprovids CAPABILITY:查询指定的CAPABILITY由哪个包所提供 --whatrequires CAPABILITY:查询指定的CAPABILITY被哪个包所依赖
rpm2cpio包文件|cpio -itv 预览包内文件
rpm2cpio包文件|cpio -id “*conf” 释放包内文件
-q选项后接包名,安装好的包
无论安装不安装都可以用
[root@liang Packages 08:44:49]#rpm -q vsftpd &> /dev/null ||rpm -ivh /misc/cd/Packages/vsftpd-2.2.2-24.el6.x86_64.rpm &> /dev/null
只要把vsftpd换成别的包名就可以了
When we forget the previously installed package name or just remember that we can use the -a option
rpm -qa to list all installed packages, and use grep + shutdown word to find out the desired package rpm
-qa |grep vsftp
-f can see where the package comes from, or you can query the database /var/lib/rpm
with -p followed by the file name
. These are

rpm2cpio followed by the -q option to convert the rpm package into cpio format and then convert the cpio format Expanding with the tv option is equivalent to unpacking the rpm package using the cpio format and displaying it.
Using the tv option is equivalent to previewing.
Package management 3-----Basic knowledge rpm yum
If we delete /usr/bin/tree at this time, we
Package management 3-----Basic knowledge rpm yum
can also use dv to unpack the cpio format. Unzip it to the current directory by default,
Package management 3-----Basic knowledge rpm yum
and then we will move the unpacked file to the original directory.
Package management 3-----Basic knowledge rpm yum
This is a disguised reply to the tree program.
But , but, but
this reply is wrong. It may be wrong to reply to the past attributes, permissions, ah, It belongs to the group, the owner is wrong,
it may bring potential problems
There are other options for the query of the package
--changelog: query the changelog of the rpm package Change log
-c: the documentation of the query program only looks at the configuration file -qc
-i: information information -qi
-l: View all files generated after the specified package is installed -ql
--scripts: The scripts that come with the package
--provides: List the CAPABILITY capability provided by the specified package
-R: Query the packages that the specified package depends on.
Common combinations
of CAPABILITY -qi PACKAGE, -qf FILE, -qc PACKAGE, -ql PACKAGE, -qd PACKAGE
-qpi PACKAGE_FILE, -qpl PACKAGE_FILE, ....
package uninstall
rpm {-e|--erase}[--allmatches][--nodeps][--noscript][--notriggers][--test]PACKAGE_NAME... --allmatches
all matches
--nodeps ignore dependencies-
-noscript Ignore script execution
--notriggers Ignore triggers
--test Test
PACKAGE_NAME when uninstalling
each file will be installed with the new database /var/lib/rpm
-V: Compare the installed files and the database
rpm -V filename

Package management 3-----Basic knowledge rpm yum
rpm {-V|--verify} [select-options] [verify-options] S file
Size differs
M Mode differs (includes
digest permissions and file type) 5 (formerly MD5 sum) differs
D Device major/minor number mismatch
L readLink(2) path mismatch
U User ownership differs
G Group ownership differs
T mTime differs
P capabilities differ
You can also use -Va to query the metadata changes of all installed packages

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324648552&siteId=291194637