ius-community team mailing list archive
-
ius-community team
-
Mailing list archive
-
Message #00312
making 'yum install php-foobar' work with php53u and php52
I find it annoying to have to figure out what version of PHP one is running so you can modify your yum install command to install some module for that version. For example, if you have php53u installed, running yum install php-foobar will fail since it tries to install the default version of PHP from RHEL/CentOS, you have to change it to 'yum install php53u-foobar' instead.
There is a way to work around this, if you make it so yum can only see your desired version of PHP, you can run 'yum install php-foobar' and it will install php53u-foobar for you automatically.
To do this for PHP and MySQL, you need to use exclude and includepkgs to restrict yum to only seeing your desired version of PHP and MySQL:
* add 'exclude=php* mysql*' to each section in /etc/yum.repos.d/CentOS-Base.repo
* add 'exclude=php* mysql*' to each section in /etc/yum.repos.d/ius.repo
* add a new section to /etc/yum.repos.d/ius.repo for PHP, changing php53u to your desired version:
[ius-php]
includepkgs=php53u*
name=IUS Community Packages for Enterprise Linux 5 - $basearch - PHP
#baseurl=http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/$basearch
mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
* add a new section to /etc/yum.repos.d/ius.repo for MySQL, changing mysql51 to your desired version:
[ius-mysql]
includepkgs=mysql51* mysqlclient15
name=IUS Community Packages for Enterprise Linux 5 - $basearch - MySQL
#baseurl=http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/$basearch
mirrorlist=http://dmirr.iuscommunity.org/mirrorlist?repo=ius-el5&arch=$basearch
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/IUS-COMMUNITY-GPG-KEY
The reason for having separate mysql and php sections is you can can add the 'exclude=php* mysql*' to the normal ius section and still be able to draw in packages like python31, rsyslog4, etc. If you used includepkgs=php53u* you wouldn't be able to use any of those packages. If you don't care about other packages, you could skip the extra steps for the ius-php and ius-mysql sections and just use 'includepkgs=php53u* mysql51* mysqlclient15' .
Anyways, with the above set up, you can then run 'yum instal php mysql' and yum will pull in the php53u package and the mysql51 pacakges. Likewise, if you run 'yum install php-imap' it will automatically pull in php53u-imap for you. This makes it much easier IMHO to install stuff, no more figuring out what version of PHP you have installed. It also avoids people panicking, getting confused by error messages, or making mistakes because they don't understand how to deal with multiple versions of PHP being available to yum. When they run yum install php-foobar and it installs php52-foobar they're not going to bat an eye, whereas when they get the error message about some packing conflicting with a file from another package, they can easily get confused and panic of the mysterious error message.
To upgrade or downgrade versions, you just have change the includepkgs lines to reflect your newly desired version and run the usual commands.
---
Mark McKinstry
Follow ups