Headless VNC Install Disk

Description

This tip will show you how to modify one of the boot disks so that when started the installer will connect to a listening VNC viewer. The purpose of this disk is simple --> to be able to install a second system with centos without having to hook up a keyboard/mouse/monitor. Simply plug in power and ethernet and go (assuming the system will boot from CD).

ISO's Tested

I have personally done this with the following ISO's:

*CentOS 4.2 server CD

*CentOS 5.1/5.2 netboot

*CentOS 5.2 cd (Disk one is the only required one as the connection is already made)

*CentOS 5.3 DVD

*CentOS 6.3 minimal install CD (in process as we speak). Currently not working 100%. Does not skip disk verification.

NOTE - I see no reason that ANY one of the ISOs would not work though. Just listing what has been tested by myself.

Download ISO

The first thing you will need is one of the ISOs from the CentOS mirrors. From here on in I will refer to the downloaded ISO as "centos.iso" regardless of which one you downloaded.

- Download centos.iso into your home folder.

# cd /home/yourDirectory
# wget http://dom.com/path/to/centos.iso

Mount ISO and prep for edit

We will now mount the downloaded centos.iso so that we can copy the files into our file system to do the required edits to make this thing work.

- Issue the required commands to extract the ISO files onto your hard drive.

# mount -oloop centos.iso /mnt
# mkdir /tmp/installDisk
# cp -a /mnt/* /tmp/installDisk/
# cp /mnt/.* /tmp/installDisk/
# cd /tmp/installDisk

Edit isolinux.cfg

Now that we have the files copied onto our drive from the ISO and now we have to edit the “isolinux.cfg” file open we can now make our changes. What we will be doing is editing the “boot options” that are passed to the installer when the cd installer begins.

- Open the file with your editor of choice.

# vi isolinux/isolinux.cfg

or

# nano isolinux/isolinux.cfg

Currently the file will look something like: NOTE - CentOS 6x seems to have changed the options slightly.

default linux
prompt 1
timeout 600
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ramdisk_size=8192
label text
  kernel vmlinuz
  append initrd=initrd.img text ramdisk_size=8192
label expert
  kernel vmlinuz
  append expert initrd=initrd.img ramdisk_size=8192
label ks
  kernel vmlinuz
  append ks initrd=initrd.img ramdisk_size=8192
label lowres
  kernel vmlinuz
  append initrd=initrd.img lowres ramdisk_size=8192
label local
  localboot 1
label memtest86
  kernel memtest
  append -

- Modify it to use the various settings we need. The primary changes are:

* prompt

* timeout

* append line under the "label linux"

NOTE - Be sure to modify the IP to that of your workstation that will have a listening VNC viewer. it is a good idea to give this workstation a static to use for this purpose since this IP will be burnt into the disk.

NOTE - CentOS 6x seems to have changed the options slightly. All I changed was the PROMPT, TIMEOUT and APPEND line. In CentOS6.x, ramdisk_size was not there, so I left it out.

- Make the file match the following for a regular CD/DVD (using DHCP):

default linux
prompt 0
timeout 0
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ramdisk_size=8192 vnc vncconnect=192.168.0.100 headless ip=dhcp ksdevice=eth0 method=cdrom lang=en_US keymap=us
label text
  kernel vmlinuz
  append initrd=initrd.img text ramdisk_size=8192
label expert
  kernel vmlinuz
  append expert initrd=initrd.img ramdisk_size=8192
label ks
  kernel vmlinuz
  append ks initrd=initrd.img ramdisk_size=8192
label lowres
  kernel vmlinuz
  append initrd=initrd.img lowres ramdisk_size=8192
label local
  localboot 1
label memtest86
  kernel memtest
  append -

- CentOS 6 Example (Can easily apply to the other examples below):

default linux-vnc
prompt 0
timeout 0

display boot.msg

menu background splash.jpg
menu title Welcome to CentOS 6.3!
menu color border 0 #ffffffff #00000000
menu color sel 7 #ffffffff #ff000000
menu color title 0 #ffffffff #00000000
menu color tabmsg 0 #ffffffff #00000000
menu color unsel 0 #ffffffff #00000000
menu color hotsel 0 #ff000000 #ffffffff
menu color hotkey 7 #ffffffff #ff000000
menu color scrollbar 0 #ffffffff #00000000

label linux-vnc
  menu label ^Install over VNC
  menu default
  kernel vmlinuz
  append initrd=initrd.img vnc vncconnect=192.168.254.1 headless ip=dhcp ksdevice=eth0 method=cdrom lang=en_US keymap=us
label linux
  menu label ^Install or upgrade an existing system
  kernel vmlinuz
  append initrd=initrd.img
label vesa
  menu label Install system with ^basic video driver
  kernel vmlinuz
  append initrd=initrd.img xdriver=vesa nomodeset
label rescue
  menu label ^Rescue installed system
  kernel vmlinuz
  append initrd=initrd.img rescue
label local
  menu label Boot from ^local drive
  localboot 0xffff
label memtest86
  menu label ^Memory test
  kernel memtest
  append -

- Or if by chance you will not have a DHCP server available to you during the install, the below would be for a regular CD/DVD (using static network settings):

NOTE - Be sure to substitute in the appropriate settings (IE ip, netmask, gateway, dns, etc) for your network.

default linux
prompt 0
timeout 0
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ramdisk_size=8192 vnc vncconnect=192.168.0.100 headless ip=192.168.0.10 gateway=192.168.0.254 netmask=255.255.255.0 dns=192.168.0.254 ksdevice=eth0 method=cdrom lang=en_US keymap=us
label text
  kernel vmlinuz
  append initrd=initrd.img text ramdisk_size=8192
label expert
  kernel vmlinuz
  append expert initrd=initrd.img ramdisk_size=8192
label ks
  kernel vmlinuz
  append ks initrd=initrd.img ramdisk_size=8192
label lowres
  kernel vmlinuz
  append initrd=initrd.img lowres ramdisk_size=8192
label local
  localboot 1
label memtest86
  kernel memtest
  append -

- Or for a Netboot CD (With DHCP):

NOTE - We need to specify a URL to get our setup files from. There are a few minor changes in this one from the regular cd version.

default linux
prompt 0
timeout 0
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
F7 snake.msg
label linux
  kernel vmlinuz
  append initrd=initrd.img ramdisk_size=8192 vnc vncconnect=192.168.0.100 headless ip=dhcp ksdevice=eth0 method=http://mirror.centos.org/centos/5.2/os/i386 lang=en_US keymap=us
label text
  kernel vmlinuz
  append initrd=initrd.img text ramdisk_size=8192
label expert
  kernel vmlinuz
  append expert initrd=initrd.img ramdisk_size=8192
label ks
  kernel vmlinuz
  append ks initrd=initrd.img ramdisk_size=8192
label lowres
  kernel vmlinuz
  append initrd=initrd.img lowres ramdisk_size=8192
label local
  localboot 1
label memtest86
  kernel memtest
  append -

NOTE - It may be more polite (bandwidth wise) to have a local install source (IE one on your internal LAN) though if using a netboot cd. And well faster too.

NOTE - You can obviously combine the static example with the netboot example to make a netboot version that does not require a DHCP server.

- Be sure to save your changes and exit your editor.

As you can see I changed a few minor things like the prompt and timeout to “0”. This is because I do not want to have to do any keyboard interaction, nor would I be able to see the screen when I was asked for these prompts. This disk is just for VNC installs. So the prompts and time outs were removed. The other thing I modified was the default boot option. Now as you can see I added the options for the default boot to initialize a VNC connection to a listening viewer located on “192.168.0.100”. Obviously modify this to match your desired network. There is a vnc parameter that can be passed (in a boot option) in which you can set a VNC password on the installers VNC server - but I figured since it is on my private lan behind a firewall - what the heck. No need for it. The security concious may wish to add this parameter. The other options cover some of the default information required to be able to auto populate these values - otherwise you are prompted to fill it out. But again - no keyboard/mouse/monitor. So we pass the info here. Feel free to modify with your preferences for a different language, etc. And as you can see, there must be a DHCP server on your LAN to assign the IP to the machine targeted for installation.

- Fix a few little permissions with the following command...

chmod u+w isolinux/*

Create the new ISO

Now we are going to make the new ISO that we will burn for the new disk.

NOTE - that my final ISO name is "vncCentOS.iso" - feel free to name as desired.

# mkisofs -o ../vncCentOS.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T .

Remove the ISO's media check

We need to remove the media check from the disk, otherwise the install will never start. This little method was a dandy to track down.

- Check if you have the anaconda runtime installed.

# yum list | grep anaconda-runtime

The output from yum should tell you if it is installed.

- If you need to install it run:

# yum install anaconda-runtime

NOTE - This is just part of the regular centos repos. Now as to the tool. It is called “implantisomd5”. This tool is installed to “/usr/lib/anaconda-runtime/”.

NOTE - The location has changed in CentOS 6.x. This tool is located at “/usr/bin/implantisomd5”.

- Remove the media check:

# /usr/lib/anaconda-runtime/./implantisomd5 --supported-iso ../vncCentOS.iso

- In CentOS 6.x

# /usr/bin/implantisomd5 --supported-iso ../vncCentOS.iso

NOTE - Be sure to modify the above command if you named your ISO differently.

- Burn the ISO with your favorite cd burning software.

- Start your vnc viewer (on your workstation) in listening mode.

- Pop the cd in and boot the machine you wish to install Centos on, and install the OS as per normal.

Hope that helped. Over all this is not a hard proceedure at all. The hardest thing about it was digging all the info up from different resources, and my inexperience with anaconda in general beyond that of a regular default install.

NOTE - Be sure to test your cd with a monitor on the first time since we did disable the media check.

NOTE - It can take a bit (~ 1 - 5 minutes) for the VNC server to connect to the viewer.

Enjoy.

TipsAndTricks/VncHeadlessInstall (last edited 2012-08-17 00:12:22 by TimothyLee)