Tips for using RPM software packages in Linux

Source: Internet
Author: User
Tags rpmbuild
The following describes how to use RPM software packages in a Linux operating system-Linux general technology-Linux technology and application. 1. How to install the rpm Software Package

You can use the program rpm to install the rmp package. Run the following command rpm-I package_name.rpm (package_name.rpm is the file name of the rpm package you want to install, which is usually placed in the current directory). The following prompt may appear during installation :... conflict... some files may overwrite existing files in the package to be installed, in this case, you cannot install it correctly. You can use rpm -- force-I to force the installation .... is needed ...... is not installed... you can use rpm -- nodeps-I to ignore the required software. That is to say, rpm-I -- force -- nodeps can ignore all dependencies and file problems, all packages can be installed, but this forced installation package cannot guarantee full functionality.


2. How to install the. src. rpm Software Package

Some software packages end with. src. rpm. These software packages are rpm packages that contain source code and need to be compiled during installation. There are two ways to install such software packages:


Method 1:

1). Execute rpm-I your-package.src.rpm

2). cd/usr/src/redhat/SPECS

3). rpmbuild-bp your-package.specs A specs file with the same name as your package

4). cd/usr/src/redhat/BUILD/your-package/a directory with the same name as your package

5)./configure is the same as compiling common source code software. parameters can be added.

6). make

7). make install


Method 2:

1). Execute rpm-I you-package.src.rpm

2). cd/usr/src/redhat/SPECS

The first two steps are the same as method 1.

3 ). rpmbuild-bb your-package.specs A specs file with the same name as your package at this time, in/usr/src/redhat/RPM/i386/(depending on the specific package, it may also be i686, in this directory, there is a new rpm package, which is a compiled binary file. Run the rpm-I new-package.rpm to complete the installation.


3. How to uninstall the rpm Software Package

Run the command rpm-e package name. The package name can contain the version number and other information, but cannot have a suffix. rpm.

For example, to uninstall a software package proftpd-1.2.8-1, you can use the following format:

Rpm e proftpd-1.2.8-1

Instead of: pm-e proftpd-1.2.8-1.i386.rpm

If you are not sure what the package name is, just remember some sub-names (such as ftp), you can use: rpm-qa | grep ftp to query the exact name

Sometimes there are some errors or warnings:

... Is needed by... This indicates that this software is required by other software and cannot be detached at will. You can use rpm-e -- nodeps to forcibly uninstall it.


4. How to get files in the rpm package without installing

Use tools rpm2cpio and cpio

Rpm2cpio xxx. rpm | cpio-vi

Rpm2cpio xxx. rpm | cpio-idmv

Rpm2cpio xxx. rpm | cpio -- extract -- make-DirectorIEs

The parameter I is the same as the extract parameter, indicating that the file is extracted. V indicates the execution process. d is the same as make-directory. It indicates creating a directory based on the original path of the file in the package, and m indicates keeping the file updated.


5. How to view files and other information related to the rpm package

All of the examples below assume that the software package mysql-3.23.54a-11 is used


A. I installed those rpm packages in my system.

Rpm-qa: list all installed packages

If you want to find all installed software packages that contain a string of SQL

Rpm-qa | grep SQL


B. How to obtain the full name of a software package?

Rpm-q mysql can obtain the full name of the mysql software package installed in the system.

The version of the current software package. The information mysql-3.23.54a-11 can be obtained in this example


C. Where is the file in an rpm package installed?

Rpm-ql package name note here is the name of the package that does not include the. rpm suffix that means you can only use mysql or mysql-3.23.54a-11 instead of mysql-3.23.54a-11.rpm. If you only want to know where the executable program is put, you can also use which, such as which mysql, or whereis such as whereis mysql.


D. files contained in an rpm package

For a software package that has not been installed, use rpm-qlp *****. rpm: a software package that has been installed, you can also use rpm-ql *****. rpm


E. How to obtain the version, usage, and other information about a software package?

For a software package that has not been installed, use rpm-qip *****. rpm. For a software package that has been installed, you can also use rpm-qi *****. rpm.


F. Which software package is installed for a program or which software package contains the program?

Rpm-qf 'which program name' returns the full name of the software package; rpm-qif 'which program name' returns information about the software package; rpm-qlf 'which program name' returns the package file list. note: here is not a quotation mark, but ', which is the key in the upper left corner of the keyboard. You can also use rpm-qilf to output the package information and file list at the same time.


G. Which package is installed for a file or which package contains the file?

Note that the method in the previous question only applies to executable programs. The following method can be used not only for executable programs, but also for common files. The premise is that you know the file name. First, obtain the complete path of the program. You can use whereis or which, and then use rpm-qf for example: # whereis ftptop (the result is ftptop: /usr/bin/ftptop/usr/share/man/man1/ftptop.1.gz)

# Rpm-qf/usr/bin/ftptop

Proftpd-1.2.8-1

# Rpm-qf/usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txt

Proftpd-1.2.8-1



More details: www.cjinadea.cn

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.