Remote Upgrade from RedHat 7.3 to 9

Remote Upgrade from RedHat 7.3 to 9

Marion Bates and William Stearns

The usual procedure for upgrading a computer's operating system is, you backup your data, boot off the new OS CD, and click "install" and wait. With RedHat Linux, this tends to work remarkably well. But what if the system you want to update is a remote server, say, six hours' drive away, and your only access is via remote shell? If you have Debian Linux, you simply run "apt-get install dist-upgrade" and wait. But even on a non-Debian system, it can be done. The process is a tad more complex however. ;)

This is a rough guide -- your procedure will vary depending on which packages you have/want, and if you tend to install things from source, this procedure will be of little help to you.

NOTE: Nov 14, 2003: Someone has reported a segfault problem with RPM itself after upgrading the bash package. We are investigating, but consider yourself warned.

1. BACKUP EVERYTHING FIRST!

2. Open four terminal windows as root. DO NOT CLOSE OR LOGOUT FROM NOW ON, OR YOU WILL NOT BE ABLE TO LOG BACK IN.

3. Go into the mirrors dir:

	cd /pub/mirrors/redhat/pub/redhat/linux/9/en/os/i386/RedHat/RPMS/

4. Run this script (copy and paste). You'll need its output later:

	( for X in *.rpm ; do rpm -qp --provides $X ; rpm -qpl $X ; echo "==== Above provided by $X" ; done ) > ~/PROVIDES

5. Start with glibc. Try to install the *.i686.rpm packages whenever possible. But if they don't work, go with the i386 ones.

	rpm -Uvh glibc-2.3.2-11.9.i686.rpm glibc-common-2.3.2-11.9.i386.rpm glibc-devel-2.3.2-11.9.i386.rpm binutils-2.13.90.0.18-9.i386.rpm 

If that works, move on to another package.

	rpm -Uvh bash-2.05b-20.i386.rpm 

Hey! This is going to be a breeze. Let's do openssl next:

	rpm -Uvh openssl-0.9.7a-2.i686.rpm openssl-devel-0.9.7a-2.i386.rpm openssl-perl-0.9.7a-2.i386.rpm 

Uh-oh...unsatisfied dependencies. This is where it gets hairy. If the format of the message is

	newer-foobar >= 3.5.2 is needed by new-barfoo
or
	an-old-version-of-foobar is needed by an-old-version-of-barfoo
then look for a RH 9 package called foobar-x.x.x.i386.rpm or whatever, and add it to the command line and try again. You will get this sort of message in a lot of cases where you have foo-package and foo-package-devel -- each needs the same version of the other, so you need to upgrade them simultaneously.

If the format of the message is:

	foobar is needed by barfoo
with no version info, then barfoo is probably not its own package, but rather is included in another package. This is where your PROVIDES file comes in handy. In one of your other terminals, type:
	less ~/PROVIDES
Search for the dependency it asked for by typing slash-depname-return:
	/
	depname
	(return)
when you find it, then search for the next occurrence of four dashes:
	/
	====

The package listed on that line provides that resource. Add that package to command line and try again.

Be careful about searching the PROVIDES file for names with non-alphanumeric characters -- those may get interpreted by less, and you won't find your filename. Try searching for partial name in those cases, or figure out how to quote/escape the funky characters.

Repeat those steps about four hundred times until it stops whining about dependencies. You will probably end up with a command line not unlike this, at which point you will begin to wish for a quick death. But hang in there.

If, along the way, something complains about version numbers and thinks your old version of foobar is newer than the one you KNOW to be newer, then you can add --force to the command -- but do this only if the version mistake is the SOLE REMAINING ERROR (in other words, resolve any other dependencies first):

	rpm -Uvh --force blahblah.rpm...

When it FINALLY succeeds, go on to the next package...and repeat. It won't be nearly as bad, since you've already installed so many libraries etc.

When you think you're finished, you aren't. :) Run:

	rpm -qai | less 
and upgrade everything you care about that has an install date earlier than today.

Additional RPMs I ended up installing.

And if you want to stick with redcarpet:

	cd /pub/mirrors/ftp.ximian.com/redcarpet/redhat-9-i386/
	rpm -Uvh rc-1.4.1-0.ximian.6.1.i386.rpm rcd-1.4.1-0.ximian.6.1.i386.rpm 
	/etc/init.d/rcd (re)start
	rc channels
	rc sub redhat-9-i386
	rc sub redcarpet
	rc refresh
	rc update -y

Now you have to merge some key config files. RPM is smart, and doesn't overwrite your old config files with new versions; rather, if it sees an existing config, it installs a clean new config called "nameofconfig.rpmnew." In many cases, your old config will work just fine, and you needn't do anything. But you should at least compare the old and the new (try "diff oldfile newfile") to see if there are major syntax changes and such. In the case of Apache, you definitely have to use the new file, or the server will not start. Check the readmes for the program in question.

These are some of the config files I had to merge with new rpm versions:

	/etc/httpd/conf/httpd.conf 
	/etc/httpd/conf.d/php.conf
	/etc/php.ini
	/etc/inittab
	/etc/group
	/etc/aliases
	/etc/ssh/sshd_config
	/etc/rndc.conf
	/etc/pam.d/other
	/etc/pam.d/system-auth
	/etc/mail/sendmail.cf 
(In the case of sendmail, I moved my old sendmail.mc and reinstalled the sendmail-config package which made a brand-new sendmail.mc. I then edited that for my server's needs, and ran m4 sendmail.mc > sendmail.cf to make a new sendmail.cf.)

Try

	cd /etc
	find . -iname *.rpmnew
to find others.

Other notes/tips/caveats: