centos下删除用yum安装的软件
作者:田逸([email]sery@163.com[/email])
 
yum安装软件包,方便简单.但在这个过程中,那些文件和目录都到哪里去了呢?到处都是呀!要维护这些文件,很麻烦的.前两天,我用源码安装mysql-proxy,在编译过程中,老出错,我就依提示安装mysql, 为了尽快完事,我用了yum install mysql.现在我打算重新安装mysql,因此需要把yum方式安装的mysql删除.
 
用rpm工具吧,不行呢.挨个删除文件,更不可行,因为我不知道究竟安装了哪些文件,都存放在哪些位置.怎么办?还好,yum自己可以完成这个工作.
 
现在我们来看一下yum的参数:
[root@test1 ~]# yum
You need to give some command
usage: yum [options] < grouplist, localinstall, groupinfo, localupdate, resolvedep, erase, deplist, groupremove, makecache, upgrade, provides, shell, install, whatprovides, groupinstall, update, repolist, groupupdate, info, search, check-update, list, remove, clean, grouperase >
其中remove就是删除命令.好了,我们来执行命令 yum remove mysql ,其输出如下:
[root@test1 ~]# yum remove mysql
Setting up Remove Process
base                      100% |=========================| 1.1 kB    00:00    
updates                   100% |=========================|  951 B    00:00    
addons                    100% |=========================|  951 B    00:00    
extras                    100% |=========================| 1.1 kB    00:00    
Resolving Dependencies
--> Running transaction check
---> Package mysql.i386 0:5.0.45-7.el5 set to be erased
--> Processing Dependency: libmysqlclient.so.15 for package: mysql-devel
--> Processing Dependency: libmysqlclient_r.so.15 for package: mysql-devel
--> Processing Dependency: mysql = 5.0.45-7.el5 for package: mysql-devel
--> Running transaction check
---> Package mysql-devel.i386 0:5.0.45-7.el5 set to be erased
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
 mysql                   i386       5.0.45-7.el5     installed         7.3 M
Removing for dependencies:
 mysql-devel             i386       5.0.45-7.el5     installed         5.6 M
Transaction Summary
=============================================================================
Install      0 Package(s)        
Update       0 Package(s)        
Remove       2 Package(s)        
Is this ok [y/N]: y
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Erasing   : mysql-devel                  ######################### [1/2]
  Erasing   : mysql                        ######################### [2/2]
Removed: mysql.i386 0:5.0.45-7.el5
Dependency Removed: mysql-devel.i386 0:5.0.45-7.el5
Complete!
看,很容易就完成了.再来验证一下: 执行命令mysql,其结果为:
[root@test1 ~]# mysql
-bash: mysql: command not found
果然删除了!