Source: http://blog.csdn.net/namesliu/article/details/6004388
CENTOS5.5 has been integrated with the installation of Apache, MySQL, PHP as a sample, we have to explore the installation path and other information to facilitate our management and use. If you want to reinstall the latest version of these software, you will need to first go to the original path, back up the data and the configuration for future use.
Because CentOS5.5 is a red hat product, the Red Hat should use the RPM (Redhat Package Manager) Pack management method to manage the package, so the relevant commands for using RPM should be able to understand the installation of Apache, MySQL, and PHP packages , including the installation path. RPM When installing the software, after copying files to the relevant path, at the same time to write the information into a specific format of the database (also can be understood as a log), so the query is very fast.
1. The RPM packages are installed in my system
RPM-QA will list all installed packages.
If you are looking for all installed packages that contain a string "SQL", the command is as follows:
RPM-QA |grep SQL
2. How to get the full file name of a package
Rpm-q MySQL can get the full name of the MySQL package installed in the system, which can get information about the current package version. In this example, information mysql-5.0.77-4.el5_5.3 can be obtained.
3. Where is the file installed in a RPM package?
RPM-QL Package Name
Note that the package name here is the name of the package that does not include the. rpm suffix, which means only MySQL or mysql-5.0.77-4.el5_5.3, not mysql-5.0.77-4.el5_5.3.rpm.
If you just want to know where the executable program is, you can also use the which command, such as:
[[email protected] ~]# which MySQL
/usr/bin/mysql
You can also use the Whereis command:
[[email protected] ~]# Whereis MySQL
MySQL:/usr/bin/mysql
/usr/lib/mysql
/usr/share/mysql
/usr/share/man/man1/mysql.1.gz
4. One RPM package contains those files
A package that has not been installed, using the command RPM-QLP package name. rpm.
An already installed package, you can also use the command RPM-QL package name.
5, how to obtain the version of a package, use and other related information
A package that has not been installed, using the command RPM-QIP package name. rpm.
An already installed package, you can also use the command RPM-QI package name.
6. Which package is installed for a program, or which package contains this program
RPM-QF ' which program name ' #返回软件包的全名
Rpm-qif ' which program name ' #返回软件包的有关信息
RPM-QLF ' which program name ' #返回软件包的文件列表
Note that this is not a quotation mark, but a ', the key in the upper left corner of the keyboard. You can also use RPM-QILF to output package information and file lists.
7. Which package is installed for a file, or which package contains this file
Note that the methods in the previous question only apply to executable programs, and the following methods can be used not only for executables, but also for any normal file. The prerequisite is to know the file name.
First get the full path of this program, you can use the Whereis or which command, and then using the RPM-QF command, for example:
[Email protected] home]# Whereis Webmin
Webmin:/etc/webmin/usr/libexec/webmin
[Email protected] home]# rpm-qf/usr/libexec/webmin
Webmin-1.510-1
Check the installation information for the AMP software:
1,apache
[Email protected] home]# Rpm-qi httpd
NAME:HTTPD Relocations: (not relocatable)
version:2.2.3 Vendor:centos
Release:43.el5.centos Build date:2010 April 05 Monday 05:24 03 Seconds
Install date:2010 August 10 Tuesday 07:38 39 seconds Build Host:builder16.centos.org
Group:system environment/daemons Source rpm:httpd-2.2.3-43.el5.centos.src.rpm
size:3274522 License:apache Software License
SIGNATURE:DSA/SHA1, April 27, 2010 Tuesday 03:59 43 seconds, Key ID a8a447dce8562897
Url:ht
[Email protected] home]# RPM-QL httpd>httpd-ql.txt
[See generated Httpd-ql.txt file]
2,mysql
[[email protected] home]# Rpm-qi MySQL
Name:mysql Relocations: (not relocatable)
version:5.0.77 Vendor:centos
release:4.el5_5.3 Build date:2010 May 28 Friday 09:11 01 seconds
Install date:2010 August 10 Tuesday 01:15 50 seconds Build Host:builder10.centos.org
Group:applications/databases Source rpm:mysql-5.0.77-4.el5_5.3.src.rpm
size:8243103 License:gplv2 with exceptions
SIGNATURE:DSA/SHA1, May 28, 2010 Friday 15:47 10 seconds, Key ID a8a447dce8562897
Url:http://www.mysql.com
Summary:mysql client programs and shared libraries.
Description:
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
Client/server implementation consisting of a server daemon (mysqld)
And many different client programs and libraries. The base Package
Contains the MYSQK
[Email protected] home]# RPM-QL mysql>mysql-ql.txt
[See generated Mysql-ql.txt file]
3,php
[[email protected] home]# Rpm-qi PHP
name:php Relocations: (not relocatable)
version:5.1.6 Vendor:centos
Release:27.el5 Build date:2010 March 31 Wednesday 14:53 10 seconds
Install date:2010 August 10 Tuesday 07:39 19 seconds Build Host:builder17.centos.org
Group:development/languages Source rpm:php-5.1.6-27.el5.src.rpm
size:6175386 license:the PHP License v3.01
SIGNATURE:DSA/SHA1, April 27, 2010 Tuesday 04:00 31 seconds, Key ID a8a447dce8562897
url:http://www.php.net/
summary:php the scripting language embedded in HTML. (PHP: Super text preprocessor)
Description:
PHP is an html-embedded scripting language. PHP attempts to make it
Easy for developers to write dynamically generated webpages. PHP Also
Offers built-in database integration for several commercial and
Non-commercial database management systems, so writing a
database-enabled webpage with PHP are fairly simple. The most common
Use of PHP coding are probably as a replacement for CGI scripts.
The PHP package contains the module which adds support for the PHP
Language to Apache HTTP Server.
[Email protected] home]# RPM-QL php>php-ql.txt
[See generated Php-ql.txt file]
Linux RPM installation Package information query