Remote CentOS 6 install with VNC

*POST UPDATED – now referring to centos6*
I get in touch with many people related to centos reinstall… I’m aware in certain conditions it’s a pain to have it rolling properly…
I do this for work, just contact me if you want it done for a small fee 😉

There are some ISPs in the dedicated servers market that are offering crappy CentOS installs…

With “crappy” I mean: broken/modifed images…

The worst example I had the opportunity to try was OVH.
OVH is in general a very good dedicated hosting provider offering very nice services at an impressive low price… but they have the bad attitude to install custom operating systems that many times cannot be reverted back to the original kernels 🙁

One of them is their CentOS 5 install… Lucky for us it’s not a big problem as, most times, it’s possible to do a clean CentOS install 😉

This is a simple procedure to do an official, clean install from the genuine CentOS disks 🙂

    1. Install CentOS from the OVH manager with the default partitioning proposed by OVH
      (this procedure will work with whatever operating system you want… i suggested centos so it will report “centos” also in the ovh manger 😛 make sure you are able to get grub working on the os you want to use 😉 )
    2. once everything is done log into the box via ssh as root
    3. issue these commands:
      yum update -y
      mkdir /centos_install
      cd /centos_install
      wget http://it.centos.contactlab.it/6/os/x86_64/images/pxeboot/initrd.img
      wget http://it.centos.contactlab.it/6/os/x86_64/images/pxeboot/vmlinuz
      cp vmlinuz /boot/vmlinuz.cent.pxe
      cp initrd.img /boot/initrd.img.cent.pxe
    4. Add to/Edit the grub menu.lst entry to load the pxe kernel
      nano -w /boot/grub/menu.lst

      in that file paste:

      title Centos Install (PXE)
      root (hd0,0)
      kernel /boot/vmlinuz.cent.pxe vnc vncpassword=YOURPSW headless ip=YOURIP netmask=255.255.255.0 gateway=GATEWAYIP dns=8.8.8.8 ksdevice=eth0 method=http://it.centos.contactlab.it/6/os/x86_64/ lang=en_US keymap=us
      initrd /boot/initrd.img.cent.pxe


replace

      • YOURPSW with the VNC password you want setup (at least 6 chars long on centos5!)
      • YOURIP with the ip of the box…
      • GATEWAYIP with the gateway assigned to your boxHint: you can see the gateway ip by issuing
        route -n | grep UG

once you have done this you need to count the number of times “title” appears in the file, press ctrl +x, and save the file

  • type:
    grub

    write in there:

    savedefault --default=2 --once

    replace 2 with the number of times “title” appeared in manu.lst minus one (if you counted 6 “title” entries… write 5 in here)

  • reboot

 

After issuing the reboot ping the box (should take max 2minutes to take up the network)… 30seconds (or more… depending how fast your box is) after it starts replying to the ping open a vnc client (on windows i suggest ultravnc) and connect to

YOURIP:1

put as password the one you placed as YOURPSW …

install CentOS 🙂

Tested on:

Success

  • OVH kimsufi reloaded (Intel Celeron 220)
  • OVH kimsufi reloaded xl (Intel e2180, Asus P5VD2-VM)
  • OVH kimsufi reloaded xxl (Intel e7200, Intel DG31PR)
  • OVH SP BestOF (Intel e6750)
  • Keyweb KM 4400 DC (Intel e4500, Ati chipset IIRC)
  • Intel i5 / p55 / e1000e eth
  • OVH kimsufi Q-1T
  • OVH kimsufi i7-2T (pxe kernel modification required: instructions, needs the eth attansic module)
  • Dell R200
  • Dell R410
  • a lot others….

Known problems

  • If you didn’t follow exactly the how-to and did a custom partioning with /boot/ partition on it’s own you will have to take away the /boot/ path from the menu.lst …
  • OVH netboot kernels might no more be able to boot into your box (even without LVM… dunno… maybe I did a too “base” install…)
  • keep a vnc password short… most clients cannot auth with long passwords
  • some ISPs may block incoming vnc traffic in that case consider to use the vncconnect=host:port (instead of vnc) trigger to have the server connecting to your PC (documentation: vncconnect )
  • I had big trouble with certain servers not being able to run the CentOS 5.5 pxe install… on those I had to fall-back using the 5.4 install.. in case you want to use them you can find everything in here: http://vault.centos.org/5.4/: make sure to adjust also the mirror in the grub config file!

If not working

  • On certain images reference grub config file is /boot/grub/grub.cfg instead of menu.lst
  • If the box do not come up (ping) after the reboot… do a reimage and try over… double check the settings… expecially network settings.
  • If the box does not works (not ping reply) and you are sure networking is set correctly try to boot vkvm to see if the PXE kernel is loaded properly to exclude any problem with the bootloader.

Random things

  • http://dcantrel.fedorapeople.org/doc/vnc/VNC_Whitepaper-vnc-modes-in-anaconda.html
  • http://fedoraproject.org/wiki/Anaconda/Options
  • in this example I used the 32bit image… 64bit is exactly the same, just change the image you fetch at the beginning from the CentOS mirror and the mirror path into the grub config 😉
  • if you are running grub2 (like ubuntu 9.10) this is an example on how to set it up:
    sudo chmod +x /etc/grub.d/40_custom
    sudo nano /etc/grub.d/40_custom

    place in there something like:

    menuentry "centos.pxe" {
    set root=(md0)
    kernel /boot/vmlinuz.cent.pxe vnc vncpassword=YOURPSW headless ip=YOURIP netmask=255.255.255.0 gateway=GATEWAYIP dns=8.8.8.8 ksdevice=eth0 method=http://ftp.hosteurope.de/mirror/centos.org/5/os/i386/ lang=en_US keymap=us
    initrd /boot/initrd.img.cent.pxe
    }

    save and issue:

    sudo update-grub2