Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The use of rpm and yum commands in Linux system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "the use of rpm and yum commands in the Linux system". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Rpm

Rpm is a very powerful software package management system, which makes it easy to install, upgrade and delete software packages under Linux, and has the functions of querying and verifying software packages. You can gain more flexibility by using the command line than graphical tools. The following examples use example-1.2.3-1.i386.rpm to represent the name of the object software package

Parameters and options

I. installation options

Command format:

Rpm-I (or-- install) options file1.rpm... FileN.rpm

Parameters:

File1.rpm... The file name of the RPM package that fileN.rpm will install

Detailed options:

-h (or-- hash) output hash token (``#'') during installation

-- test only tests the installation, not the actual installation.

-- percent outputs the progress of installation as a percentage.

-- excludedocs does not install documentation files in the package

-- includedocs installation documentation

-- replacepkgs forces reinstallation of already installed packages

-- replacefiles replaces files belonging to other software packages

Force ignores conflicts between software packages and files

-- noscripts does not run pre-installation and post-installation scripts

-- prefix installs the package to the path specified by

-- ignorearch does not verify the structure of the package

-- ignoreos does not check the operating system on which the package is running

-- nodeps does not check dependency relationships

-- ftpproxy is used as a FTP proxy

-- ftpport specifies that the port number of FTP is

General option

-v display additional information

-vv displays debugging information

-- root asks RPM to use the specified path as the "root directory", so that the pre-installation program and post-installation

The installer will be installed in this directory.

-- rcfile sets rpmrc file to

-- dbpath sets the path where the RPM data inventory is located

II. Delete option

Command format:

Rpm-e (or-- erase) options pkg1... PkgN

Parameters.

Pkg1... PkgN: the package to be deleted

Detailed option

-- test only performs deleted tests

-- noscripts does not run pre-installation and post-installation scripts

-- nodeps does not check for dependencies

General option

-vv displays debugging information

-- root asks RPM to use the specified path as the "root directory", so that the pre-installation program and post-installation

All programs will be installed in this directory.

-- rcfile sets rpmrc file to

-- dbpath sets the path where the RPM data inventory is located

III. Upgrade options

Command format

Rpm-U (or-- upgrade) options file1.rpm... FileN.rpm

Parameters.

File1.rpm... Name of the fileN.rpm software package

Detailed option

-h (or-- hash) output hash token (``#'') during installation

-- oldpackage allows "upgrade" to an older version

-- test only tests for upgrades

-- excludedocs does not install documentation files in the package

-- includedocs installation documentation

-- replacepkgs forces reinstallation of already installed packages

-- replacefiles replaces files belonging to other software packages

Force ignores conflicts between software packages and files

-- percent outputs the progress of installation as a percentage.

-- noscripts does not run pre-installation and post-installation scripts

-- prefix installs the package to the path specified by

-- ignorearch does not verify the structure of the package

-- ignoreos does not check the operating system on which the package is running

-- nodeps does not check dependency relationships

-- ftpproxy is used as a FTP proxy

-- ftpport specifies that the port number of FTP is

General option

-v display additional information

-vv displays debugging information

-- root asks RPM to take the specified path as the "root directory", so that both the pre-installer and the post-installer will be installed in this directory

-- rcfile sets rpmrc file to

-- dbpath sets the path where the RPM data inventory is located

IV. Inquiry

Command format:

Rpm-Q (or-- query) options

Parameters:

Pkg1... PkgN: query installed software packages

Detailed option

-p (or ``-'') query the files of the software package

-f query which software package it belongs to

-a query for all installed software packages

-- whatprovides query functional software packages

-g query the software packages belonging to the group

-- whatrequires queries all software packages that require functionality

Information option

Displays the full identity of the software package

-I display the summary information of the software package

-l displays a list of files in the package

-c display a list of profiles

-d displays a list of document files

-s displays a list of files in the package and displays the status of each file

-- scripts displays installation, uninstall and verification scripts

-- queryformat (or-- qf) displays query information in a user-specified manner

-- dump displays all verified information for each file

-- provides displays the functions provided by the software package

-- requires (or-R) displays the functions required by the software package

General option

-v display additional information

-vv displays debugging information

-- root asks RPM to take the specified path as the "root directory", so that both the pre-installer and the post-installer will be installed in this directory

-- rcfile sets rpmrc file to

-- dbpath sets the path where the RPM data inventory is located

5. Verify the installed software packages

Command format:

Rpm-V (or-- verify, or-y) options

Parameters.

Pkg1... The name of the package to be verified by pkgN

Package option

-p Verify against package file

-f check the software package to which it belongs

-a Verify verifies all software packages

-g verify all software packages belonging to the group

Detailed option

-- noscripts does not run verification scripts

-- nodeps does not verify dependencies

-- nofiles does not verify file attributes

General option

-v display additional information

-vv displays debugging information

-- root asks RPM to take the specified path as the "root directory", so that both the pre-installer and the post-installer will be installed in this directory

-- rcfile sets rpmrc file to

-- dbpath sets the path where the RPM data inventory is located

Verify the files in the software package

Syntax:

Rpm-K (or-- checksig) options file1.rpm... FileN.rpm

Parameters:

File1.rpm... File name of the fileN.rpm package

Checksig-- detail options

-- nopgp does not verify GPG signature

General option

-v display additional information

-vv displays debugging information

-- rcfile sets rpmrc file to

7. Other RPM options

-- rebuilddb rebuilds RPM database

-- initdb creates a new RPM database

-- quiet reduces output as much as possible

-- help displays help files

-- version displays the current version of RPM

8. Examples

The code is as follows:

[root@localhost ~] # rpm-ivh ipchains-1.3.6-1.i386.rpm # install package and show detailed progress

[root@localhost] # rpm-I ftp://ftp.xxx.xxx # online installation

[root@localhost ~] # rpm-Va # check all rpm packages and find missing files

[root@localhost ~] # rpm-qf / usr/bin/who # find out which rpm package a file belongs to

[root@localhost ~] # rpm-qpi mon-0.37j-1.i386.rpm # list the description of a rpm package

[root@localhost ~] # rpm-qpl mon-0.37j-1.i386.rpm # lists the file information of a rpm package

[root@localhost ~] # rpm-Uvh ipchains-1.3.6-1.i386.rpm # upgrade package

[root@localhost ~] # rpm-Q httpd # View the installation package of httpd

[root@localhost ~] # rpm-e httpd # remove installation package

[root@localhost ~] # rpm-qi httpd # get information about httpd installation package

Name: httpd Relocations: (not relocatable)

Version: 2.2.3 Vendor: CentOS

Release: 45.el5.centos.1 Build Date: Wednesday, May 4, 2011, 18:54:56

Install Date: Wednesday, June 29, 2011 08:05:34 Build Host: builder10.centos.org

Group: System Environment/Daemons Source RPM: httpd-2.2.3-45.el5.centos.1.src.rpm

Size: 3281960 License: Apache Software License

Signature: DSA/SHA1, Wednesday, May 04, 2011, 20:31:28, Key ID a8a447dce8562897

URL: http://httpd.apache.org/

Summary: Apache HTTP server

Description:

The Apache HTTP Server is a powerful, efficient, and extensible

Web server.

The code is as follows:

[root@localhost ~] # rpm-ql httpd # list what files are in httpd

[root@localhost ~] # rpm-qa # lists all installed packages

Yum

Yum command: used to add / remove / update RPM packages, automatically resolve package dependencies and system updates and upgrades

Parameters.

-e silent execution

-t ignore errors

-R [minutes] set waiting time

-y Auto answer yes

-- skip-broken ignores dependency issues

-- nogpgcheck ignores GPG authentication

Check-update checks for updatable packages

Clearn clears all

Clean packages clears temporary package files (files under / var/cache/yum)

Clearn headers clears the rpm header file

Clean oldheaders clears old rpm header files

Deplist lists package dependencies

List installable and updatable RPM package

List installed installed packages

Packages with list extras installed and not in the repository

Info installable and updatable RPM package information

Information about info installed installed packages (the-qa parameter is similar)

Install [RPM package] installation package

Localinstall installs the local RPM package

Update [RPM package] update package

Upgrade upgrade system

Search [keywords] search package

Provides [keyword] search for specific package file names

Reinstall [RPM package] reinstall package

Repolist displays the configuration of the repository

Resolvedep specifies dependencies

Remove [RPM package] uninstall package

Example:

1, install

The code is as follows:

[root@localhost ~] # yum install php53 # install php5.3

[root@localhost ~] # yum groupinstall "MySQL Server" # install mysql database group

2, update and upgrade

The code is as follows:

[root@localhost ~] # yum update # Update all

[root@localhost ~] # yum update php53 # Update php

[root@localhost ~] # yum check-update # check for updatable programs

[root@localhost ~] # yum upgrade php53 # upgrade php53

[root@localhost ~] # yum groupupdate "MySQL Server" # upgrade mysql service group

3, find and display

The code is as follows:

[root@localhost ~] # yum info php53 # View the installation information of php53

[root@localhost ~] # yum list # lists all installable packages

[root@localhost ~] # yum list php53 # lists all php53 packages

[root@localhost ~] # yum groupinfo "MySQL Server" # View the installation package of the mysql service group

[root@localhost ~] # yum deplist php53 # View php53 dependencies

4, delete

The code is as follows:

[root@localhost ~] # yum remove php53 # Delete php53

[root@localhost ~] # yum groupremove "MySQL Server" # Delete mysql service group

5, clear the cache

The code is as follows:

[root@localhost ~] # yum clean packages # clear the software packages in the cache directory

[root@localhost ~] # yum clean headers # clear the headers in the cache directory

[root@localhost ~] # yum clean oldheaders # clear the old headers in the cache directory

[root@localhost ~] # yum clean, yum clean all # clears all

This is the end of the introduction to "the use of rpm and yum commands in the Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report