Linux安装及管理程序详述

一、RPM包管理工具

RPM Pachage Manager由Red Hat公司提出,被众多Linux发行版所采用。建立统一的数据库文件,详细记录软件包安装、卸载等变化信息,能够自动分析软件包依赖关系。RPM软件包一般命名格式如下:

Linux安装及管理程序详述

1、查询已安装的RPM软件信息

查询已安装的RPM软件包语法格式如下:

Linux安装及管理程序详述

应用举例:

[root@CentOS01 ~]# rpm -qa <!--查询所有已安装的rpm软件信息--> Python2-pyasn1-modules-0.1.9-7.el7.noarch mesa-libEGL-17.0.1-6.20170307.el7.x86_64 xcb-util-0.4.0-2.el7.x86_64 python-pyblock-0.53-6.el7.x86_64 sysstat-10.1.5-12.el7.x86_64 sos-3.4-6.el7.centos.noarch xorg-x11-server-Xorg-1.19.3-11.el7.x86_64 libiscsi-1.9.0-7.el7.x86_64 sssd-ldap-1.15.2-50.el7.x86_64 postfix-2.10.1-6.el7.x86_64 …………<!--此处省略部分内容--> [root@centos01 ~]# rpm -q bash <!--查询已安装的bash软件包--> bash-4.2.46-28.el7.x86_64 [root@centos01 ~]# rpm -qi bash <!--查询bash软件包的详细信息--> Name : bash Version : 4.2.46 Release : 28.el7 Architecture: x86_64 Install Date: 2019年10月23日 星期三 22时29分35秒 Group : System Environment/Shells Size : 3663637 License : GPLv3+ Signature : RSA/SHA256, 2017年08月10日 星期四 23时03分40秒, Key ID 24c6a8a7f4a80eb5 Source RPM : bash-4.2.46-28.el7.src.rpm Build Date : 2017年08月03日 星期四 05时13分21秒 Build Host : c1bm.rdu2.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : Summary : The GNU Bourne Again shell Description : The GNU Bourne Again shell (Bash) is a shell or command language interpreter that is compatible with the Bourne shell (sh). Bash incorporates useful features from the Korn shell (ksh) and the C shell (csh). Most sh scripts can be run by bash without modification. [root@centos01 ~]# rpm -qa | grep bash bash-4.2.46-28.el7.x86_64 bash-completion-2.1-6.el7.noarch [root@centos01 ~]# rpm -ql openssh <!--查看openssh在系统中安装的所有目录--> /etc/ssh /etc/ssh/moduli /usr/bin/ssh-keygen /usr/libexec/openssh /usr/libexec/openssh/ctr-cavstest /usr/libexec/openssh/ssh-keysign /usr/share/doc/openssh-7.4p1 /usr/share/doc/openssh-7.4p1/CREDITS …………<!--此处省略部分内容--> 2、查询文件或目录属于哪个RPM软件

语法格式如下:

Linux安装及管理程序详述

应用举例:

[root@centos01 ~]# rpm -qf /usr/bin/vim <!--查询vim是由哪个软件包安装的--> vim-enhanced-7.4.160-2.el7.x86_64 [root@centos01 ~]# rpm -qf /usr/libexec/openssh/ <!--查看配置文件是哪个程序使用--> openssh-7.4p1-11.el7.x86_64 3、查询未安装的RPM包文件

查询未安装的RPM软件包语法格式如下:

Linux安装及管理程序详述

应用举例:

[root@centos01 ~]# rpm -qpi /mnt/Packages/httpd-2.4.6 -67.el7.centos.x86_64.rpm <!--查看httpd的rpm包详细信息--> Name : httpd Version : 2.4.6 Release : 67.el7.centos Architecture: x86_64 Install Date: (not installed) Group : System Environment/Daemons Size : 9823661 License : ASL 2.0 Signature : RSA/SHA256, 2017年08月11日 星期五 00时40分32秒, Key ID 24c6a8a7f4a80eb5 Source RPM : httpd-2.4.6-67.el7.centos.src.rpm Build Date : 2017年08月04日 星期五 11时21分07秒 Build Host : c1bm.rdu2.centos.org Relocations : (not relocatable) Packager : CentOS BuildSystem <http://bugs.centos.org> Vendor : CentOS URL : Summary : Apache HTTP Server Description : The Apache HTTP Server is a powerful, efficient, and extensible web server. [root@centos01 ~]# rpm -qpl /mnt/Packages/httpd-2.4.6 -67.el7.centos.x86_64.rpm <!--查看httpd的rpm包安装包含的目录--> /etc/httpd /etc/httpd/conf /etc/httpd/conf.d /etc/httpd/conf.d/README /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/userdir.conf /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.modules.d /etc/httpd/conf.modules.d/00-base.conf /etc/httpd/conf.modules.d/00-dav.conf /etc/httpd/conf.modules.d/00-lua.conf /etc/httpd/conf.modules.d/00-mpm.conf /etc/httpd/conf.modules.d/00-proxy.conf /etc/httpd/conf.modules.d/00-systemd.conf /etc/httpd/conf.modules.d/01-cgi.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf/magic /etc/httpd/logs /etc/httpd/modules /etc/httpd/run ………… <!--此处省略部分内容--> [root@centos01 ~]# rpm -qpc /mnt/Packages/httpd-2.4.6 -67.el7.centos.x86_64.rpm <!--查看httpd安装后的配置文件--> /etc/httpd/conf.d/autoindex.conf /etc/httpd/conf.d/userdir.conf /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.modules.d/00-base.conf /etc/httpd/conf.modules.d/00-dav.conf /etc/httpd/conf.modules.d/00-lua.conf /etc/httpd/conf.modules.d/00-mpm.conf /etc/httpd/conf.modules.d/00-proxy.conf /etc/httpd/conf.modules.d/00-systemd.conf /etc/httpd/conf.modules.d/01-cgi.conf /etc/httpd/conf/httpd.conf /etc/httpd/conf/magic /etc/logrotate.d/httpd /etc/sysconfig/htcacheclean /etc/sysconfig/httpd 二、安装、升级和卸载RPM软件

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/11554.html