This page is an archive of my old blog. Please visit for my current blog.
This site is no longer being maintained and commenting is disabled.

RHEL 4 as a Webserver – Part 1

I have had so many requests for this article, I decided to move it from our internal wiki to the blog. So many people are running RHEL 4 and feel like it is too difficult to get PHP 5 and MySQL 5 on to the machine. This article shows that it is easier than you think - all thanks to the CentOS repositories. A little light command line work, a few downloads, and we are up and running.

1. After a clean installation, you will need to modify your repositories for up2date.

  1. cd /etc/sysconfig/rhn
  2. cp sources sources.original
  3. vi sources

Edit the file to have the following repositories (the CentOS 4 Repositories):

  1. yum centos4-Base$ARCH
  2. yum centos4-Updates$ARCH
  3. yum centos4-extras$ARCH
  4. yum centos4-addons$ARCH
  5. yum centos4-centosplus$ARCH/

2. Next, you will need up import the key for the CentOS Repositories.

  1. rpm --import

3. Next, you will have to fix an error with the up2date program to get it work with these repositories. [More Detailed Information]

  1. cd /usr/share/rhn/up2date_client/
  2. cp
  3. vi

Edit the file at line 649:


  1. del self.packagesToUpdate[pkey]

And being sure to preserve the tabs of the original line replace it with:

  1. if pkey != "kernel-smp":
  2. del self.packagesToUpdate[pkey]

4. Now you can use up2date to get selective packages. Now we need to update Apache.

  1. up2date -u -v httpd

5. Now we need to install the new version of MySQL. As of this article, MySQL packages are available specifically for RHEL 4 on the MySQL Website. You will need (at a minimum) the mysql-server and mysql-client rpm's. Now we will need to remove MySQL 4.x and a dependancy.

  1. rpm -e mysql mysqlclient10 cyrus-sasl-sql

6. Now we can install the new MySQL Packages (replace these file names with the ones you downloaded in previous step).

  1. rpm -ivh MySQL-server-standard-5.0.27-0.rhel4.x86_64.rpm MySQL-client-standard-5.0.27-0.rhel4.x86_64.rpm

7. Now we need to re-install the cyrus-sasl-sql package from the RHN Source List (not the CentOS source list).

  1. cd /etc/sysconfig/rhn/
  2. cp sources sources.centos
  3. cp sources.original sources
  4. up2date -u -v cyrus-sasl-sql

8. Now we can update PHP. However, we will have to switch back to the CentOS Repositories for this.

  1. cd /etc/sysconfig/rhn/
  2. cp sources.centos sources
  3. up2date -u -v php php-mysql php-bcmath php-dba \
  4. php-dbase php-devel php-eaccelerator php-gd php-imap \
  5. php-ldap php-mbstring php-mcrypt php-mhash php-ncurses \
  6. php-odbc php-pdo php-pear php-pecl php-readline php-snmp \
  7. php-soap php-tidy php-xml php-xmlrpc

9. Restart Apache

  1. service httpd restart

10. Run a phpinfo() check to ensure everything is working properly. Place this file in your web root.

  1. <? phpinfo(); ?>

Put the URL for that file in your browser, and you should see that it is running PHP 5 and MySQL 5.

11. Lastly, let's put everything back the way it was before the changes to the repositories.

  1. cd /etc/sysconfig/rhn/
  2. cp sources.original sources
  3. cd /usr/share/rhn/up2date_client/
  4. cp
  5. cp

2 Responses to “RHEL 4 as a Webserver – Part 1”

  1. Beatiful spoken..I am in sunc with your post

  2. Royal Kubsch says:

    I am definately gonna subscribe, this is soo interesting, love your thoughts.