Tips for using RPM software packages in Linux

Source: Internet
Author: User
Tags rpmbuild
Article Title: Tips for using RPM software packages in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source. 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, usually in the current directory). The following prompt may appear during the installation process :...... Conflict ...... It may be that some files in the package to be installed may overwrite the existing files. In this case, you cannot correctly install them using 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 it. Src. rpm Software Package
 
Some software packages are. Src. rpm ends. This type of software package contains the source code rpm package and needs to be compiled during installation. There are two ways to install such software packages:
 
Method 1:
 
1 ). Run 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. You can add Parameters
 
6 ). Make
 
7 ). Make install
 
Method 2:
 
1 ). Run 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 ...... This indicates that this software is required by other software. You can use rpm-e -- nodeps to forcibly uninstall it if you cannot detach 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?
 
Note that the rpm-ql package name is not included here. The name of the software package with the rpm suffix that is, only mysql or mysql-3.23.54a-11 can be used 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
 
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.