1 rpm 常会用命令
rpm 执行安装包
二进制包(Binary)以及源代码包(Source)两种。二进制包可以直接安装在计算机中,而源代码包将会由RPM自动编译、安装。源代码包经常以src.rpm作为后缀名
rpm -i # 需要安装的包文件名 常用的是 rpm -ivh,安装并显示安装进度
rpm -e # 需要卸载的包文件名
rpm -qa #查询已经安装的rpm包,常用的是 rpm -qa | grep gcc
[root@localhost ~]# rpm -qa | grep ssh
libssh2-1.4.2-1.el6_6.1.x86_64
openssh-5.3p1-112.el6_7.x86_64
openssh-server-5.3p1-112.el6_7.x86_64
rpm -ql #显示安装包中的所有文件被安装到哪些目录下
[root@localhost ~]# rpm -ql openssh-server-5.3p1-112.el6_7.x86_64
/etc/pam.d/ssh-keycat
/etc/pam.d/sshd
/etc/rc.d/init.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd
/usr/libexec/openssh/sftp-server
/usr/libexec/openssh/ssh-keycat
/usr/sbin/.sshd.hmac
/usr/sbin/sshd
/usr/share/doc/openssh-server-5.3p1
/usr/share/doc/openssh-server-5.3p1/HOWTO.ssh-keycat
/usr/share/man/man5/moduli.5.gz
/usr/share/man/man5/sshd_config.5.gz
/usr/share/man/man8/sftp-server.8.gz
/usr/share/man/man8/sshd.8.gz
/var/empty/sshd
rpm -qi # 显示安装包的信息
[root@localhost ~]# rpm -qi openssh-server-5.3p1-112.el6_7.x86_64
Name : openssh-server Relocations: (not relocatable)
Version : 5.3p1 Vendor: CentOS
Release : 112.el6_7 Build Date: Thu 13 Aug 2015 05:58:28 PM CST
Install Date: Tue 01 Mar 2016 10:07:04 AM CST Build Host: c6b9.bsys.dev.centos.org
Group : System Environment/Daemons Source RPM: openssh-5.3p1-112.el6_7.src.rpm
Size : 714676 License: BSD
Signature : RSA/SHA1, Thu 13 Aug 2015 10:24:56 PM CST, Key ID 0946fca2c105b9de
Packager : CentOS BuildSystem
URL : http://www.openssh.com/portable.html
Summary : An open source SSH server daemon
Description :
OpenSSH is a free version of SSH (Secure SHell), a program for logging
into and executing commands on a remote machine. This package contains
the secure shell daemon (sshd). The sshd daemon allows SSH clients to
securely connect to your SSH server.
rpm -qf # 列出服务器上的一个文件属于哪一个RPM包
[root@localhost ssh]# rpm -qf sshd_config
openssh-server-5.3p1-112.el6_7.x86_64
rpm -qc # 查看一下已安装软件的配置文件
[root@localhost ssh]# rpm -qc openssh-server-5.3p1-112.el6_7.x86_64
/etc/pam.d/ssh-keycat
/etc/pam.d/sshd
/etc/ssh/sshd_config
/etc/sysconfig/sshd
RPM默认安装路径:
/etc 一些设置文件放置的目录
/usr/bin & /usr/sbin 一些可执行文件
/usr/share 数据文件
/usr/lib 库
Yum
yum list | wc -l # 列出所有包的数量,可以配合管道命令 grep 查询已经安装的rpm包
[root@localhost /]# yum list | wc -l
6683
[root@localhost /]# yum list | grep openssh
openssh.x86_64 5.3p1-112.el6_7 @updates
openssh-server.x86_64 5.3p1-112.el6_7 @updates
openssh.x86_64 5.3p1-114.el6_7 updates
openssh-askpass.x86_64 5.3p1-114.el6_7 updates
openssh-clients.x86_64 5.3p1-114.el6_7 updates
openssh-ldap.x86_64 5.3p1-114.el6_7 updates
openssh-server.x86_64 5.3p1-114.el6_7 updates
yum update & yum update kernel # 全面升级系统 和只升级系统内核 yum install sshd安装包 yum update sshd 升级包 yum remove sshd 删除包 yum clean all # 每安装一个软件包,YUM都是先下载一个RPM软件包然后再安装,安装完后并不会自动删除。时间长了,这些文件占很多空间的。所以,需要定时清理: yum clean all yum info
[root@localhost /]# yum info openssh-server-5.3p1-112.el6_7.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: ftp.sjtu.edu.cn
* extras: ftp.sjtu.edu.cn
* updates: ftp.sjtu.edu.cn
Installed Packages
Name : openssh-server
Arch : x86_64
Version : 5.3p1
Release : 112.el6_7
Size : 698 k
Repo : installed
From repo : updates
Summary : An open source SSH server daemon
URL : http://www.openssh.com/portable.html
License : BSD
Description : OpenSSH is a free version of SSH (Secure SHell), a program for logging
: into and executing commands on a remote machine. This package contains
: the secure shell daemon (sshd). The sshd daemon allows SSH clients to
: securely connect to your SSH server.
yum 的安装包位置和rpm安装包位置一下,可以通过rpm -ql命令来查看