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

What is the use of rpm in Linux operating system

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail about the use of rpm in the Linux operating system. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

First, install the RPM package

Rpm packages usually have filenames similar to foo-1.0-1.i386.rpm. These include the name of the package (foo), version number (1. 0), release number (1), and hardware platform (i386). To install a package, simply type the following command:

The code is as follows:

$rpm-ivh foo-1.0-1.i386.rpm

Foo # #

After rpm is installed, the name of the package is printed (not necessarily the same as the file name), and then a series of # numbers are printed to indicate the progress of the installation. Although the installation of the package is designed to be as simple as possible, the following errors may occur:

1. The package has been installed. If your package has been installed, the following message will appear:

The code is as follows:

$rpm-ivh foo-1.0-1.i386.rpm

Foo package foo-1.0-1 is already installed

Error: foo-1.0-1.i386.rpm cannot be installed

If you still want to install the package, you can use the-- replacepkgs option on the command line, and rpm will ignore the error message and force the installation.

2. File conflicts if one of the packages you are installing has already been installed when other packages are installed, the following error message appears:

The code is as follows:

Rpm-ivh foo-1.0-1.i386.rpm

Foo / usr/bin/foo conflicts with file from bar-1.0-1

Error: foo-1.0-1.i386.rpm cannot be installed

To get rpm to ignore the error message, use the-- replacefiles command line option.

3. The unresolved dependency rpm package may depend on other packages, that is, it is required to install a specific package only after it has been installed. If you have this unresolved dependency when you install a package. The following message is generated: $rpm-ivh bar-1.0-1.i386.rpm failed dependencies: foo is needed by bar-1.0-1 you must finish installing the dependent package to solve this problem. If you want to force the installation (which is a bad idea because the installed package may not work properly), use the-- nodeps command line option.

Uninstall the rpm package

Uninstalling a package is as simple as installing a package: $rpm-e foo notice that you use the name of the package name ``foo'', instead of the name of the package file file ``package-1.i386.rpmpackages installed. If other packages depend on the package you are uninstalling, an error message will be generated when you uninstall it. For example: $rpm-e foo removing these packages would break dependencies:foo is needed by bar-1.0-1 if you want rpm to ignore this error and continue to uninstall (this is not a good idea, because programs that depend on the package may not run), use the-- nodeps command line option.

Upgrade the rpm package

The upgrade package is very similar to the installation package:

The code is as follows:

$rpm-uvh foo-2.0-1.i386.rpm

Foo # #

Rpm will automatically uninstall the installed boss's foo package, and you will not see the relevant information. In fact, you may always use-u to install the package, because it works even if it has not been installed before. Because rpm performs intelligent package upgrades and automatically processes configuration files, you will see the following message: saving / etc/foo.conf as / etc/foo.conf.rpmsave, which means that your changes to the configuration files are not necessarily upward compatible. Therefore, rpm backs up the old files before installing the new ones. You should resolve the differences between the two profiles as soon as possible so that the system can continue to function properly.

Because the upgrade actually includes the process of uninstalling and installing the package, you may encounter errors caused by these two operations. Another problem you may encounter is that when you use an old version of the software package to upgrade a new version of the software, rpm will generate the following error message

The code is as follows:

$rpm-uvh foo-1.0-1.i386.rpm

Foo package foo-2.0-1 (which is newer) is already installed

Error: foo-1.0-1.i386.rpm cannot be installed

If you really need to downgrade the package, just add the-- oldpackage command option.

4. Query installed software packages

Use the command rpm-Q to query the database of the installed package. Simply use the command rpm-Q foo to print out the package name, version number, and release number of the foo package:

$rpm-Q foo

Foo-2.0-1

In addition to specifying the package name, you can also use the following options to indicate which package information to query. These options are called package specification options. -a query for all installed software packages. -f includes the query with a file. The software package of. The-p query package file named package can also specify the information displayed when querying the package. They are called information selection options. -I displays software package information, such as description, release number, size, construction date, installation date, platform, and other various informations. no, no, no. -l displays a list of files in the package. -s displays the status of all files in the package. -d displays a list of files marked as documents (man manual, info manual, readme's, etc). -c displays a list of files marked as configuration files. These are the files you want to customize after installation (sendmail.cf, passwd, inittab, etc).

For files that want to display a list of files, you can add the-v command line option to get output in the same format as ls-l.

5. Verification software package

Verifying the package is done by comparing the installed files with the original file information in the package. Verification is mainly about comparing file size, MD5 check code, file permissions, type, owner and user group, etc.

The rpm-V command is used to verify a software package. You can use any package selection option to query the package you want to verify. The command rpm-V foo will be used to verify the foo package. Another example is:. Verify the package that contains a specific file: rpm-Vf / bin/vi. Verify all installed packages: rpm-Va. Verify against a RPM package: rpm-Vp foo-1.0-1.i386.rpm if you are worried that your RPM database has been corrupted, you can use this method.

If everything is checked properly, no output will be produced. If there is any inconsistency, it will be shown. The output format is an 8-bit long string, ``cencoded 'refers to the configuration file, followed by the file name.

Each of the 8-bit characters is used to represent the result of the comparison between the file and an attribute in the RPM database. ``.'(dot) indicates that the test passed. The following characters indicate some test failure on the RPM software package: display character error source 5 MD5 check code S file size L symbolic connection T file modification date D device U user G user group M mode e (including permissions and file types)

If there is an error message output, you should carefully consider whether to remove or reinstall to resolve the problem.

6. Teach you a trick

RPM is not only a tool for installing / uninstalling programs, it is also a good tool for system maintenance and diagnosis. After looking at the following examples, you will see how powerful it is. What if you delete some files by mistake, but you are not sure that all of them have been deleted? You can type: rpm-Va rpm shows the deletion of the file on the screen. If you find that some files are missing or corrupted, you can reinstall or uninstall the package before installing it. If you come across a file you don't know, to find out which package it belongs to, you can type the following command rpm-qf / usr/X11R6/bin/xjewel and the output will be: xjewel-1.6-1. If there is a combination of the above two examples, such as a problem with the file / usr/bin/paste. If you want to know which package contains this file, you can simply type: rpm-Vf / usr/bin/paste. If you want to know more about the program you are using, you can type the following command to get the documentation information about the program in the package: rpm-qdf / usr/bin/ispell output is:

The code is as follows:

/ usr/man/man4/ispell.4

/ usr/man/man4/english.4

/ usr/man/man1/unsq.1

/ usr/man/man1/tryaffix.1

/ usr/man/man1/sq.1

/ usr/man/man1/munchlist.1

/ usr/man/man1/ispell.1

/ usr/man/man1/findaffix.1

/ usr/man/man1/buildhash.1

/ usr/info/ispell.info.gz

/ usr/doc/ispell-3.1.18-1/README

You have found a new koules RPM, but you don't know what it does, you can type the following command: rpm-qip koules-1.2-2.i386.rpm. Now that you want to know which files are installed on the system by koules's RPM package, you can type: rpm-qlp koules-1.2-2.i386.rpm output as follows:

The code is as follows:

/ usr/man/man6/koules.6

/ usr/lib/games/kouleslib/start.raw

/ usr/lib/games/kouleslib/end.raw

/ usr/lib/games/kouleslib/destroy2.raw

/ usr/lib/games/kouleslib/destroy1.raw

/ usr/lib/games/kouleslib/creator2.raw

/ usr/lib/games/kouleslib/creator1.raw

/ usr/lib/games/kouleslib/colize.raw

/ usr/lib/games/kouleslib

/ usr/games/koules

This is the end of this article on "what is the use of rpm in the Linux operating system". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.

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