Upgrading Red Hat 9 to CentOS 4.5

It’s been a few months since I last posted an entry to my blog. Life has been busy. This blog has been busy, in terms of web traffic to my Anonymous Letters and Starbucks posts below.

Time for a tech post. I had the privilege of upgrading an ancient Red Hat 9 Linux box to CentOS 4.5. Red Hat Linux has been EOL for a very long time, and was superceded by Fedora, which has had seven major releases. That’s the equivalent of running Windows 3.1 😉 Well, not quite :) Anyhow, the box at hand appeared to be a custom web server. I will outline the steps I used to successfully upgrade it to CentOS 4.5.

1. Download the CentOS 4.5 CD set or DVD image from www.centos.org.
2. Put in CD 1 or the DVD image.
3. Reboot the old Red Hat 9 box and ensure that the BIOS allows booting from the CD/DVD drive.
4. Enter the following at the linux boot prompt and press Enter: linux upgradeany
5. The system will happily hum along while Red Hat 9 is upgraded to CentOS 4.5.
6. If ‘yum’ wasn’t installed, you will need to install it:
rpm -ivh http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm
rpm -ivh http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm
rpm -ivh http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm
rpm -ivh http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm
rpm -ivh http://centos.arcticnetwork.ca/4.5/os/i386/CentOS/RPMS/yum-2.4.3-3.el4.centos.noarch.rpm

7. Now, run the following command and press Enter: yum update
8. Allow yum to run and update the required packages. Reboot if yum downloads and installs a new kernel.
9. Since the box in question had a custom Apache and PHP configuration, I reinstalled them manually:
yum install httpd
yum install php
yum install mysql
yum install mysql-server
yum install php-mysql

10. I had to update the MySQL configuration to point to the correct socket:
Update my.cnf:
socket=/var/lib/mysql/mysql.sock
instead of
socket=/tmp/mysql.sock
and add the following to use your existing database passwords
old_passwords=1
11. Copy any required PHP extensions to new system path:
cp -R /usr/local/lib/php/extensions/* /usr/lib/php4
12. Edit /etc/php.ini:
error_reporting = E_ALL & ~E_NOTICE
extension=mysql.so

13. Finally, set services to start up automatically:
chkconfig –level 345 httpd on
chkconfig –level 345 mysqld on
chkconfig –level 345 sendmail on

14. There you have it. The server should be happily running CentOS 4.5 now. Remember to keep it up-to-date by running yum update regularly.

Now Running Ubuntu Server 7.04

I finally decided to upgrade my Ubuntu Server 6.10 install to the latest version, 7.04 (Feisty Fawn). Out of habit, I now wait a few weeks before upgrading to the latest version of anything to ensure any last minute bugs get worked out.

Best of all, I upgraded the entire OS remotely using SSH. Upgrading your OS remotely is usually not a good idea, but if you know what you’re doing, go for it! Ensure you backup any custom/modified configuration files just in case you press a wrong key during the upgrade! :) The upgrade worked well, with the exception of recompiling eAccelerator (to work with PHP 5.2.2) and updating a line (see below) of code in WordPress to make everything work smoothly.

Immediately following the upgrade, I noticed that my WordPress blog was loading very slowly and I also noticed random strings of hexadecimal characters at the top of the main blog page.

If you upgrade your server to Ubuntu Server 7.04 and run WordPress 2.1.x, ensure that you change line 832 in wp-includes/functions.php to the following (all on one line):

@header($_SERVER[“SERVER_PROTOCOL”].” “.$header.” “.$text, true, $header);

Once you make the above change, your blog should load normally.

Update (5.15.2007):

With WordPress 2.2 (released today), the aforementioned WordPress fix is now irrelevant.

Configuring Ubuntu – Part 2

Opps. I just checked a few of my older blog posts and quickly realized I neglected to post part 2 of my ‘Configuring Ubuntu – Part 1’ guide.

Well, here it is!

By default, Ubuntu Server installs MySQL and PHP. However, it doesn’t tweak the system for performance. If you run a WordPress blog on your server, you may not realize that your blog could run more efficiently. WordPress relies on both PHP and MySQL. PHP scripts need to be read from a server’s hard drive, parsed by the web server software and then executed. Wouldn’t it be nice if the server could just skip the first two steps and just execute PHP scripts as quickly as plain HTML?

That’s where eAccelerator comes in. eAccelerator is a free, open-source PHP accelerator and cache. I’ve been using it for nearly seven years on personal and commercial servers. In other words, it’s very stable for a free product.

Let’s get started.
Continue reading “Configuring Ubuntu – Part 2”

Upgrading Ubuntu Server 6.06 to 6.10 (Edgy)

On October 26, the Ubuntu team released a new version of Ubuntu, 6.10 (aka Edgy). I waited a couple of days for them to work out any last minute bugs, and decided to proceed with the upgrade today.

In the Ubuntu 6.10 / Edgy release notes, Ubuntu recommends the following procedure to upgrade from Dapper to Edgy:

# apt-get dist-upgrade && apt-get dist-upgrade

That will not work. Why? Because sources.list needs to be updated first (and apt-get update needs to be run beforehand).

Continue reading “Upgrading Ubuntu Server 6.06 to 6.10 (Edgy)”

Configuring Ubuntu – Part 1

Once I had Ubuntu Server 6.06.1 installed on my new web server, I quickly realized it needed several changes before I could put it online. Hence, this is the first installment in a series of blog entries to help others configure their systems.

If you installed from a CD-ROM and have a working network connection to your Ubuntu system, you should update the sources.list file used by apt-get so that your system won’t prompt you to insert the Ubuntu CD-ROM each time you install a new package:

1. Log in to your system via the console.
2. Run the following command: sudo vi /etc/apt/sources.list
3. Add a # before the following line (use cursor keys to put cursor in front of the line and then press i, followed by #) :

deb cdrom:[Ubuntu-Server 6.06.1 _Dapper … restricted

4. Save sources.list by pressing ‘Esc’, followed by the following sequence of characters to write the file and exit: :wq

Continue reading “Configuring Ubuntu – Part 1”

Bye Old Server. Hello New Server.

My web server was down for most of yesterday, for reasons out of my control.

I shelled in only to see one error message upon restarting the Apache web service: Segmentation fault. I checked the last few lines of Apache’s error_log only to see many more errors related to the same problem. It’s one of most dreaded messages one can receive on a Linux box, aside from the dreaded ‘kernel panic’.

A segmentation fault usually means one of two things in the Linux world: a software fault or a hardware fault. So, I set out to determine what the underlying cause was.

Continue reading “Bye Old Server. Hello New Server.”