How To Upgrade To Apache 2.x, PHP 5.x and MySQL 5.x on CentOS 4 Using Yum
If you prefer installing and updating your CentOS 4 applications with pre-compiled packages using Yum (and you should!), you probably already know that you're stuck with older versions of PHP, MySQL and Apache. In fact, according to the CentOS 4 package repository, here are the latest available versions of these components:
- PHP 4.3.9
- MySQL Server 4.1.20
- HTTPD 2.0.52
Of course you could search the web for the latest RPMS, find all the dependencies and install everything with the package manager. But there an easier trick than that. It's called the CentOSPlus Repository.
I won't go into details about this repository, you can find more information here.
Enabling The CentOSPlus Repository
I am assuming at this point that you've tested all your PHP scripts on PHP5 and that you've backed up all your MySQL databases. You did it, right? Ok proceed then.
This is quite simple. All you have to do is to edit /etc/yum.repos.d/CentOS-Base.repo with your favorite text editor (no word processor!). Find the following section:
#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=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
Now simply set the enabled parameter to 1. Save the file and exit the editor.
When you're done, you can update Yum before going further (optional):
# yum update yum
After that you can update PHP, Apache and MySQL:
# yum update php mysql apache
When you're done, you can either reboot your server or restart httpd and mysqld:
# service httpd restart
# service mysqld restart
Once the upgrade is finished, you should now have the following versions installed:
- PHP 5.1.6
- MySQL Server 5.0.54
- HTTPD 2.0.59
Good luck!
