Rpm software management

Source: Internet
Author: User
Tags gpg
RPM package installation, query, uninstall, upgrade, verify database reconstruction, etc. 1. Installation
Rpm-I/path/to/package_file
-H: displays the progress with #; each # indicates 2%;
-V: displays detailed procedures.
-VV: More detailed process
Rpm-IVH/path/to/package_file -- nodeps: Ignore dependency;
-- Replacepkgs: reinstall and replace the original installation;
-- Force: Force installation, which can be reinstalled or downgraded;
 
2. Query
Rpm-Q package_name: queries whether the specified package has been installed.
Rpm-QA: Query all installed packages

Rpm-Qi package_name: queries the description of a specified package;
Rpm-QL package_name: queries the list of files generated after the specified package is installed;
Rpm-QC paceage_neme: queries the configuration file installed in the specified package;
Rpm-Qd package_name: query the Help file for installing the specified package;

Rpm-Q -- scripts package_name: query scripts contained in a specified package
 
Rpm-qf/path/to/somefile: queries the RPM package generated by the specified file;
 
If an RPM package has not been installed, We need to query its instructions and files generated after installation;
Rpm-QPI/path/to/package_file
Rpm-qpl

3. Upgrade
Rpm-uvh/path/to/new_package_file: if the old version is installed, upgrade it; otherwise, install it;
Rpm-fvl/path/to/new_package_file: if the old version is installed, upgrade the file. Otherwise, exit;
-- Oldpackage: downgrade
 
4. Uninstall
Rpm-e package_name
-- Nodeps
 
5. Verification
Rpm-V package_name
 
6. Rebuilding the database
Rpm
-- Rebuilddb: the database will be rebuilt;
-- Initdb: Initialize the database. If no database is created, it is not required;


7. Check the source validity and software package integrity;
Encryption type:
Symmetric: the same key is used for encryption and decryption.
Public Key: a pair of Children's key, public key, and private key. The public key is hidden in the private key and can be extracted and made public;

Unidirectional:

-IVH: the installation progress is displayed. -- install -- verbose -- hash
-Uvh: Upgrade the software package -- update;
-Qpl: lists the file information in the RPM package [query package list].
-QPI: lists the RPM package description [query package install package (s)];
-QF: Find the RPM package of the specified file [query file];
-Va: Check all RPM software packages and find the missing file [view lost].
-E: delete a package

 

Rpm-Q Samba // query whether the program is installed

Rpm-IVH/Media/CDROM/RedHat/RPMS/samba-3.0.10-1.4E.i386.rpm // install by path and display progress
Rpm-IVH -- relocate/=/opt/Gaim gaim-1.3.0-1.fc4.i386.rpm // specify the installation directory

Rpm-IVH -- Test gaim-1.3.0-1.fc4.i386.rpm // used to check dependencies; not a real installation;
Rpm-uvh -- oldpackage gaim-1.3.0-1.fc4.i386.rpm // New Version downgrade to old version

Rpm-Qa | grep httpd # [search for whether the specified RPM package is installed] -- all search * httpd *
Rpm-QL httpd # [search for RPM packages] -- list all File Installation Directories

Rpm-QPI Linux-1.4-6.i368.rpm # [view RPM package] -- Query -- package -- install package information
Rpm-qpf Linux-1.4-6.i368.rpm # [view RPM package] -- File
Rpm-QPR file. RPM # [View package] dependency
Rpm2cpio file. RPM | cpio-Div # [Extract files]

Rpm-IVH file. RPM # [install a new RPM] -- install -- verbose -- hash
Rpm-IVH

Rpm-uvh file. RPM # [upgrade an RPM] -- upgrade
Rpm-e file. RPM # [delete an RPM package] -- Erase

Common parameters:

Install/upgrade/Erase options:

-I, -- install package (s)
-V, -- verbose provide more detailed output
-H, -- hash print hash marks as package install( good with-V)
-E, -- Erase erase (uninstall) package
-U, -- upgrade = <packagefile> + upgrade package (s)
-- Replacepkge forcibly installs the software package no matter whether the software package is installed or not.
-- Test installation test, not actually installed
-- Nodeps forcibly installs software packages regardless of their Dependencies
-- Force ignores conflicts between software packages and files

Query options (with-Q or -- Query ):
-A, -- all query/verify all packages
-P, -- package query/verify a package file
-L, -- list files in package
-D, -- docfiles list all documentation files
-F, -- file query/verify package (s) Owning File

At present, apt and Yum are very mature. We recommend that you use apt or yum when installing the software. If you install the software package provided by the system disk, you can use system-config-packages or RedHat-config-packages;


1. Usage of RPM package management;

1. You can install, delete, upgrade, and manage software. Of course, you can also install and upgrade software online;
2. You can use RPM to check which files are included in the software package and which software package the file belongs;
3. check whether or not the software package in the query system is installed and its version;
4. As a developer, You can package your program as an RPM package for release;
5. Import, verify, and release of the software package signature GPG and MD5
6. Check the dependency to see if any software package has disrupted the system due to incompatibility;


2. RPM usage permission;

Only root permissions can be used to install, delete, and update RPM software. Any user can perform operations on the query function. If a common user has the permission to install directories, the RPM software can also be installed;


Iii. Simple RPM usage;

In addition to the Software Package Manager, we can also use RPM commands to install software packages. Can all software packages be installed using RPM commands? No, the file ends with a. RPM suffix. Sometimes we find file. rpm on some websites and install it with RPM;

1) initialize the RPM database;

Run the RPM command to check whether an RPM package is installed. The RPM database is also used. Therefore, we often use the following two commands to initialize the RPM database;

[[Email protected] beinan] # rpm -- initdb
[[Email protected] beinan] # rpm -- rebuilddb Note: This takes a long time;

Note: These two parameters are extremely useful. Sometimes the RPM system has a problem and cannot be installed or queried. Most of them have a problem here;

2) query functions of RPM software package management:

Command Format

rpm {-q|--query} [select-options] [query-options]

The query function of RPM is extremely powerful and one of the most important functions. For more details, refer to # Man rpm.

1. query the software installed in the system;

1) query the installed software;

 

Syntax: rpm-Q software name

Example:

 

[[email protected] beinan]# rpm -q gaim
gaim-1.3.0-1.fc4

-Q is -- Query, which means "Q" in Chinese. This command indicates whether GAIM is installed in the system. If GAIM is installed, information is output. If GAIM is not installed, will output the information that Gaim has not been installed;

To view all installed packages in the system, add the-a parameter;

[[email protected] RPMS]# rpm -qa
If you view it by PAGE, add another pipeline | and more commands;
[[email protected] RPMS]# rpm -qa |more

Find a software in all installed software packages, such as Gaim. You can use grep to extract the software;

 

[[email protected] RPMS]# rpm -qa |grep gaim

The above function is the same as that output by rpm-Q Gaim;

2) query the software package of an installed file;

 

Syntax rpm-QF file name
Note: the absolute path of the file name must be specified.

 

Example:

[[email protected] RPMS]# rpm -qf /usr/lib/libacl.la
libacl-devel-2.2.23-8

3) query where all installed software packages are installed;

 

Syntax: rpm-QL software name or RPM rpmquery-QL software name

Example:

 

[[email protected] RPMS]# rpm -ql lynx
[[email protected] RPMS]# rpmquery -ql lynx

4) query the information of an installed software package

 

Syntax format: rpm-Qi software name

Example:

[[email protected] RPMS]# rpm -qi lynx

5) Check the configuration file of the installed software;

 

Syntax format: rpm-QC software name

Example:

[[email protected] RPMS]# rpm -qc lynx

6) view the installation location of a software installation document:

 

Syntax format: rpm-Qd software name

Example:

 

[[email protected] RPMS]# rpm -qd lynx

7) Check the software packages and files on which the software is installed;

 

Syntax: rpm-QR software name

Example:

[[email protected] beinan]# rpm -qR rpm-python

Query the summary of installed software: for a software package that has been installed, we can combine a series of parameters, such as rpm-qil. For example:

[[email protected] RPMS]# rpm -qil lynx


2. View uninstalled software packages:

The premise is that you have a. RPM file, that is, you can view the file. RPM of the existing software;

1) view the purpose and version of a software package;

 

Syntax: rpm-QPI file. rpm

Example:

 

[[email protected] RPMS]# rpm -qpi lynx-2.8.5-23.i386.rpm

2) view the files contained in a software package;

 

Syntax: rpm-qpl file. rpm

Example:

[[email protected] RPMS]# rpm -qpl lynx-2.8.5-23.i386.rpm

3) view the document location of the software package;

 

Syntax: rpm-qpd file. rpm

Example:

[[email protected] RPMS]# rpm -qpd lynx-2.8.5-23.i386.rpm

5) view the configuration file of a software package;

 

Syntax: rpm-qpc file. rpm

Example:

[[email protected] RPMS]# rpm -qpc lynx-2.8.5-23.i386.rpm

4) view the dependency of a software package

 

Syntax: rpm-QPR file. rpm

Example:

[[email protected] archives]# rpm -qpR yumex_0.42-3.0.fc4_noarch.rpm
/bin/bash
/usr/bin/python
config(yumex) = 0.42-3.0.fc4
pygtk2
pygtk2-libglade
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
usermode
yum >= 2.3.2


3) installation, upgrade, and deletion of software packages;


1. Install and upgrade an RPM package;

 

[[Email protected] beinan] # rpm-VIH file. RPM note: this is used to install a new RPM package;
[[Email protected] beinan] # rpm-uvh file. RPM note: this is used to upgrade an RPM package;

If dependency exists, resolve the dependency. In fact, the software package manager can solve the dependency well. See the previous introduction of the Software Package Manager; if you cannot find the dependency package in the package manager, you can only compile the dependent package to solve the dependency or force the installation;

Syntax structure:

 

[[email protected] beinan]# rpm -ivh file.rpm --nodeps --force
[[email protected] beinan]# rpm -Uvh file.rpm --nodeps --force

For more parameters, see man rpm

Example application:

[[email protected] RPMS]# rpm -ivh lynx-2.8.5-23.i386.rpm
Preparing... ########################################### [100%]
      1:lynx ########################################### [100%]
[[email protected] RPMS]# rpm -ivh --replacepkgs lynx-2.8.5-23.i386.rpm
Preparing... ########################################### [100%]
      1:lynx ########################################### [100%]

Note: The -- replacepkgs parameter is installed again with the installed software. Sometimes it is not necessary too much;

Test the installation parameter -- test, which is used to check the dependency. It is not a real installation;

 

[[email protected] RPMS]# rpm -ivh --test gaim-1.3.0-1.fc4.i386.rpm
Preparing... ########################################### [100%]

Downgrade from the new version to the old version, and add the -- oldpackage parameter;

 

[[email protected] RPMS]# rpm -qa gaim
gaim-1.5.0-1.fc4
[[email protected] RPMS]# rpm -Uvh --oldpackage gaim-1.3.0-1.fc4.i386.rpm
Preparing... ########################################### [100%]
      1:gaim ########################################### [100%]
[[email protected] RPMS]# rpm -qa gaim
gaim-1.3.0-1.fc4

Specify the installation directory for the package: add the-Relocate parameter; the example below is to specify the gaim-1.3.0-1.fc4.i386.rpm to install in the/opt/Gaim directory;

 

[[email protected] RPMS]# rpm -ivh --relocate /=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm
Preparing... ########################################### [100%]
      1:gaim ########################################### [100%]
[[email protected] RPMS]# ls /opt/
gaim

Specify the installation directory for the package: add the-Relocate parameter; the example below is to specify the installation of the lynx-2.8.5-23.i386.rpm in the/opt/Lynx directory;


[[Email protected] RPMs] # rpm-IVH -- relocate/=/opt/Lynx -- badreloc lynx-2.8.5-23.i386.rpm
Preparing... ######################################## ### [100%]
1: lynx ####################################### #### [100%]

How can we call a program installed in a specified directory? Generally, the execution programs are stored in the bin or sbin directory of the installation directory. Take a look at the example below. If there is an error output, make the corresponding link and use ln-S;

 

[[email protected] RPMS]# /opt/lynx/usr/bin/lynx
Configuration file /etc/lynx.cfg is not available.
[[email protected] RPMS]# ln -s /opt/lynx/etc/lynx.cfg /etc/lynx.cfg
[[email protected] RPMS]# /opt/lynx/usr/bin/lynx www.linuxsir.org


2. delete an RPM package;

First, you must learn to query the RPM package. Please refer to the previous instructions;

[[Email protected] beinan] # rpm-e package name

For example, if I want to remove the lynx package, the complete operation should be:

[[email protected] RPMS]# rpm -e lynx

If there is a dependency, you can also use -- nodeps to ignore the dependency check to delete it. But do not do this as much as possible. It is best to use the software package manager systerm-config-packages to delete or add software;

 

[[email protected] beinan]# rpm -e lynx --nodeps


Iv. Import signature:

[[Email protected] RPMs] # rpm -- import signature file

Example:

 

[[email protected] fc40]# rpm --import RPM-GPG-KEY
[[email protected] fc40]# rpm --import RPM-GPG-KEY-fedora

For more information about the RPM signature function, see man rpm


6. supplement the query of installed software packages;

[[Email protected] RPMs] # updatedb
[[Email protected] RPMs] # locate software name or file name

Through updatedb, we can use locate to query where some software has been installed. When the system is first installed, it needs to execute updatedb and run it every other time to keep the installed software library up-to-date; updatedb is owned by the slocate software package. If you do not have this command, you must install slocate;

Example:

 

[[email protected] RPMS]# locate gaim

VII. Extraction of files from the RPM software package;

Command Format: rpm2cpio file. RPM | cpio-Div
Example:
[[email protected] RPMS]# rpm2cpio gaim-1.3.0-1.fc4.i386.rpm |cpio -div

The extracted files are stored in USR and etc;

In fact, it is better to specify the installation directory to install software. You can also Extract files;

Specify the installation directory for the package: add the-Relocate parameter; the example below is to specify the gaim-1.3.0-1.fc4.i386.rpm to install in the/opt/Gaim directory;

 

[[email protected] RPMS]# rpm -ivh --relocate /=/opt/gaim gaim-1.3.0-1.fc4.i386.rpm
Preparing... ########################################### [100%]
      1:gaim ########################################### [100%]
[[email protected] RPMS]# ls /opt/
gaim

In this way, all the Gaim files are installed in/opt/Gaim. We just back up the Gaim directory and then unload the Gaim. This is actually a usage of extracting files;


8. RPM configuration file;

For RPM package management, the configuration file is rpmrc, which can be found in our system. For example, the rpmrc file in Fedora Core 4.0 is located;

[[email protected] RPMS]# locate rpmrc
/usr/lib/rpm/rpmrc
/usr/lib/rpm/redhat/rpmrc

We can view it through rpm -- showrc;

 

 

Related Article

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.