How to install and uninstall RPM packages on Linux _linux shell

Source: Internet
Author: User
Tags rpmbuild

The way to install and uninstall the RPM package on Linux is as follows:

1. How to install the RPM package

RMP software packages can be installed using the program RPM to complete. Execute the following command

Rpm-i your-package.rpm

Where your-package.rpm is the file name of the RPM package you want to install, typically placed in the current directory.

The following warnings or prompts may appear during the installation:

... conflict with ... There may be some files in the package to be installed that may overwrite the existing file, which, by default, cannot be installed correctly.

RPM--force-i forced installation can be

... is needed by ...

... is not installed ... Some of the software you need for this package is not available for installation

RPM--nodeps-i to ignore this information

In other words, rpm-i--force--nodeps can ignore all dependencies and file problems, what package

Can be installed, but this forced-install package does not guarantee full functionality

2. How to install. SRC.RPM Packages

Some packages end with. src.rpm, which is an RPM package that contains the source code, and at the time of installation

Need to compile. There are two ways to install this type of package.

Method One:

Execute rpm-i your-package.src.rpm
 cd/usr/src/redhat/specs
 rpmbuild-bp your-package.specs a SPECS file with the same name as your package
 cd/usr/src/redhat/build/your-package/a directory with the same name as your package
 ./configure This step and the compilation of common source software, you can add parameter make
Make install

Method Two:

1. Implementation of Rpm-i you-package.src.rpm

2. Cd/usr/src/redhat/specs

The first two steps are the same as the method one

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 be i686,noarch, etc.)

In this directory, there is a new RPM package, which is a compiled binary file.

The execution of Rpm-i new-package.rpm can be completed by installation.

3. How to uninstall the RPM package

Using the command RPM-E package name, the package name can contain information such as version number, but no suffix can be used. rpm

For example, uninstall package Proftpd-1.2.8-1, you can use the following format:

Rpm-e proftpd-1.2.8-1
rpm-e proftpd-1.2.8
rpm-e proftpd-rpm-e proftpd

Can not be the following format:

Rpm-e proftpd-1.2.8-1.i386.rpm
rpm-e proftpd-1.2.8-1.i386
rpm-e proftpd-1.2 rpm-e proftpd-1

Sometimes there are errors or warnings:

... is needed by ... This means that the software is required by other software, can not be easily unloaded

You can force uninstall with Rpm-e--nodeps

4. How to not install but get the files in the RPM package

Using Tools Rpm2cpio and Cpio

Rpm2cpio xxx.rpm | Cpio-vi
Rpm2cpio xxx.rpm | cpio-idmv
rpm2cpio xxx.rpm | cpio--extract--make-directories

The parameters I and extract are the same, representing the extracted files. V indicates that the execution process

D is the same as make-directory to create a directory based on the original path of the file in the package

m indicates how long the file is to be kept updated.

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

All of the following examples assume the use of package mysql-3.23.54a-11

1. The RPM packages are installed in my system

Rpm-qa to list all installed packages

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

RPM-QA |grep SQL

2. How to obtain the full file name of a package

Rpm-q MySQL can obtain the full name of the MySQL package installed in the system, from which you can obtain

Information such as the version of the current package. In this case, you can get information mysql-3.23.54a-11

3. Where is the file installed in an RPM package?

RPM-QL Package Name

Note that 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 just want to know where the executable program goes, you can also use which, such as

which MySQL

4. Include those files in an RPM package

A package that has not been installed, using the RPM-QLP ****.rpm

An already installed package, you can also use the RPM-QL ****.rpm

5. How do I get information about the version, purpose, etc. of a software package?

A package that has not been installed, using the RPM-QIP ****.rpm

An already installed package, you can also use the Rpm-qi ****.rpm

6. Which package is installed in a program, or which package contains this program

RPM-QF ' which program name ' returns the full name of the package
Rpm-qif ' which program name ' returns information about the package
RPM-QLF ' which program name ' Returns the file list of the package

Note that this is not a quote, but a ', that's the key in the upper-left corner of the keyboard.

You can also use RPM-QILF to output package information and file lists at the same time

7. Which package is installed in a file, or which package contains this file

Note that the method in the previous question applies only to the executable program, and the following method can not only

Can be used for executable programs, or for any file that is normal. The prerequisite is to know the file name.

First get the full path to the program, you can use Whereis or which, and then RPM-QF for example:

# Whereis Ftptop
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

Below is a look at the easiest way to install and uninstall Linux rpm

[Root@wang packages]# Mount/dev/cdrom/mnt

Mount

[Root@wang packages]# RPM-IVH zip-3.0-1.el6.x86_64.rpm//i: Installation V: Visual H: Progress
[Root@wang packages]# RPM-IVH--force//Do not prompt for forced installation

Install Zip

[Root@wang packages]# Rpm-e

Uninstall command

[Root@wang packages]# RPM-IVH--nodeps Pack//Do not rely on forced uninstall of RPM packages
[Root@wang packages]# RPM-UVH//Upgrade RPM Package

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.