RHEL 4 as a Webserver - Part 1
April 6th, 2007
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.
-
cd /etc/sysconfig/rhn
-
cp sources sources.original
-
vi sources
Edit the file to have the following repositories (the CentOS 4 Repositories):
-
yum centos4-Base http://mirror.centos.org/centos/4/os/$ARCH
-
yum centos4-Updates http://mirror.centos.org/centos/4/updates/$ARCH
-
yum centos4-extras http://mirror.centos.org/centos/4/extras/$ARCH
-
yum centos4-addons http://mirror.centos.org/centos/4/addons/$ARCH
-
yum centos4-centosplus http://mirror.centos.org/centos/4/centosplus/$ARCH/
2. Next, you will need up import the key for the CentOS Repositories.
-
rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-centos4
3. Next, you will have to fix an error with the up2date program to get it work with these repositories. [More Detailed Information]
-
cd /usr/share/rhn/up2date_client/
-
cp packageList.py packageList.py-original
-
vi packageList.py
Edit the file at line 649:
Remove:
-
del self.packagesToUpdate[pkey]
And being sure to preserve the tabs of the original line replace it with:
-
if pkey != "kernel-smp":
-
del self.packagesToUpdate[pkey]
4. Now you can use up2date to get selective packages. Now we need to update Apache.
-
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.
-
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).
-
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).
-
cd /etc/sysconfig/rhn/
-
cp sources sources.centos
-
cp sources.original sources
-
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.
-
cd /etc/sysconfig/rhn/
-
cp sources.centos sources
-
up2date -u -v php php-mysql php-bcmath php-dba \
-
php-dbase php-devel php-eaccelerator php-gd php-imap \
-
php-ldap php-mbstring php-mcrypt php-mhash php-ncurses \
-
php-odbc php-pdo php-pear php-pecl php-readline php-snmp \
-
php-soap php-tidy php-xml php-xmlrpc
9. Restart Apache
-
service httpd restart
10. Run a phpinfo() check to ensure everything is working properly. Place this file in your web root.
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.
-
cd /etc/sysconfig/rhn/
-
cp sources.original sources
-
cd /usr/share/rhn/up2date_client/
-
cp packageList.py packageList.py-centos
-
cp packageList.py-original packageList.py



Leave a Reply