I’ve figured out a decent way to remotely upgrade Redhat/Fedora systems without requiring anyone to physically touch the remote system (ie, no boot disk, etc). I came up with this procedure to upgrade some DNS servers at work. They’re in several different cities, and any on site support staff is usually busy with their own work, and seldom have any Linux knowledge.
I’ve tested this procedure upgrading several different versions of Redhat to Fedora Core2:
1) Mirror all of the files from the the Fedora CD (or appropriate directory of the Fedora FTP site) to a local file server. Share those file via anonymous FTP.
2) The files used to boot the version of linux for the installer are in the directory /isolinux of the install tree. Copy the kernel file (vmlinuz) and the initial ramdisk (initrd.img) to the /boot directory of the target machine (the one you’ll be trying to upgrade).
3) create a kickstart file to automate the upgrade. The kickstart file is necessary to tell the install program (anaconda) where to find the RPMS, whether to use DHCP, etc. Copy the kickstart file to the /boot directory of the target machine.
A sample kickstart file can be found here.
4) edit the /etc/grub.conf file on the target machine to tell it to boot from the kernel and initial ramdisk that we copied from the install media. The lines to append to grub.conf will look something like this:
kernel /boot/upgrade-vmlinuz ks=hd:hda1:/boot/ks.cfg vnc vncconnect= ramdisk_size=8192
In the above example, I copied the vmlinuz file to /boot/upgrade-vmlinuz and the initrd.img to /boot/upgrade-initrd.img. I’ve also passing some command line arguments to the kernel that will be passed to the install program. The first of these, “ks=hd:hda1:/boot/ks.cfg” tells the installer to load our kickstart file from /boot/ks.cfg on hard drive partition hda1. The commands “vnc vncconnect=” tells the installer to use VNC to connect back to my workstation to display the progress of the installation. This part isn’t strictly necessary, but I find it handy to be able to watch the progress of the install. It’ll also allow you to see a lot of possible errors (like not enough diskspace). The ramdisk command may or may not be necessary. I read some newsgroup postings that recommended it.
5) Tell grub to use the “Upgrade” config we just created at the next reboot. The grub boot configurations are numbered from the top of the config to the bottom, starting at 0. So if our config is the second one in the file, it would be config #1. Enter the grub command line by typing “grub”. Then at the grub prompt type “savedefault –default=1 –once” substituting the appropriate grub config number for 1. This tells grub to boot our new config, config #1, as the default on the next reboot, but *to return to the old default for every reboot after that*! This is important, because it means that if the installer has problems (maybe our kickstart is fubarred?) we can reboot back to our original config.
On older versions of Redhat you may get an error message from grub when you type the above command. The “–once” option to savedefault seems to be a patch that Redhat has applied to grub in their more recent distributions. If you’re using an older distribution, you may need to compile and install a more recent grub. I’ve recompiled the latest Fedora grub to work on Redhat 7.2, it may work on other versions. If you want to try it, you can download it here. Install it with “rpm -U grub-0.94-5.i386.rpm”, then run “grub-install “, ie. “grub-install hda”.
6) Start the vncviewer on your workstation “vncviewer –listen”.
7) Reboot the server. Wait nervously for it to connect to your VNC viewer.