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: ,

44 Comments

iUnknownG
Jan 18, 2009 at 16:34

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?


 
EvolutionCrazy
Jan 18, 2009 at 19:11

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
Feb 8, 2009 at 14:24

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
Feb 20, 2009 at 18:15

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
Feb 20, 2009 at 19:32

Hi,

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


 
EvolutionCrazy
Feb 21, 2009 at 01:00

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
Mar 10, 2009 at 20:24

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!


 
EvolutionCrazy
Mar 10, 2009 at 20:47

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

greetings


 
dalem
Apr 19, 2009 at 17:04

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 :)


 
EvolutionCrazy
Apr 19, 2009 at 17:07

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

ty for the add ;)


 
dalem
Apr 19, 2009 at 17:41

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


 
EvolutionCrazy
Apr 19, 2009 at 17:47

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

ty ;)


 
slavutich
Apr 20, 2009 at 21:39

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 :-(


 
EvolutionCrazy
Apr 20, 2009 at 21:53

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
Apr 20, 2009 at 22:05

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
Apr 21, 2009 at 17:20

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. :-)


 
EvolutionCrazy
Apr 21, 2009 at 17:33

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


 
EvolutionCrazy
Apr 21, 2009 at 17:36

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/


 
EvolutionCrazy
Apr 23, 2009 at 00:31

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
Jul 15, 2009 at 19:18

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 0×83

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


 
EvolutionCrazy
Jul 15, 2009 at 22:01

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
Jul 15, 2009 at 23:32

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

JJG


 
EvolutionCrazy
Jul 16, 2009 at 01:11

you’re welcome :)


 
Kitty
Sep 18, 2009 at 19:00

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


 
bago
Nov 3, 2009 at 14:41

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!


 
EvolutionCrazy
Nov 3, 2009 at 14:49

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 ;) )


 
bago
Nov 3, 2009 at 15:11

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


 
bago
Nov 4, 2009 at 10:25

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).


 
bago
Nov 4, 2009 at 11:20

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
Jan 19, 2010 at 22:20

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

Thanks a lot!


 
EvolutionCrazy
Jan 20, 2010 at 01:41

you are welcome :)


 
ricola
Feb 15, 2010 at 09:55

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
Jun 17, 2010 at 14:29

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


 
EvolutionCrazy
Jun 17, 2010 at 14:37

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
Jun 17, 2010 at 14:49

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


 
EvolutionCrazy
Jun 17, 2010 at 14:53

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
Oct 10, 2010 at 21:31

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 ?


 
EvolutionCrazy
Oct 14, 2010 at 01:49

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
Dec 6, 2012 at 13:29

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 ?


 
EvolutionCrazy
Dec 6, 2012 at 13:43

Hi,

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


 
helix
Dec 6, 2012 at 14:18

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


 
EvolutionCrazy
Dec 6, 2012 at 14:19

sure.
add: evolutioncrazy :)


 
helix
Dec 6, 2012 at 17:35

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


 

[…] wanted to upgrade your remote CentOS server and didn’t have time to get to it, simply use this method for installing CentOS 6 via VNC on […]


 

Reply

You must be logged in to post a comment.

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