incidence

Digitalblend-CL

CentOS Package installation problems.

If you have experience working on a server, you will have encountered a failed installation of a server-side tool package at one time or another. I my case it has been various PECL packages and tools, they work great and are updated regularly on top of that they are free. But when there are problems many of these packages are a pain to deal with.

Important: I am assuming that you are using Fedora or Centos, my web host is using CentOS for the VPS.

 

When you try and install a package and it fails often you will get a message like the one below after the failed install process.

Cannot find autoconf. Please check your autoconf installation

If you are in the web-server and you encounter a error or warning like the message below, then that means the package is not installed correctly. This means you will have to reinstall the packages again. Simply put, the server is saying that the .so file and other dependencies are missing and it can't find them.

PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib64/php/modules/oauth.so'

The best way to check if a MySQL package is installed correctly is to create a phpinfo.php file and drop it into the top level director that your domain is targeting. If you load the page in your web-browser and don't see the package you installed listed on the HTML page that is created, then the install is bad.

There are several things that you can do, setup a temporary directory for the install and unmount the tmp and var/tmp folders during the install process. If you already have PECL install on your system then you can try to unmount the tmp folders and retry the install process. You can install M4 and Autoconf onto the server then retry the install of your package, if you decide to go this route, you will have to use Autoconf that is on the same site as M4 and build the installer by hand. In the most extreme case, you server does not include any of the files that are required to install packages, so you will have to install M4, Autoconf, YUM, Pear and PECL, this means you will have to do a step by step install of all these packages first before you can install your desired package.

The Temporary Directory

First off the easiest way to fix the installation error issue is to create a temporary directory for the install, in my case I am using Media Temple and this is the way they had the temporary directory structure setup.

Before you begin, you will have to check your web-host's documentation and see how they require you to setup the temporary directory.

For Media Temple GS servers

$ mkdir /root/tmpz<br />
$ mount --host /root/tmpz /tmp<br />
$ umount /tmp; umount /var/tmp<br />
$ pecl install mongo<br /> \

For Media Temple DV and VE servers

$ mkdir /root/tmpz<br />
$ mount --bind /root/tmpz /tmp<br />
$ umount /tmp; umount /var/tmp<br />
$ pecl install mongo<br />

When you are done with the install, restart apache with the following command.

/etc/init.d/http restart

Install M4 and Autoconf

The other option is to install M4 and Autoconf from www.gnu.org and then run the install process again. It is important to note that you need to use Autoconf from the M4 site for this to work, there are a number of different builds from different developers out there but for this to work you need to use both packages.

Autoconf webpage

M4 webpage

When you do the install you need to go to the /usr/src directory to do the build process, this will minimize the can't find directory error messages.

# cd /usr/src
# wget http://ftp.gnu.org/gnu/m4/m4-1.4.9.tar.gz
# tar -zvxf m4-1.4.9.tar.gz
# cd m4-1.4.9/
# ./configure && make && make install
# cd ../
# wget http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz
# tar -zvxf autoconf-2.692.tar.gz
# cd autoconf-2.62/
# ./configure && make && make install

When you are done installing these two packages, you will need to restart apache and retry the install.

Reinstall CentOS to install YUM and Pear

Lastly, if you are still having problems, then you probably don't have YUM, Pear and PECL installed. You will have to go through the process of installing YUM Pear and PECL, please remember that you should have all three of these packages installed onto your server in some form.

Centos FTP Mirror

If you have to install YUM, you will have to manually download all of the packages from the CentOS mirror server and install them one at a time via SSH using the RPM command. You will have to check your web host and get the instructions to install yum, in some cases they have the YUM installer built, all you have to do is enter rpm -qa, and that's it

Otherwise you will have to download all of the packages yourself and install them one at a time, below is a example for CentOS 5

rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/elfutils-libs-0.125-3.el5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/gmp-4.1.4-10.el5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/readline-5.1-1.1.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-2.4.3-21.el5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/libxml2-2.6.26-2.1.2.1.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/libxml2-python-2.6.26-2.1.2.1.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/expat-1.95.8-8.2.1.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-elementtree-1.2.6-5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/sqlite-3.3.6-2.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-sqlite-1.1.7-1.2.1.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/elfutils-0.125-3.el5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/rpm-python-4.4.2-48.el5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/m2crypto-0.16-6.el5.2.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/python-urlgrabber-3.1.0-2.noarch.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/yum-metadata-parser-1.1.2-2.el5.i386.rpm
rpm -Uvh http://mirror.centos.org/centos-5/5/os/i386/CentOS/yum-3.2.8-9.el5.centos.1.noarch.rpm
yum -y update

Once this is done, you can install Pear onto your server by entering yum install pear in some cases it's yum install php-pear*, when this is done, you will have to go into the php.ini file and change the include path from ".:/php/includes" to ".;/path/to/php/pear" and save the changes to your php.ini file. Once you have installed Pear you also should have installed PECL as well.

The next step is to update both Pear and PECL, then upgrade the packages and restart the server.

pear channel-update pear.php.net
pecl channel-update pecl.php.net
pear upgrade-all

When you are done, you can restart Apache. I most cases, you should have YUM installed or configured to be installed on to your server, reinstalling the YUM manager is lots of work so be advised that you are reinstalling lots of files onto your server.

If you just need to reinstall or install Pear packages again, it is just a simple task of using the Pear install ##Package Name## then restart apache when the process is done.

Definitions

PEAR: PHP Extension and Application Repository is a repository or library of code to distribute packages in PHP.

PECL: PHP Extension Community Library extensions are very similar to PEAR packages, they C programms compiled in PHP.

YUM: Yellowdog Updater, Modified is a open source package management system used on linux.

CentOS: Open source operating system commonly used on servers created from Red Hat Fedora.

Useful links