CentOS系统用yum命令升级php和mysql失败的解决办法
失败的情况是:
首先参看系统的php版本
# rpm -qa |grep php
php-common-5.1.6-20.el5_2.1
php-cli-5.1.6-20.el5_2.1
php-5.1.6-20.el5_2.1
php-ldap-5.1.6-20.el5_2.1
然后看到此版本不是最新的用下面的命令升级
# yum -y update php
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* base: centos.candishosting.com.cn
* updates: centos.candishosting.com.cn
* addons: centos.candishosting.com.cn
* extras: centos.candishosting.com.cn
Setting up update Process
Could not find update match for php
No Packages marked for Update
说没有可以升级的php版本,而官方的php都是最新的了,php是5.2.*的了 可是centos系统的还是5.1.
解决思路:是由于centos系统自带的源里面的php版本没有更新,需要额外的源才可以升级php和mysql
办法:更新系统的源,然后在升级就可以解决了。
#vi /etc/yum.repos.d/zongguofengcn.repo
[utterramblings]
name=Jason's Utter Ramblings Repo
baseurl=http://www.jasonlitka.com/media/EL$releasever/$basearch/
enabled=1
gpgcheck=1
gpgkey=http://www.jasonlitka.com/media/RPM-GPG-KEY-jlitka
保存此文件wq
再次运行下面的命令就可以完成php的升级了
#yum -y update php
同理,运行下面命令,升级mysql
#yum -y update mysql
注释:
yum是linux版本的一些rhel、centos等系统自带的用于方便地添加/删除/更新RPM包的工具,它能自动解决包的倚赖性问题。
用yum更新一些软件包,一条命令就可以搞定了