Remote CentOS 6 install with VNC

Posted by EvolutionCrazy on Oct 21, 2008 in howto |

*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 :P 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

Tags: ,

  • iUnknownG

    very useful tutorial. I have an EG Max but can’t get this to work. The server responds to pings but rejects VNC connections.

    I enter the boot information using vi /boot/grub/menu.lst but I noticed that it created that as a new file… I assumed this is normal?

  • http://evcz.tk EvolutionCrazy

    yeah that file should be created from scratch…

    it’s very strange that ping is ok but vnc isn’t :/

    which vnc client are you using?
    I tried with ultravnc…

    try to open it with:
    xx.xx.xx.xx:1

  • iUnknownG

    tried ultravnc and tried it with the IP:1, IP:0 and IP to connect to.

    no success.

    I hired someone to build a custom kernel for me instead with openvz/centos in order to run HyperVM (which was my aim).

  • HooD

    Same problem with an EG BestOF (intel Xeon Quad), responds to ping but vnc is not working, nmap shows no open ports, i think there is a problem with my menu.lst (maybe because i changed it to match my 64bits arch and lang to es_ES.

    i will try later with lang=en_US keymap=en but it doesn´t seems to be the real problem…

    Anyway, thanks for such great How-To.

  • HooD

    Hi,

    On vKvm i see a kernel panic while booting pxe… :(

  • http://evcz.tk EvolutionCrazy

    vkvm doesn’t count it’s bugged (centos 5.2 “standard” (the one that comes on the installations cds) kernel CANNOT boot into vkvm)

    maybe you could try to ask to OVH if they can check out what it’s printing on the screen while it’s replying to ping but without open ports :/

    eventually you can contact me via IM so we can try something :(

  • HooD

    Hi,

    At last, i´ve reinstalled the server using the f***ing ovh kernel, and have to deal with kernel ooms, and server hangs with pleskbackup… i will try next month with another EG and ask ovh to check what the screen shows.

    I will tell you something if i found the error.

    Thanks!

  • http://evcz.tk EvolutionCrazy

    good :)
    contact me eventually when you can start doing some test again :)

    greetings

  • dalem

    Nice little How too worked like a champ

    Just a suggestion to those who don’t have console access
    it would be advisable leave your current kernel as default in case you make a mistake
    (“I did” I forgot I had a boot Partition and of course it would not boot)
    run

    --------------------------------------------------------
    #grub 
    grub> savedefault --default=0 --once
    ---------------------------------------------------------

    that way if you mess up you can reboot to your old kernel and fix what you messed up :)

  • http://evcz.tk EvolutionCrazy

    yeah, without KVM or other netboot options your advice is *REALLY* usefull ;)

    ty for the add ;)

  • dalem

    for some reason the post above it removed the dash 1 more before default & one before once. moderator please correct

  • http://evcz.tk EvolutionCrazy

    they were there, it was just wordpress not showing them… should appear ok now ;)

    ty ;)

  • slavutich

    The same things for me – cannot connect using vnc client. Connection refused :-(
    Did every step you described, only changed centos version in the URL (pointed to 5.3).
    When changed boot method from kvm to hd, even cannot ping the server.

    No luck with OVH :-(

  • http://evcz.tk EvolutionCrazy

    I got that problem lately with a box that was working perfectly in the past…

    I didn’t investigate a lot… and I didn’t re-tried a 5.2 on that box…

    If you can, give a try with a 5.2 image:
    http://mirror.intergenia.de/centos/5.2/os/i386/images/pxeboot/

    PS: wait, why kvm??? the problem I had recently on a box was VNC not working… but ping was ok

  • slavutich

    Used vKVM just to check what’s happening.
    Couldn’t see anything, because connection was closed during the booting process.
    After that switched to ordinary boot. :-)
    Anyway, thanks for the links, will try again, but not sure about the results.
    It seems that whether I’m doing something wrong, or OVH totally mixed the distro.

  • slavutich

    Your new version doesn’t work either.
    After reboot I can ping the box, but connection is closed by remote side.
    It would be great from your side, if you can debug this situation.
    Anyway, thanks for your nice howto and support. :-)

  • http://evcz.tk EvolutionCrazy

    well the best way to debug this is to leave the box online pinging and open a ticket @OVH asking what it’s saying on the console

  • http://evcz.tk EvolutionCrazy

    ADD: there’s a tool called kickstart that can be used to let the box do the reinstall without using vnc:

    http://www.linuxtopia.org/online_books/centos5/centos5_installation_guide/centos5_ch-redhat-config-kickstart.html

    something interesting about kickstart usage can be found in this script:
    http://www.atomicrocketturtle.com/Joomla/content/view/139/29/

  • http://evcz.tk EvolutionCrazy

    ok guys… this evening I’ve spent some time playing with a non OVH box … that one had KVM…. and was alywas giving a kernel panic error after trying i915_configure….

    turned out it was this bug:
    https://bugzilla.redhat.com/show_bug.cgi?id=445592

    set video memory to 8mb and everything solved…………. (previosly ping was ok but no vnc…..)

    (mobo was an asus p5e-vm)

  • jjg

    I am not an OVH user … but I have been using grub and followed the instructions … box rebooted but I get the following –

    Booting ‘Centos Install (PXE)’

    root (hd0,0)
    Filesystem type is ext2fs, partition type 0x83

    kernel /boot/vmlinuz.cent.pxe vnc vncpassword=test120 headless ip=192.168.0.120 netmask=255.255.255.0 gateway=192.168.0.1 dns=4.2.2.2 ksdevice=eth0 method=http://ftp.hosteurope.de/mirror/centos.org/5/os/i386/ lang=en_US keymap=us

    Error 15: File not found

    Is this a partition problem ? The box is just using standard partitioning from previous centos install.

    Here is my grub.conf –

    # grub.conf generated by anaconda
    #
    # Note that you do not have to rerun grub after making changes to this file
    # NOTICE: You have a /boot partition. This means that
    # all kernel and initrd paths are relative to /boot/, eg.
    # root (hd0,0)
    # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00
    # initrd /initrd-version.img
    #boot=/dev/sda
    default=0
    timeout=5
    splashimage=(hd0,0)/grub/splash.xpm.gz
    hiddenmenu
    title Centos Install (PXE)
    root (hd0,0)
    kernel /boot/vmlinuz.cent.pxe vnc vncpassword=test120 headless ip=192.168.0.120 netmask=255.255.255.0 gateway=192.168.0.1 dns=4.2.2.2 ksdevice=eth0 method=http://ftp.hosteurope.de/mirror/centos.org/5/os/i386/ lang=en_US keymap=us
    initrd /boot/initrd.img.cent.pxe
    title CentOS (2.6.18-92.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-92.el5 ro root=/dev/VolGroup00/LogVol00
    initrd /initrd-2.6.18-92.el5.img

    All comments appreciated – JJG

  • http://evcz.tk EvolutionCrazy

    as grub told you: “you have a /boot partition” :P

    in your grub.conf change

    kernel /boot/vmlinuz.cent.pxe

    to

    kernel /vmlinuz.cent.pxe

    and

    initrd /boot/initrd.img.cent.pxe

    to

    initrd /initrd.img.cent.pxe

    let me know if that works ;)

  • jjg

    Yes … that was it. Great process … save me **^%* Thanks !!!

    JJG

  • http://evcz.tk EvolutionCrazy

    you’re welcome :)

  • Kitty

    This didn’t work at all for me :(

    Using a Netdirekt box with a CentOS 5.2 install

    I copied the files and edited the grub config – But nothing worked – There aren’t even any logs in dmesg to give me a clue what’s wrong

  • http://digg.it bago

    I just tried this with a Kimsufi 3XL and Centos 5.4 64 bit with no luck.
    The host doesn’t even ping when I start it.

    I tried almost anything with no luck.

    I also tried installing with vKVM and the feature to boot from a netboot iso using the centos netboot iso and adding “text” to the linux params I’ve been able to do a full text install on the vKVM environment. Unfortunately once I reboot the host doesn’t ping.
    I also tried starting in rescue and making sure that every reference to hda was now sda and reinstal grub from rescue with no luck, again!

  • http://evcz.tk EvolutionCrazy

    install via vkvm cannot be done :(

    post an lspci

    additionally if that’s an empty box and you have some time to test you can contact me on skype (evolutioncrazy) to do some testing…

    (when using 64 pxe images make sure to adapt also “method=http://ftp.hosteurope.de/mirror/centos.org/5/os/i386/” to “method=http://ftp.hosteurope.de/mirror/centos.org/5/os/x86_64/” otherwise stage2 wouldn’t be loaded ;) )

  • http://digg.it bago

    I used the correct method= (x86_64).
    ok, just added you on skype :-)

  • http://digg.it bago

    So, I found that on Kimsufi 3XL this method does not work.
    The problem is the ethernet card in the K3XL that is not supported by the centos pxe kernel.

    Manually adding the eth driver to the pxe initrd let me install but once the install is complete and it reboots it does not have ethernet again, and there is no way to fix it (hd boot doesn’t work, netboot doesn’t work, vkvm doesn’t work. Adding the kernel module from the rescue mode doesn’t work either).

  • http://digg.it bago

    K3XL, just did it.
    1) PXE initrd must be patched to indlude the atl1.ko module (from elrepo)
    2) Complete install
    3) Reboot in rescue-pro
    4) From rescue pro mount your root and “download” its initrd and patch it to include the atl1.ko. (rescue-pro does not include the needed tools)
    5) Reboot.

    Note that adding the atl1.ko module to the PXE initrd means adding it to modules.cgz (cpio gzipped) and to the modules-info and modules.alias files, while adding it to the last initrd means adding it to the lib folder and change the init file to insmod it.

    Decompress a centos 5.4 initrd: gzip -dc /boot/initrd-XXXX.img | cpio -ivd
    Recompress a centos 5.4 initrd: find . | cpio -o -H newc | gzip -9 > /boot/initrd-XXXX.img

  • juangake

    Worked like a charm. Tested on OVH server “SP-09 SSD”, Intel Core i5, CentOS 5, the 64 bit version :D

    Thanks a lot!

  • http://evcz.tk EvolutionCrazy

    you are welcome :)

  • ricola

    Mate Thank you so Much.

    This Is Great Tuto i have Tested on C-05G Before 10 Minutes
    It works Great!

    CentOS Sucessfully Installed. Via VNC Remote Method.

    Thank you.

    PS. If you need Web-Hosting contact me.

  • brai

    Hello,
    This is great . You make a difficult task so simple. After completion it asks for “Reboot” and start in Centos Install (PXE) mode. What to do ?

    Thanks in Advance

  • http://evcz.tk EvolutionCrazy

    Hi brai.

    If after the reboot it’s still booting the pxe kernel it means that the centos install didn’t properly wrote the grub boot loader or you have a network boot (or something else) taking over the centos install…

    Re-try maybe specifing something different on the grub bootloader section during the install (try to place it on another partition…)

  • brai

    Hi,

    i found there is only pxe entry in /boot/grub/menu.lst
    and after boot from grub i found os is updated. this indicate up gradation was successful . I think now we have to do some changes in menu.lst or something else ?
    Please guide.

    Thanks

  • http://evcz.tk EvolutionCrazy

    ehm…

    if you had a previous centos installation (maybe 5.4) when booting the pxe it will asks you if you want to:

    – upgrade existing installation (what I think you did)
    – install the operating system from scratch (what this guide should be handy to :P)

    if you do not need the data on that box and can format/re-image it I highly suggest you to do again the pxe install choosing the NEW INSTALLATION ;)

  • joek

    Hello,

    It has worked before on OVH i7-4T the same method is now not working hardware cheks all done.

    Booting Very fine but when i arrive at the step to start the installations it formats the drivers sucessfully then it says: starting process etc.. then nothing happens and the box hangs up.

    Tested CentOS, 5.0 , 5.4, 5.5 = Not Working * Worked Before on Same Node *
    Tested: CentOS 4.8 = Working * Tested Today *

    Why is CentOS 5.5 not working now but before 2 weeks it worked with the same method ?

  • http://evcz.tk EvolutionCrazy

    hi joek

    that sounds very strange… I would say: impossible (unless you got something changed at the bios level…)

    I suppose you already left the box in “starting process” for at least 15mins just to be sure it wasn’t a mirror problem…
    A thing I would try would be passing a different mirror to the boot command line (maybe even the OVH internal one: http://mirror.ovh.net/ftp.centos.org/ )

  • helix

    Hi EvolutionCrazy, I got an OVH box Intel Core i5-2400 i686, i have tried many time installing Centos 5 from the mirror using VKVM every time it boots up server hangs up when I login in vkvm booting via hdd i cant see any issue with the install. I am going to try your method but the thing is I have Software Raid on the drives can i keep that intact or would i need to recreate during reinstall ?

  • http://evcz.tk EvolutionCrazy

    Hi,

    centos installer should be able to keep the raid intact… but I advice to recreate it ;)

  • helix

    Mate, I tried the above with i386 image server is not responding to ping..can i add you on skype ?

  • http://evcz.tk EvolutionCrazy

    sure.
    add: evolutioncrazy :)

  • helix

    Guy is a genius, server reinstalled perfectly without any issues. Thank you for your help Mate.

  • Pingback: Remote CentOS 6 Install with VNC | Tech Guru()

Copyright © 2014 evcz.tk All rights reserved. Theme by Laptop Geek.