为了重复测试MySQL的自动化安装工具,不小心在清理MySQL的脚本里面写了sudo yum remove -y crontabs,在CentOS5.8里面,由于包的依赖关系,把yum和rpm两个系统级别的包给删除了(经测试,在CentOS6.4里面不会)。这下麻烦大了!没有yum和rpm,系统的包只能通过源码编译安装了!
好在,从另外一台CentOS5.8机器上面把相关的rpm的指令文件和库文件都拷贝过来了,rpm能用了,然后找到所有删除的包的rpm文件,给一起装上了。过程很折腾,但是最终yum终于能用了!
然而,我在使用yum安装MySQL-client的时候,遇到如下错误:
$ sudo yum install MySQL-client*
Loaded plugins: fastestmirror, security
Repository custom is listed more than once in the configuration
Loading mirror speeds from cached hostfile
Setting up Install Process
Examining MySQL-client-5.6.12-1.rhel5.x86_64.rpm: MySQL-client-5.6.12-1.rhel5.x86_64
Marking MySQL-client-5.6.12-1.rhel5.x86_64.rpm to be installed
Resolving Dependencies
--> Running transaction check
---> Package MySQL-client.x86_64 0:5.6.12-1.rhel5 set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==============================================================================================================================================================================================================
Package Arch Version Repository Size
==============================================================================================================================================================================================================
Installing:
MySQL-client x86_64 5.6.12-1.rhel5 /MySQL-client-5.6.12-1.rhel5.x86_64 74 M
Transaction Summary
==============================================================================================================================================================================================================
Install 1 Package(s)
Upgrade 0 Package(s)
Total size: 74 M
Is this ok [y/N]: y
Downloading Packages:
warning: rpmts_HdrFromFdno: V3 DSA signature: NOKEY, key ID 5072e1f5
Public key for MySQL-client-5.6.12-1.rhel5.x86_64.rpm is not installed
而使用sudo yum install MySQL-client,不加*就可以正常安装。一开始怀疑是自己重新搞好的yum出了问题。后面发现自己的home目录下面有一个MySQL-client-5.6.12-1.rhel5.x86_64.rpm文件。把它删除了,使用sudo yum install MySQL-client*也能正常安装了。
总结:
1.使用yum删除包的时候要小心,如果删除不认识的包,请不要随意加上-y参数
2.把yum和rpm这两个命令删除了之后,其实是可以从另外一台机器上面拷贝文件,然后安装相关的rpm包给搞回来的
3.yum在安装的时候会从当前目录下面找相关的rpm包文件,如果找到就会在安装的过程中显示出来,至于为什么会出现Public key for MySQL-client-5.6.12-1.rhel5.x86_64.rpm is not installed,而正常不带*安装的时候就不会,这个留作以后研究吧!