The use of initial-rpm for Linux package management

Source: Internet
Author: User
Tags gpg

On Linux systems, generally, there are three categories for package managers:

debian:dpt,dpkg; (Package suffix. deb)

rhel:rpm (Package suffix. rpm)

suse:rpm (Package suffix. rpm)

So, how does the package manager understand it?

Package Manager: The compiled application of the constituent files packaged into one or several package files, making it easier to implement the package installation, uninstallation, upgrade, query, check and other management operations.

For the CentOS series, the path to the RPM database is:/var/lib/rpm

RPM Package Naming format:

  

Name-version-release.arch.rpm//name: Software name//version: Software version//release: Publisher version//arch: System architecture

such as: heartbeat-2.1.4-12.el6.x86_64.rpm

Next, we'll cover the use of RPM commands in detail:

RPM [OPTIONS] [Package_file]

The main options are:

-I,--Install: Installation

-E,--Erase: Uninstalling

-U,--Upgrade: Upgrade

-Q,--Query: Querying

-V,--Verify: Checksum

--BULIDDB,--initdb: Database Maintenance

-V: Displays installation details

-VV: Show more detailed information

① Installation Related:

RPM [OPTIONS] [install-options] [Package_file]

Among them, [Install-options] (Installation options) are:

-H: Displays the installation progress bar (50 #);

--test: Test installation;

--nodeps: Ignore package dependencies (not recommended);

--replacepkgs: Reinstall;

--nosignature: Do not check package signature information;

--nodigest: Do not check package integrity information;

② Upgrade Related:

RPM [OPTIONS] [upgrade-options] [Package_file]

RPM [OPTIONS] [freshen-options] [Package_file]

Among the common options are:

-U: Upgrade and install;

-F: Upgrade only;

--oldpackage: Downgrade

--force: Forced upgrade

③ Uninstall Related:

RPM [OPTIONS] [erase-options] [Package_file]

Among the common options are:

--allmatches: Uninstalls all versions of packages that match the specified name;
--nodeps: Ignoring dependencies
--test: Test Uninstall

④ Query Related:

RPM [OPTIONS] [select-options] [query-options]

Among them: [Select-options] are:

Pakage_name: Queries whether the specified software is already installed (this is PackageName, not packagefile)

-A,--All: query all installed packages;

-F File: The query specifies which package installation is generated by the specified file, for example:

[Email protected] ~]# rpm-q-f/etc/passwdsetup-2.8.14-20.el6_4.1.noarch

-P,--Package Package_file: For performing query operations on packages that are not installed

--whatprovides capbility: The query specifies the capabilities that are provided by which package, such as:

[Email protected] ~]# rpm-q--whatprovides zshzsh-4.3.11-4.el6.centos.2.x86_64

--whatrequires capbility: The query specifies the ability to be relied upon by which package, such as:

[Email protected] ~]# Rpm-q--whatrequires bashinitscripts-9.03. --1. El6.centos.x86_64dracut-004-409. El6.noarchrsyslog-5.8.Ten-Ten. El6_6.x86_64cronie-1.4.4- the. el6_7.1. X86_64autofs-5.0.5-122. el6.x86_64lvm2-2.02.143-7. el6.x86_64

[Query-options] has:

--changelog: Query rpm package of changelog;

-L,--List: All file lists generated by the program installation, such as:

[[Email protected] ~]# rpm-ql python/usr/bin/pydoc/usr/bin/python/usr/bin/python2 /usr/bin/python2. 6/usr/share/doc/python-2.6. 6/usr/share/doc/python-2.6. 6/LICENSE/usr/share/doc/python-2.6. 6/README/usr/share/man/man1/python. 1. gz

-I,--info: Information about the package "version number, size, owning package group, etc."

-C,--configfiles: Queries the configuration file provided by the specified package, such as:

[Email protected] ~]# RPM-QC zsh/etc/skel/. ZSHRC/etc/zlogin/etc/zlogout/etc/ zprofile/etc/zshenv

-D,--docfiles: Queries the documentation provided by the specified package, such as:

[Email protected] ~]# RPM-qd python/usr/share/doc/python-2.6. 6/LICENSE/usr/share/doc/python-2.6. 6/README/usr/share/man/man1/python. 1. gz

--provides: Lists all the features provided by the specified package, such as:

[Email protected] ~]# Rpm-q--provides pythondistutils python (ABI)=2.6python-abi =2.6python-ctypes =1.0.1python-hashlib =20081120python-sqlite =2.3.2python-uuid =1.31python-x86_64 =2.6.6- -. El6python2=2.6.6python=2.6.6- -. El6python (x86- -) =2.6.6- -. el6

-R,--requires: queries the dependencies of the specified package, such as:

[Email protected] ~]# RPM-QR python/usr/bin/python2.6libc.so.6() (64bit) libc.so.6(glibc_2.2.5) (64bit) libdl.so.2() (64bit) libm.so.6() (64bit) libpthread.so.0() (64bit) libpython2.6. So.1.0() (64bit) libutil.so.1() (64bit) Python-libs (x86- -) =2.6.6- -. El6rpmlib (compressedfilenames)<=3.0.4-1rpmlib (filedigests)<=4.6.0-1rpmlib (partialhardlinksets)<=4.0.4-1rpmlib (Payloadfileshaveprefix)<=4.0-1rpmlib (versioneddependencies)<=3.0.3-1rtld (Gnu_hash) rpmlib (PAYLOADISXZ)<=5.2-1

--scripts: View the script fragment that comes with the package;

④ Checksum Correlation

RPM [OPTIONS] [select-options] [verify-options]

Similar to the above, do not repeat here.

⑤ Database Related

RPM {--INITDB|--REBUILDDB}

which

--INITDB: Initializes the database, currently no database can be initialized to create a new one, and sometimes does not perform any operations;
--REBUILDDB: Rebuilt, rebuilt by reading all installed packages on the current system;

The verification of RPM packages is related to:

The first thing to get and import the package author's key:

For CentOS distributions:
RPM--import/etc/pki/rpm-gpg/******

For example:

[Email protected] ~]#ls-l/etc/pki/rpm-gpg/Total Dosage --rw-r--r--.1Root root1706May + Geneva: -rpm-gpg-key-centos-6-rw-r--r--.1Root root1730May + Geneva: -rpm-gpg-key-centos-debug-6-rw-r--r--.1Root root1730May + Geneva: -rpm-gpg-key-centos-security-6-rw-r--r--.1Root root1734May + Geneva: -rpm-gpg-key-centos-testing-6

Manual verification:

Rpm-k Package_file

For example:

[Email protected] ~]# rpm-k zsh-4.3. One-4. El6.centos. 2 . x86_64.rpm zsh-4.3. One-4. El6.centos. 2. X86_64.rpm:rsa SHA1 (MD5) PGP MD5 OK

The use of initial-rpm for Linux package management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.