Linux下如何查看使用YUM安装过的包的安装路径呢? 在搞清楚这个问题前,我们先来了解一下YUM。 YUM(全称为 Yellow dog Updater, Modified)是一个在Fedora和RedHat以及CentOS中的Shell前端软件包管理器。基于RPM包管理,能够从指定的服务器自动下载RPM包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,避免了手动安装的麻烦(寻找资源、下载;放到指定目录安装;处理依赖关系并下载依赖关系的包进行安装)。所以用yum安装,实质上是用RPM安装,所以RPM查询信息的指令都可用。
如果使用RPM安装了一些包,一般来说,RPM默认安装路径如下:
Directory |
Contents of Directory |
/etc |
|
/usr/bin |
一些可执行文件 |
/usr/lib |
一些程序使用的动态函数库 |
/usr/share/doc |
一些基本的软件使用手册与帮助文档 |
/usr/share/man |
一些man page文件 |
以MySQL的安装为例,我们使用RPM方式安装了MySQL的两个包,其实rpm有两个参数-l和-c可以帮助我们查看具体的安装路径。
-l 显示软件包中的文件列表
-c 显示配置文件列表
那么我们可以使用“rpm -ql 包名”来查看具体的安装路径。如下所示:
[root@DB-Server ~]# rpm -qa | grep -i mysql MySQL-server-advanced-5.6.20-1.rhel5 MySQL-client-advanced-5.6.20-1.rhel5 [root@DB-Server ~]# rpm -ql MySQL-client-advanced-5.6.20-1.rhel5 /usr/bin/msql2mysql /usr/bin/mysql /usr/bin/mysql_config_editor /usr/bin/mysql_find_rows /usr/bin/mysql_waitpid /usr/bin/mysqlaccess /usr/bin/mysqlaccess.conf /usr/bin/mysqladmin /usr/bin/mysqlbinlog /usr/bin/mysqlcheck /usr/bin/mysqldump /usr/bin/mysqlimport /usr/bin/mysqlshow /usr/bin/mysqlslap /usr/share/man/man1/msql2mysql.1.gz /usr/share/man/man1/mysql.1.gz /usr/share/man/man1/mysql_config_editor.1.gz /usr/share/man/man1/mysql_find_rows.1.gz /usr/share/man/man1/mysql_waitpid.1.gz /usr/share/man/man1/mysqlaccess.1.gz /usr/share/man/man1/mysqladmin.1.gz /usr/share/man/man1/mysqlbinlog.1.gz /usr/share/man/man1/mysqlcheck.1.gz /usr/share/man/man1/mysqldump.1.gz /usr/share/man/man1/mysqlimport.1.gz /usr/share/man/man1/mysqlshow.1.gz /usr/share/man/man1/mysqlslap.1.gz [root@DB-Server tmp]# rpm -ql MySQL-server-advanced-5.6.20-1.rhel5 /etc/init.d/mysql /etc/logrotate.d/mysql /etc/my.cnf /usr/bin/innochecksum /usr/bin/my_print_defaults /usr/bin/myisam_ftdump /usr/bin/myisamchk /usr/bin/myisamlog /usr/bin/myisampack /usr/bin/mysql_convert_table_format /usr/bin/mysql_fix_extensions /usr/bin/mysql_install_db /usr/bin/mysql_plugin /usr/bin/mysql_secure_installation /usr/bin/mysql_tzinfo_to_sql /usr/bin/mysql_upgrade /usr/bin/mysql_zap /usr/bin/mysqlbug /usr/bin/mysqld_multi /usr/bin/mysqld_safe /usr/bin/mysqldumpslow /usr/bin/mysqlhotcopy /usr/bin/mysqltest .....................................................
[root@DB-Server ~]# rpm -qc MySQL-server-advanced-5.6.20-1.rhel5 /etc/logrotate.d/mysql /etc/my.cnf [root@DB-Server ~]#
在MySQL的官方文档,你可以看到RPM包所在的安装目录。我们使用rpm -ql 对比验证了一下,基本都OK,但是很奇怪的是,在上面这个版本中,我没有找到/etc/my.cnf,而是/usr/my.cnf
MySQL 5.6
Directory |
Contents of Directory |
/usr/bin |
Client programs and scripts |
/usr/sbin |
The mysqld server |
/var/lib/mysql |
Log files, databases |
/var/lib/mysql-files |
Value of secure_file_priv |
/usr/share/info |
MySQL manual in Info format |
/usr/share/man |
Unix manual pages |
/usr/include/mysql |
Include (header) files |
/usr/lib/mysql |
Libraries |
/usr/share/mysql |
Miscellaneous support files, including error messages, character set files, sample configuration files, SQL for database installation |
/usr/share/sql-bench |
Benchmarks |
MySQL 5.7
Files or Resources |
Location |
Client programs and scripts |
/usr/bin |
mysqld server |
/usr/sbin |
Configuration file |
/etc/my.cnf |
Data directory |
/var/lib/mysql |
Error log file |
For RHEL, Oracle Linux, CentOS or Fedora platforms: /var/log/mysqld.log For SLES: /var/log/mysql/mysqld.log |
Value of secure_file_priv |
/var/lib/mysql-files |
System V init script |
For RHEL, Oracle Linux, CentOS or Fedora platforms: /etc/init.d/mysqld For SLES: /etc/init.d/mysql |
Systemd service |
For RHEL, Oracle Linux, CentOS or Fedora platforms: mysqld For SLES: mysql |
Pid file |
/var/run/mysql/mysqld.pid |
Socket |
/var/lib/mysql/mysql.sock |
Keyring directory |
/var/lib/mysql-keyring |
Unix manual pages |
/usr/share/man |
Include (header) files |
/usr/include/mysql |
Libraries |
/usr/lib/mysql |
Miscellaneous support files (for example, error messages, and character set files) |
/usr/share/mysql |
另外一台测试服务器,使用yum安装了mysql-community-server-5.7.18,测试验证发现又是正常。 暂时不清楚这个细节问题。
Atas ialah kandungan terperinci 关于Linux如何查看YUM的安装目录代码图文教程. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!