Installation and uninstall of software under Linux __linux

Source: Internet
Author: User
Tags rpmbuild
RPM Package:

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 might overwrite the existing
Files that are not properly installed by default when they are available
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:
1. Implementation of 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 This step is the same as compiling common source software, you can add parameters
6. Make
7. 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. An RPM package where the files are installed.

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 to obtain 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

Summarize:

Get package-related information with rpm-q,q for query queries, followed by other options, such as
I express info, get information of software package;
L represents list, obtains file lists;
A represents all and executes the query in all packages;
f indicates file, the relevant query according to the document;
P indicates package, query based on package
The required query criteria can be generated using grep, or from the command line in "'"
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.