centosphp5.1版本升级5.2

来源:互联网 发布:idm mac破解版 编辑:程序博客网 时间:2024/06/05 09:22

我们知道CentOSyum通过/etc/yum.repos.d/CentOS-Base.repo里的配置进行镜像服务器查找更新,最近给客户安装一个MANTISTESTLINK组建的测试平台,发现CentOS自带PHP是5.1版本,不支持最新的phpMyAdminTESTLINK,这两个应用的最新版本都需要5.2或更高版本的PHP环境。

 

  在网上查阅相关资料后发现,其实CentOS团队还维护着一个测试更新库,这里有许多测试版应用(暂仅这么称呼着,我的理解是因种种原因没有正式对外发行而已),经过简单的修改就可以得到以下配置文件:

 

#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 CentOSupdates
# 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
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#released updates
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons
#baseurl=http://mirror.centos.org/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
#baseurl=http://mirror.centos.org/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

[testing]
name=CentOS-$releasever - Testing
baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/
enabled=0
gpgcheck=1
gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing

 

  可以在配置文件最后增加一个[testing]节,注意这个配置节和它上面系统自带的两个配置节设置了参数enabled=0,平时我们执行yum upgrade时并不会被检查,只有通过适当变通,我们才可能通过这些库查找或更新更多应用(因为CentOS团队没有正式对外发行,所以建议只在迫不得已的情况下使用),例如我要安装最新的php,在控制台执行以下命令,yum就会发现并提示是否要安装5.2.9-2版本的PHP

 

yum install php --disablerepo=/* --enablerepo=testing

 

  注意后两个参数的使用,屏蔽了其它更新库的使用,打开了测试更新库,通过这种方式找到了5.2版本的PHP,正是我需要的;其实通过这种方式还可以找到更高版本的MySQLApache Http Server等,不过要不要更新全由你自己决定了。 :)

原创粉丝点击