Archive

Posts Tagged ‘Remote’

Reinstalling CentOS 5.6 remote

June 7th, 2011 No comments

Download images and add entry to Grub boot loader. Make sure you put in the right networking values:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
cd /boot
mkdir centos5-x86_64
cd centos5-x86_64
wget http://mirror.leaseweb.com/centos/5.6/os/x86_64/isolinux/initrd.img
wget http://mirror.leaseweb.com/centos/5.6/os/x86_64/isolinux/vmlinuz
/sbin/grubby
  --add-kernel /boot/centos5-x86_64/vmlinuz
  --initrd=/boot/centos5-x86_64/initrd.img
  --args="ip=x.x.x.x netmask=y.y.y.y gateway=z.z.z.z dns=n.n.n.n
    ksdevice=eth0
    method=http://mirror.leaseweb.com/centos/5.6/os/x86_64/
    lang=en_US
    keymap=us
    vnc
    vncpassword=foobar
    headless"
  --title="CentOS Reinstall"

Assuming the new Grub entry is the first one (0), ask Grub to boot pick it next reboot:

1
echo “savedefault --stage2=/boot/grub/stage2 --default=0 --once” | grub --batch

Now cross your fingers, pray to your preferred deity or lack thereof and reboot. If your karma is good, the server should come up in a few minutes. Now connect to it with the VNC client of your choice. Example:

1
vncviewer x.x.x.x:1

If you’re lucky, you should be presented with something along the lines of this:

Now it’s all up to you. Based on my experience, I recommend making good use of RAID and LVM and keep your /root and /home partitions separate, but it’s all up to you. Be careful though – once you’ve started messing with the partition table, your disk is wiped and there is no way back – you have to finish the installation before you can give the remote reinstall another go.

CentOS 5 Remote Reinstall over VNC

January 14th, 2010 3 comments

So you want to live your life on the edge, and do a remote reinstall of your server? The reasons can be many – maybe the server was compromised, or – like me – you just received a freshly installed new system with a horrible disk partitioning or maybe even the wrong choice of architecture. I’ll show you how! :-)

I just received my dedicated server at bulk price, but unfortunately also with a bulk installation of CentOS. It’s fitted with two 250G disks, yet there is no mirroring or anything installed. On top of this, this delicious 64-bit system was running a 32-bit operating system. I was not amused. Asking for a special reinstall would probably cost me a fortune in support, and even then I probably wouldn’t get it exactly like I wanted it.

Luckily most new Linux distributions feature remote installation via VNC. If the system is already running Linux – like this one – its both easy and safe to play around with this method. In this example, we’ll be installing CentOS 5.4 x86_64.

Step 1: Get a hold of the bootstrap files. This includes the Linux kernel image and the ramdisk image. Put these on your /boot partition:

$ cd /boot
$ mkdir centos5-x86_64
$ cd centos5-x86_64
$ wget http://mirror.leaseweb.com/centos/5.4/os/x86_64/isolinux/vmlinuz
$ wget http://mirror.leaseweb.com/centos/5.4/os/x86_64/isolinux/initrd.img

Step 2: Add an entry to the Grub boot loader. Adjust values for network (ip, netmask, dns, gateway) and pick a better VNC password than me. Copy the “root (…)” line from a working entry:

title CentOS 5 VNC Install
root (hd0,0)
kernel /centos5-x86_64/vmlinuz vnc vncpassword=foobar headless ip=1.2.3.4 netmask=255.255.255.0 gateway=1.2.3.1 dns=2.3.4.5 ksdevice=eth0 method=http://mirror.leaseweb.com/centos/5.4/os/x86_64/ lang=en_US keymap=us
initrd /centos5-x86_64/initrd.img

Step 3: Ask the Grub boot loader to boot your new entry next time, and only next time. This makes a lot of sense if your hosting facility allows you to power cycle the server remote – and they should. Really. If you can’t do this yourself, at least you can have some support drone push the reset button if the server doesn’t come up. Note what number your new entry in the Grub configuration file has. First one is 0, second is 1 etc. I had two entries already, so that made my new entry number 2:

$ echo “savedefault –stage2=/boot/grub/stage2 –default=2 –once” | grub –batch

Step 4: Reboot and be patient. Some servers take up to five minutes to come back up – probably because of a BIOS misconfiguration. Anyway, reboot it:

$ reboot

Step 5: Connect to your server with your favorite VNC client. Mine’s Chicken of the VNC :-) You’ll need to connect to port 5901, which in VNC-terms often is referred to as “Display 1″. Use the password you specified:

vnc

Step 6: Run the install ;-) After this, your neat remote installation will be wiped, so double check all your network settings.

install

Good luck! :-)