Pages

Sunday, 3 February 2013

CENTOS系统下,安装软件

Using the rpm command
The command used to work with RPM package files is rpm. To manage RPM packages, the rpm command has options that let you list all the packages that are installed, upgrade existing packages to newer versions, and query packages for information (such as the files or documentation included with the package). There is also a verify option to check that all files that make up the package are present and unchanged.

The rpm command has the following modes of operation:

• install (-i)
• upgrade (-U)
• freshen (-F)
• query (-q)
• verify (-V)
• signature check (--checksig)
• uninstall (-e)
• rebuild database (--rebuilddb)
• fix permissions (--setperms)
• set owners/groups (--setugids)
• show RC (--showrc)




Querying packages with rpm
You can use the query options (-q) of rpm to get information about RPM packages. This can
be simply listing the packages that are installed or printing detailed information about a
package. Here is the basic format of an rpm query command (at least one option is required):


# rpm -q [options]


The following list shows some useful options you can use with an rpm query:
• -qa — Lists all installed packages.
• -qf file — Lists the package that owns file. (The file must include the full path name or
rpm assumes the current directory.)
• -qi package — Lists lots of information about a package.000
• -qR package — Lists components (such as libraries and commands) that package
depends on.
• -ql package — Lists all the files contained in package.
• -qd package — Lists all documentation files that come in package.
• -qc package — Lists all configuration files that come in package.
• -qp [option] package — Query packages that are not yet installed. Using this option,
along with other query options, allows you to query packages you have that are not yet
installed.
To list all the packages installed on your computer, use the -a query option. Because this is a
long list, you should either pipe the output to less or, possibly, use grep to find the package
you want. The following command line displays a list of all installed RPM packages, and then
shows only those names that include the string of characters xfree. (The -i option to grep
says to ignore case.)