rpm安装与卸载
[[email protected] ~]# ls /mnt //mnt为空目录 //把系统光驱挂载到/mnt目录下 [[email protected] ~]# mount /dev/cdrom /mnt //挂载到mnt目录 mount: block device /dev/sr0 is write-protected, mounting read-only [[email protected] ~]# ls /mnt //查看mnt目录 ;mnt目录下有许多文件,这些文件就是rpm安装包 CentOS_BuildTag Packages RPM-GPG-KEY-CentOS-Security-6 EULA RELEASE-NOTES-en-US.html RPM-GPG-KEY-CentOS-Testing-6 GPL repodata TRANS.TBL images RPM-GPG-KEY-CentOS-6 isolinux RPM-GPG-KEY-CentOS-Debug-6 [[email protected] ~]# ls /mnt/Packages/ |head 389-ds-base-1.2.11.15-29.el6.i686.rpm //每一个rpm包都是由-和.分成了若干部分 389-ds-base-libs-1.2.11.15-29.el6.i686.rpm abrt-2.0.8-21.el6.centos.i686.rpm abrt-addon-ccpp-2.0.8-21.el6.centos.i686.rpm abrt-addon-kerneloops-2.0.8-21.el6.centos.i686.rpm abrt-addon-python-2.0.8-21.el6.centos.i686.rpm abrt-cli-2.0.8-21.el6.centos.i686.rpm //eg: abrt-cli为包名,2.0.8为版本信息。21.el6为发布版本型号, i686为运行平台 abrt-desktop-2.0.8-21.el6.centos.i686.rpm abrt-gui-2.0.8-21.el6.centos.i686.rpm abrt-libs-2.0.8-21.el6.centos.i686.rpm // 安装一个rpm包 [[email protected] Packages]# rpm -ivh zip-3.0-1.el6.i686.rpm // 其中-ivh是rpm的选项,i是安装的意思。v是可视化的意思。h显示安装进度 Preparing... ########################################### [100%] package zip-3.0-1.el6.i686 is already installed /*另外在选择rpm包的时候可以用 --force表示强制安装 ,即使覆盖属于其它包的文件也要安装 --nodeps:当安装的rpm包依赖于其它包时,即使其它包没有安装,也安装这个包*/ [[email protected] Packages]#rpm -Uvh zip-3.0-1.el6.i686.rpm //是更新一个安装包。注意U是大写字母 [[email protected] Packages]# rpm -ivh yum-utils-1.1.30-14.el6.noarch.rpm //安装一个rpm包 Preparing... ########################################### [100%] 1:yum-utils ########################################### [100%] [[email protected] Packages]# rpm -e yum-utils // 卸载刚安装的rpm,注意卸载时后面直接叫要卸载的包名即可 [[email protected] Packages]# rpm -qa |grep yum-utils // 查看rpm包是否卸载掉 [[email protected] Packages]# rpm包的查询 [[email protected] Packages]# rpm -ivh yum-utils-1.1.30-14.el6.noarch.rpm //安装一个rpm包 Preparing... ########################################### [100%] 1:yum-utils ########################################### [100%] [[email protected] Packages]# rpm -q yum-utils /*查询刚擦安装的rpm包 后面直接加上包名,不带有详细的信息 yum-utils-1.1.30-14.el6.noarch [[email protected] Packages]# rpm -q yum-utils yum-utils-1.1.30-14.el6.noarch */ [[email protected] Packages]# rpm -qa |head -n5 //-qa选项查询系统所有已经安装过的rpm包; 显示前面的5行 gnome-python2-libwnck-2.28.0-5.el6.i686 cups-libs-1.4.2-50.el6_4.5.i686 pax-3.4-10.1.el6.i686 basesystem-10.0-4.el6.noarch gdm-plugin-fingerprint-2.30.4-64.el6.i686 [[email protected] Packages]# rpm -qi yum-utils //得到一个已经安装过的rpm包的信息,后面直接添加包名即可 Name : yum-utils Relocations: (not relocatable) Version : 1.1.30 Vendor: CentOS Release : 14.el6 Build Date: 2012年06月22日 星期五 20时23分05秒 Install Date: 2015年10月16日 星期五 04时55分30秒 Build Host: c6b8.bsys.dev.centos.org Group : Development/Tools Source RPM: yum-utils-1.1.30-14.el6.src.rpm Size : 308503 License: GPLv2+ Signature : RSA/SHA1, 2012年06月25日 星期一 06时08分38秒, Key ID 0946fca2c105b9de Packager : CentOS BuildSystem <http://bugs.centos.org> URL : http://yum.baseurl.org/download/yum-utils/ Summary : Utilities based around the yum package manager Description : yum-utils is a collection of utilities and examples for the yum package manager. It includes utilities by different authors that make yum easier and more powerful to use. These tools include: debuginfo-install, find-repos-of-install, needs-restarting, package-cleanup, repoclosure, repodiff, repo-graph, repomanage, repoquery, repo-rss, reposync, repotrack, show-installed, show-changed-rco, verifytree, yumdownloader, yum-builddep, yum-complete-transaction, yum-config-manager, yum-debug-dump, yum-debug-restore and yum-groups-manager. [[email protected] Packages]# [[email protected] Packages]# rpm -ql yum-utils //列出一个包包含的文件 /etc/bash_completion.d /etc/bash_completion.d/yum-utils.bash /usr/bin/debuginfo-install /usr/bin/find-repos-of-install /usr/bin/needs-restarting /usr/bin/package-cleanup // 并未全部显示 [[email protected] Packages]# rpm -qf /usr/sbin/yumdb //列出这个文件属于那个安装包 yum-utils-1.1.30-14.el6.noarch
时间: 2024-09-30 16:13:06