Dec 312011
 

原文(source): How to Remote Install CentOS 6 via VNC - House of Linux

For many reasons sometimes it is necessary to reinstall a linux on a server that is hosted in a remote location such as a Data center. You might want to install a  new version of the Distribution, change the distribution, or you might need to re-partition you hard drive to be able to use LVM for example.

You have three options here:

1 - Go physically to the Datacenter

2 - Pay a datacenter guy to reinstall that for you… :(

3 - Install it Remotely using VNC

I chose the 3rd one since it seems to be the most convenient one. :-)

What do we need?

Network configuration of out server: IP Address, Gateway and DNS

If you have all those 3 informations you are good to go!
1 - Download bootstrap files (Kernel and ramdisk image).

cd /boot
mkdir centos6
cd centos6
wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/vmlinuz
wget http://mirror.centos.org/centos/6/os/x86_64/isolinux/initrd.img

Add an entry to the Grub Loader

# vi /boot/grub/menu.lst

## Add the following lines to the end of the file and count how many lines starts with tittle:

title CentOS 6 VNC Installation
  root (hd0,0)
  kernel /XXX/centos6/vmlinuz vnc vncpassword=XXX headless ip=XXX netmask=255.255.255.0 gateway=XXX dns=8.8.8.8 ksdevice=ethXXX method=http://mirror.centos.org/centos/6/os/x86_64/ lang=en_US keymap=us
  initrd /XXX/centos6/initrd.img

In my case with I had total 3 entries because I am updating a CentOS 5.6 to CentOS 6 and I had a couple update.

If we have 3 title entries there, the 3rd one should be our CentOS 6 installation but Grub starts counting the first one as 0, so our Centos 6 installation is actually 2 for grub.

 

Here is my menu.lst file:

# 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/root
#          initrd /initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-238.19.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-238.19.1.el5 ro root=/dev/VolGroup00/root
initrd /initrd-2.6.18-238.19.1.el5.img
title CentOS (2.6.18-194.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-194.el5 ro root=/dev/VolGroup00/root
initrd /initrd-2.6.18-194.el5.img
title CentOS 6 VNC Installation
root (hd0,0)
kernel /centos6/vmlinuz vnc vncpassword=houseoflinux headless ip=10.0.0.10 netmask=255.255.255.0 gateway=10.0.0.1 dns=10.0.0.5 ksdevice=eth0 method=http://mirror.centos.org/centos/6/os/x86_64/ lang=en_US keymap=us
initrd /centos6/initrd.img
Now we set our Grub to boot through our VNC installation only once so In case something goes wrong we can just call the hosting company and ask for a reboot and our server will boot through the default kernel.

# grub

grub> savedefault --default=2 --once
savedefault --default=2 --once
grub> quit

Now we are ready to reboot our machine and start the installation:

# reboot

wait… wait… depending on the hardware you have this might a while….
You can now use your preferred VNC client and start the installation process

 Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA Image

Reload Image