Friday, February 09, 2007

Yum, PHP and Xen running 32bits on a 64bit machine.

My host Xen server is an AMD 64bi machine. The little Xen VMs are based on CentOS 4.4 32bit, which I plan to keep it as such to allow easy migration. However it comes with abit of risk.

I managed to run 'yum install httpd mysql mysql-server' without any problems. But when I needed to install PHP, typing in 'yum install php' would result in a horrific set of errors which look like this:

Error: Missing Dependency: libgssapi_krb5.so.2()(64bit) is needed by package openssl
Error: Missing Dependency: libdl.so.2()(64bit) is needed by package openssl

etc...

which indicates that yum has detected the 64bit nature of the host arch, as 'uname' gives it away.

So how do I force yum to install only i386 binaries? Simple, RTFM! 'man yum' ... somewhere in the middle of the documentation, it states:
Specifying package names
A package can be referred to for install,update,list,remove etc with any of the following:

name
name.arch
name-ver
name-ver-rel
name-ver-rel.arch
name-epoch:ver-rel.arch
epoch:name-ver-rel.arch

For example: yum remove kernel-2.4.1-10.i686
So to get php to install nicely, just type:

yum install php.i386

and it works!

[Update: 5 minutes later.
It kinda worked. there was a problem at the end of the installation. Yum complained that 'package php-pear-4.3.9-3.22 is intended for a x86_64 architecture'. So "no problem," I thought, "I just apply what I learnt to php-pear by using 'yum install php-pear.i386'"
No. yum resolved that php needed more stuff like openssl, and decided to look for the 64 bit installation. I tried my luck and did this:

yum install php-pear.i386 php.i386

on the reasoning that I should also force yum to install only i386 archs for these two items. Surprisingly, it kept all the dependencies to i386, and it resolved it well.

So NOW it works.]

yk.

1 lewser:

Anonymous said...

Your ability to install both arch's really depends upon your repos. Would you mind listing what your repos are?

For example, I get:
yum install bzip2.i386
Loading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* update: mirror.linux.duke.edu
* base: ftp.linux.ncsu.edu
* addons: mirror.trouble-free.net
* extras: repo.bioinformatics.upenn.edu
Setting up Install Process
Parsing package install arguments
No package bzip2.i386 available.
Nothing to do

With repos like: mirrorlist=http://mirrorlist.centos.org/?release=5&arch=x86_64&repo=os

http://centos.mirror.aussiehq.net.au/5/os/x86_64/CentOS/

As you can see this repo doesn't have bzip2.i386 or php.i386.