本文共 7299 字,大约阅读时间需要 24 分钟。
rpm -ivh 全名
安装软件包选项:
rpm -Uvh 包全名(旧版本)
如果已经安装就更新,如果没有安装就安装rpm -e 包名
后台数据库中查找包名对应的文件,然后卸载命令 | 作用 |
---|---|
rpm -q 包名 | 查询是否安装软件包 |
rpm -qa | 查询所有已安装的软件包 |
rpm -qi 包名 | 查询已安装软件包的信息 |
rpm -qip 包全名 | 查看未安装的包的信息 |
rpm -ql 包名 | 查看包安装位置(未安装也可以查询-p) |
rpm -qf 文件名 | 查看系统文件属于哪个软件包 |
rpm -qR 包名 | 查看包所依赖的软件包 |
选项:
rpm2cpio 包全名 | cpio -idv .文件绝对路径
从rpm包中提取需要的文件例如,删除ls命令:
rm -rf /bin/ls
从rpm包中提取出ls文件
rpm2cpio /mnt/cdrom/Packages/coreutils-8.4-43.el6.x86_64.rpm | cpio -idv ./bin/ls
yum的源文件位于 /etc/yum.repos.d/CentOS-Base.repo
,具体文件内容如下
# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Base - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6#released updates [updates]name=CentOS-$releasever - Updates - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6#additional packages that may be useful[extras]name=CentOS-$releasever - Extras - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib - mirrors.aliyun.comfailovermethod=prioritybaseurl=http://mirrors.aliyun.com/centos/$releasever/contrib/$basearch/ http://mirrors.aliyuncs.com/centos/$releasever/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-6
相关参数:
备份
mv CentOS-Base.repo CentOS-Base.repo.backup
下载新的源文件,替换原来的源
wget -O CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
生成缓存
yum makecache
挂载光盘
mount -t iso9660 /dev/sr0 /mnt/cdrom/
使网络yum失效。将网络源文件改名为其他文件,或者将 enabled
设为0:
// 将网络源文件改名为其他文件mv CentOS-Base.repo CentOS-Base.repo.ali.backup
CentOS-Media.repo
文件。将baseurl 改成光盘目录,将enable改为1:[c6-media]name=CentOS-$releasever - Mediabaseurl=file:///mnt/cdrom# file:///media/cdrom/# file:///media/cdrecorder/gpgcheck=1enabled=1gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
yum list
,可以看到所有源的名称都变成了 c6-media
。正是光盘源的名称:...vte.i686 0.25.1-9.el6 c6-media vte-devel.i686 0.25.1-9.el6 c6-media vte-devel.x86_64 0.25.1-9.el6 c6-media w3m.x86_64 0.5.2-19.el6 c6-media w3m-img.x86_64 0.5.2-19.el6 c6-media watchdog.x86_64 5.6-5.el6 c6-media wavpack.i686 4.60-1.1.el6 c6-media wavpack-devel.i686 4.60-1.1.el6 c6-media wavpack-devel.x86_64 4.60-1.1.el6 c6-media webalizer.x86_64 2.21_02-3.3.el6 c6-media webkitgtk.i686 1.4.3-9.el6_6 c6-media webkitgtk-devel.i686 1.4.3-9.el6_6 c6-media webkitgtk-devel.x86_64 1.4.3-9.el6_6 c6-media webkitgtk-doc.x86_64 1.4.3-9.el6_6 c6-media werken-xpath.noarch 0.9.4-4.beta.12.6.el6 c6-media werken-xpath-javadoc.noarch 0.9.4-4.beta.12.6.el6 c6-media wireless-tools.i686 1:29-6.el6 c6-media wireless-tools-devel.i686 1:29-6.el6 c6-media wireless-tools-devel.x86_64 1:29-6.el6 c6-media ...
查询所有可用软件包列表
yum list
查询和关键字有关的软件包
yum search 关键字
自动安装指定软件包
yum -y install 包名
升级(如果源中有更新版的软件包)
yum -y update 包名
升级所有软件,包括内核
yum -y update
卸载软件包
yum -y remove 包名
参数:
列出所有可用的软件组列表:
yum grouplsit
安装指定软件组,组名可以由grouplist查询出来
yum groupinstall 软件组名
卸载指定软件组
yum groupremove 软件组名
1、进入解压缩命令
2、./configure -prefix=/usr/local/apache 安装到指定目录 3、make 编译(make clean清除) 4、make install编译安装/usr/local/
,不可以用service命令管理安装完毕后,仅有的不同是安装位置不同。