Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm working on a fresh CentOS server and am extremely annoyed to find out that yum does not work as smoothly and brilliantly as "apt-get install" does on Ubuntu.

Installing a LAMP stack, I ran the following:

$ yum install php
$ yum install mysql

Furthermore:

$ yum install mysql-server
$ yum install mysql-devel
$ yum install php-mysql

Now running:

$ rpm -qa | grep php

...shows that I have all kinds of php 5.1.6 packages installed and I need 5.2 minimum. In addition, I see that it installed mysql 5.0.77, even though the current release is 5.5.20. But hopefully mysql 5.0 will work. PHP 5.1 will not.

So the real question(s) is(are):

How do I fix my PHP to make it the latest stable release (5.3.9 according to PHP.net)? How do I make my CentOS machine work more like Ubuntu so I don't have to deal with this again?

Thanks very much.

EDIT: CentOS 5.7 was installed by a hosting company last week, so I don't know why they would have installed an older version of CentOS, rather than the most recent. I need PHP 3.2 at least, so I appreciate the suggestions on how to do that. I'm not very familiar with packages and repositories, but it appears that anyone can start a repository and so I'm concerned about installing things from some random repository that could infect the server.

share|improve this question
1  
One can point out that, if you're sticking to a LTS version of Ubuntu, Hardy is on php 5.2 and Lucid is on a slightly not-quite-shiny-new 5.3.2. There are similarly "old" versions of mysql server in the standard Ubuntu LTS repos. RHEL5 came out a year before Hardy, so it's not surprising that it's on php 5.1. RHEL and Ubuntu LTS are built for package stability. If you want something more up to date, use Fedora or non-LTS Ubuntu. –  cjc Jan 28 '12 at 2:26

3 Answers 3

CentOS is a DERIVATIVE of the very conservative Red Hat Enterprise Linux, so package updates will generally be delayed even further than RHEL. Packages in either distribution are going to be a little older.

If you're running CentOS 5, you ought to try CentOS 6 to see if it suits your needs.

If you need something a little more cutting-edge than CentOS 6, you should look into Fedora.

share|improve this answer
1  
The amount of misinformation in this thread is absolutely stupefying. CentOS 5 has contained PHP 5.3 for over a year now, but it's not the default-installed version because of ABI concerns. yum install php53 will get you on your way. –  jgoldschrafe Jan 28 '12 at 1:49
    
True. I decided to teach him how to fish instead of giving him a fish. And I suppose it was in fact slightly snarky, but I've had a couple hours of sleep in 36 and won't be sleeping much this weekend either due to SPOF outage. –  Magellan Jan 28 '12 at 1:53
2  
@jgoldschrafe - I'd suggest writing an answer of your own - that would be more productive than just commenting with corrections. –  EEAA Jan 28 '12 at 1:57
    
It is a dedicated server at a hosting company. Personally I would have wanted to have the server on our property, but the boss felt safer this way. I wonder why the hosting company would install CentOS 5.7 instead of the latest. –  Buttle Butkus Jan 28 '12 at 2:05
3  
@jgoldschrafe, to me the question, didn't seem to be specifically about the php version. It sure seems like the question was about the conservative release policies, which I think the post tries to answer. I think it is a strech to call this miss-information. –  Zoredache Jan 28 '12 at 2:08

They're not outdated; they're the latest that CentOS 5 has in its repositories.

Red Hat (and Ubuntu for that matter) never, ever publish a new major version of software into their package repositories for a given OS version, for the sake of stability - you don't want to run an upgrade and suddenly have your config not work.

Instead, they backport security fixes and important bugfixes into the version of the software that was 'stable' when the OS was released, avoiding the introduction of new features (and their bugs).

Since you're on CentOS 5, the official repositories have some fairly old versions of stuff. But fear not - you can probably easily find a third party repository with the versions of software that you need.

Or, why not upgrade to 6?

share|improve this answer
    
This isn't completely true -- PHP 5.3 is in the core repos and you just need to yum install php53. –  jgoldschrafe Jan 28 '12 at 1:47
1  
@jgoldschrafe Good call. Though it looks like a third party repo may still be needed for newer MySQL. –  Shane Madden Jan 28 '12 at 1:51
    
"Or, why not upgrade to 6?" Better question is why did SingleHop give us 5.7 on the server? @jgoldschrafe will that replace installed packages or do I have remove them manually? –  Buttle Butkus Jan 28 '12 at 1:58
    
CentOS 6 became available only a few months ago. If the box was ordered earlier last year, it would have been 5.7. If you have an option to re-image the machine with CentOS 6, you certainly can do that. –  cjc Jan 28 '12 at 2:34
    
@cjc It was just ordered about 2 weeks ago. I've already FTP'ed about 80GB so I think it would be easier to just make this installation work. I'm trying to use what jgoldschrafe recommended: yum install php53, but it doesn't work because php is already installed. –  Buttle Butkus Jan 28 '12 at 2:52

I'd say uninstall CentOS and install Ubuntu, if that's what you want to use. But it must be an older version of CentOS you use. CentOS 6.2 uses PHP 5.3 and MySQL 5.1.

You can use Remi repository to get newer versions of Apache/PHP/MySQL

And you don't make your CentOS machine work more like Ubuntu, because it is not Ubuntu. It's like saying "How do I make my Chrysler drive more like a Ford".


Updated response:

I got some down votes on this, so I think my intentions has been misunderstood, let me try to correct that.

I have set up a VPS in our environment and installed the packages, so I should be where you are at right now:

[root@centos5 /]# cat /etc/issue
CentOS release 5.7 (Final)
Kernel \r on an \m

[root@centos5 /]# rpm -qa |grep php
php-common-5.1.6-27.el5_7.4
php-mysql-5.1.6-27.el5_7.4
php-cli-5.1.6-27.el5_7.4
php-pdo-5.1.6-27.el5_7.4
php-5.1.6-27.el5_7.4

In my first response, I assumed you wanted the latest releases, then you should use the Remi repository as I have stated above. However, if the PHP 5.3 version within centOS is fine (5.3.3) then read on.

When trying to install php53 it complains that there is a conflict, since this package will cover the same things as the PHP 5.1 package. To solve this you need to remove all PHP related packages to begin with:

[root@centos5 /]# yum remove php*
[root@centos5 /]# rpm -qa |grep php
[root@centos5 /]# 

Next thing you do is to install the equivalent packages with php53:

[root@centos5 /]# yum install php53 php53-cli php53-mysql
[root@centos5 /]# rpm -qa |grep php
php53-common-5.3.3-1.el5_7.5
php53-cli-5.3.3-1.el5_7.5
php53-pdo-5.3.3-1.el5_7.5
php53-5.3.3-1.el5_7.5
php53-mysql-5.3.3-1.el5_7.5

So, PHP was quite easy. But MySQL is another story, since MySQL 5.0 is the only MySQL in the default CentOS repositories. I run the 64 bit version of CentOS, if you do not you need adjust the following to fit 32 bit instead.

There are several ways of doing this but I'm gonna go with the Remi repository. It's been around for years and maintaining is easier with a repo than using plain RPM files.

Remi requires the EPEL repository so start by installing that:

[root@centos5 /]# rpm -Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
Retrieving http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
warning: /var/tmp/rpm-xfer.lvLBMJ: Header V3 DSA signature: NOKEY, key ID 217521f6
Preparing...                ########################################### [100%]
   1:epel-release           ########################################### [100%]

Next, you install the Remi repo RPM

[root@centos5 /]# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
Retrieving http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
warning: /var/tmp/rpm-xfer.ztjinG: Header V3 DSA signature: NOKEY, key ID 00f97f56
Preparing...                ########################################### [100%]
   1:remi-release           ########################################### [100%]

Next you remove the current MySQL server (otherwise you will get conflicts when trying to install the new one).. NOTE! If you have databases on there, make a backup before doing this!

[root@centos5 /]# yum remove mysql*

Then you can go on and install the MySQL from the Remi repository:

[root@centos5 /]# yum --enablerepo=remi install mysql.x86_64 mysql-server.x86_64

Now when you try to start MySQL it may fail because the old mysql left some things behind, and this can be kind of painful to get rid of. In my case here I needed to remove some things to get it working. These did it for me:

# rm -rf /usr/share/mysql
# rm -rf /var/lib/mysql
# yum --enablerepo=remi reinstall mysql-libs
# /usr/libexec/mysqld --skip-grant &
# mysql_install_db
# /etc/init.d/mysqld stop
# /etc/init.d/mysqld start
share|improve this answer
    
Welp, it's basically a question of whether or not there is a way to get up-to-date packages rather than out-of-date packages. –  Buttle Butkus Jan 28 '12 at 2:06
    
@ButtleButkus I don't know if you get notified when I update so I'm writing a comment to make sure you do :) –  Frands Hansen Jan 28 '12 at 10:25
    
Just saw your update. I did solve the problem and your answer looks like it might match what I ended up doing. Need to double-check my notes though. –  Buttle Butkus Jun 28 '12 at 2:50
    
There are a couple more sources for up-to-date rpms. Rackspace IUS iuscommunity.org/pages/About.html and webtatic webtatic.com/projects/yum-repository –  txyoji Nov 14 '13 at 23:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.