Archive for November 10th, 2008

This totally saved my life this weekend. I destroyed one of my servers trying to upgrade from CentOS4 to 5 remotely. FYI, just don’t. A fresh install is much safer. So here I am, upgrade failed, most of the binaries on the system were missing. I could not even ls, or cp. This server is 260 miles away from me, BTW. Luckily I could ftp and tar, so i pulled binaries from another server, and was able to get my vi and wget working. After going on irc, someone provided me with this link on how to install your OS from a remote location using the PXE image file.

installing-centos-4-from-a-remote-location

It is actually very simple to do, but this is how…


mkdir /newsystem
cd /newsystem
wget http://mirror.centos.org/centos/5.2/os/i386/images/pxeboot/initrd.img
wget http://mirror.centos.org/centos/5.2/os/i386/images/pxeboot/vmlinuz
cp vmlinuz /boot/vmlinuz.cent.pxe
cp initrd.img /boot/initrd.img.cent.pxe

This will copy the pxe boot images to your /boot directory to boot off of.

Edit your grub.conf in my case


title CentOS (pxe)
root (hd0,0)
kernel /vmlinuz.cent.pxe vnc vncpassword=yourPass headless ip=192.168.1.2 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.1.1 hostname=test.mydomain.com ksdevice=eth0 method=http://mirror.centos.org/centos/5.2/os/i386/ lang=en_US keymap=us
initrd /initrd.img.cent.pxe

if your default=0, make sure it is the first title. DOUBLE AND TRIPLE CHECK YOUR WORK, because after you reboot if its not correct, this box wont be coming back online. If it is a very remote box, this will suck. so reboot after you are sure everything is good, open a ping window so you know when it can come back. You can use nmap to see when the vnc port is open. Once it is up and listening, use a VNC viewer to connect to 192.168.1.2 :5901 or whatever your ip is. You should be at the CentOS install screen, and ready to reload your system! Good luck, it may take a while depending on your connection speed. This is a good way to upgrade boxes remotely without having to drive to the datacenter. I have done it on a few machines since, and I have had no issues yet.

Comments No Comments »