// you’re reading...

Tips N Tricks

Install Fedora 14 Linux without a monitor (headless), keyboard and CD/DVD

As I tweeted http://twitter.com/#!/shekharg/status/30986928094453760 sometime back, I bought a new desktop for my home. This desktop (my home server) is with 16GB of RAM and with no monitor. For the monitor, I thought of hooking it up to my TV via a VGA port (a.k.a. RGB port). The machine has a DVD writer and I also bought a keyboard for Rs. 160.

I required the TV, keyboard and DVD drive only for the one time installation of the operating system. Post the installation, I access the machine only across the network – via SSH (Secure SHell) or a web browser.

But I decided against the easy way of installation using my TV and keyboard. Instead, I challenged myself to install Fedora 14 without using a monitor, keyboard/mouse and DVD drive on the server.

vncviewer showing Fedora 14 installation across the network

vncviewer showing Fedora 14 installation across the network

In a nutshell, such an installation can be achieved via PXE boot (a.k.a. network boot) wherein the operating system is installed across the network. The installation media itself can reside on any other machine on the network. What’s more, you can even interact with the graphical interface of the installation on any networked machine.

Note that while most modern desktops and servers have network booting, at times, you may need to enable it from the BIOS. This requires a monitor and keyboard defeating the very fun. In my case, network booting was enabled by default.

At the end of this exercise, I have an up and running Fedora 14 machine installed and configured completely across the network. Following is a jot down of how did I carry out this kind of installation.

As said above, you will need another machine connected to your network or your router.  In my case, I configured my laptop running Fedora 13 to serve the installation of Fedora 14 on my home server.

The installation and configuration mentioned below are specific to Fedora 13. But most steps, especially the configuration should apply to other flavors of Linux. The overall steps are as follows:

  1. Configure the network (on the router and laptop).
  2. Install the services on the laptop to:
    • Assign IP to the home server during the network boot
    • Serve the required files to the home server to boot and start the installation
    • Serve the packages to be installed
    • Interact with the graphical installer for disk partitioning, package selection etc.
  3. Configure the services
  4. Start the services
  5. Switch on the target machine/server
  6. Wait for the graphical installer to popup on the laptop, follow the onscreen instructions and ta-da!

Configure the network
At home, I’m on a network with IP 192.168.0.x. This means, machines at my home will have IP addresses like 192.168.0.2, 192.168.0.3 and so on.

First and foremost step is to stop any DHCP service, which provides dynamic IPs to machine. This is because the laptop will act as the DHCP server (as explained later). In my case, a D-Link DIR-615 router (with IP 192.168.0.1) is serving dynamic IPs. I logged into the router using a web browser and disabled DHCP by unchecking Enable DHCP Server (found under Setup>Network Settings).

Since DHCP is disabled, setup a static IP address for the laptop. This can be done via a Linux command line or console using the following command:

ifconfig eth0 192.168.0.2

To save yourself from added troubleshooting, disable any running Firewall and SELinux as follows:

service iptables stop

SELinux was already disabled on my laptop. For more on disabling SELinux refer to http://www.crypt.gen.nz/selinux/disable_selinux.html

Install the services
Install the required services as follows:

 yum install dhcp syslinux tftp-server httpd tigervnc

dhcp is the DHCP server which will serve dynamic IP to the server during PXE boot. syslinux provides the files required for booting. tftp-server (TFTP Server) will serve the boot files (provided by syslinux) and the kernel for the server to boot and start the installation. httpd (Apache Web Server) provides the Fedora 14 packages to be installed. tigervnc (TigerVNC) will be used to display the graphical installer on the laptop.

Configure the services: DHCP
To configure DHCP, open the file named dhcpd.conf found in the directory /etc/dhcp and modify it as follows:

subnet 192.168.0.0 netmask 255.255.255.0{
 range 192.168.0.10 192.168.0.20;
}
allow bootp;
filename "pxelinux.0";

Save the file.

Configure the services: TFTP Server
In a text editor, open the file named tftp found in /etc/xinetd.d and change the line:

server_args = -s /var/lib/tftpboot

to:

server_args = -s /var/lib/tftpboot -v -v -v

Appending “-v -v -v” will provide more information about the TFTP Server in /var/log/messages file which useful for troubleshooting. Next, change the line:

disable = yes

to:

disable = no

After the above modifications, the tftp file will look as follows:

# default: off
# description: The tftp server serves files using the trivial file transfer \
#	protocol.  The tftp protocol is often used to boot diskless \
#	workstations, download configuration files to network-aware printers, \
#	and to start the installation process for some operating systems.
service tftp
{
	socket_type		= dgram
	protocol		= udp
	wait			= yes
	user			= root
	server			= /usr/sbin/in.tftpd
	server_args		= -s /var/lib/tftpboot -v -v -v
	disable			= no
	per_source		= 11
	cps			= 100 2
	flags			= IPv4
}

Save the file.

Next, copy the files named chain.c32, mboot.c32, memdisk, menu.c32 and pxelinux.0 found in the directory /usr/share/syslinux/ to /var/lib/tftpboot directory:

cd /usr/share/syslinux
cp chain.c32 mboot.c32 memdisk menu.c32 pxelinux.0 /var/lib/tftpboot

Create a directory named pxelinux.cfg (yes, it is a directory with .cfg suffix) under /var/lib/tftpboot. Under the directory /var/lib/tftpboot/pxelinux.cfg, create a file named default with the following content:

default Fedora 14
timeout 0

MENU TITLE PXE Menu

LABEL Fedora 14
        KERNEL images/fedora/14/vmlinuz
	APPEND initrd=images/fedora/14/initrd.img lang=en_US keymap=us vnc vncconnect=192.168.0.2 ip=dhcp method=http://192.168.0.2/fedora/14/

Here the IP address 192.168.0.2 is the IP address of my laptop (as setup in the section Configure the network)

Create a directory tree images/fedora/14 under /var/lib/tftpboot:

mkdir -p /var/lib/tftpboot/images/fedora/14

We also need to copy two files from the Fedora 14 CD/DVD into this directory. This is explained in the next section.

Configure the services: Apache Web Server
As explained above, Apache Web Server will serve the packages to be installed. For this, we will download and mount Fedora CD/DVD under the directory /var/www/html (the default document root of the web server). Create a directory tree named fedora/14 under /var/www/html as:

mkdir -p /var/www/html/fedora/14

Next, download Fedora 14 DVD or CD ISO from http://fedoraproject.org/en/get-fedora-all. I wanted to do only a base install of Fedora 14 on the server. For this only the first CD of Fedora is required. So I downloaded Fedora-14-x86_64-disc1.iso from here.

Mount the downloaded DVD/CD ISO as:

mount -t auto -o loop <path-to-downloaded-iso> /var/www/html/fedora/14

In my case:

mount -t auto -o loop /home/shekhar/Downloads/Fedora-14-x86_64-disc1.iso /var/www/html/fedora/14

Copy the files named initrd.img and vmlinuz found in the directory /var/www/html/fedora/14/images/pxeboot to /var/lib/tftpboot/images/fedora/14.

Start the services
Next, open a Linux terminal or console window and start the services as follows:

service dhcpd restart
service xinetd restart
service httpd restart
vncviewer --listen

Connect the server to the network/router and switch it on. Within a minute you should be able to see the graphical installer on your machine (laptop in my case). Follow the onscreen instructions and you should end up with a successful Fedora 14 installation on the server.

Note that while we didn’t attach a monitor and keyboard for the installation, we didn’t even burn a CD/DVD! We let Apache serve the packages via the mounted ISO.  Plus, with Kickstart you can even have an unattended and automatic installation without interacting with the graphical installer.

PS: Once the installation is done, don’t forget to stop the DHCP server on your machine (service dhcpd stop) and start the DHCP service on your router.

GD Star Rating
loading...
GD Star Rating
loading...
Install Fedora 14 Linux without a monitor (headless), keyboard and CD/DVD, 9.6 out of 10 based on 8 ratings
Share

Email This Post Email This Post Print This Post Print This Post Print This Post Post A Comment Tweet your comments/question to me @shekharg

Discussion

9 comments for “Install Fedora 14 Linux without a monitor (headless), keyboard and CD/DVD”

  1. Awesome, thanks very much. Works with Fedora 15 too.

    Posted by David Bowen | May 26, 2011, 12:52 am
  2. Thanks for the informative writeup. Here is how I did something similar, but with a USB stick:

    1: Put the installer onto a USB stick.
    $ sudo livecd-iso-to-disk –reset-mbr –format Fedora-15-x86_64-DVD.iso /dev/sdc

    2: Mount it.
    $ cd /mnt
    $ sudo mkdir usb
    $ sudo mount /dev/sdc1 usb

    3: Edit extlinux.conf.
    Reduce timeout from 60 seconds to 10 seconds.
    Append lang, keymap, vnc to kernel command line.
    $ cd usb/syslinux/
    $ sudo vi extlinux.conf

    $ cat extlinux.conf
    default vesamenu.c32
    #prompt 1
    timeout 100

    label linux
    menu label ^Install a new system or upgrade an existing system
    menu default
    kernel vmlinuz
    append initrd=initrd.img lang=en_US keymap=us vnc

    4. Insert USB stick into a port on the target system.
    Restart the target system.
    From the client ping the target system until it replies to pings.
    $ ping 192.168.0.103

    5. Start a vnc client.
    $ vncviewer 192.168.0.103:1

    Posted by Steve | May 28, 2011, 9:52 pm
  3. The installer by default puts the boot loader onto the USB stick instead of the target drive. There is a menu to select the boot loader device.

    I recovered without reinstalling to the USB stick with:

    $ sudo cat /usr/share/syslinux/mbr.bin > /dev/sdc

    Posted by Steve | May 28, 2011, 10:36 pm
  4. Appending “sshd” in extlinux.conf allows you to connect with “ssh [email protected]” during the install or use the USB stick as a rescue device.

    append initrd=initrd.img lang=en_US keymap=us vnc sshd

    If you have files that need to be rescued on logical volumes, the volume group may need to be activated:
    # vgs
    # vgchange -a y vg_pluto
    # cd /tmp
    # mkdir cedar_root
    # mount /dev/mapper/vg_pluto-lv_cedar_root cedar_root

    Posted by Steve | May 29, 2011, 1:49 am
  5. [...] Install Fedora 14 Linux without a monitor (headless), keyboard and CD/DVD: http://www.shekhargovindarajan.com/tips-n-tricks/install-fedora-14-linux-without-a-monitor-headless-… [...]

    Posted by Удаленная установка CentOS или Fedora | Supportex.net | June 13, 2011, 12:55 pm
  6. [...] * Install Fedora 14 Linux without a monitor (headless), keyboard and CD/DVD: http://www.shekhargovindarajan.com/tips-n-tricks/install-fedora-14-linux-without-a-monitor-headless-… * Installing Fedora Using PXE Images: [...]

    Posted by How to Install CentOS or Fedora Remotely | Supportex.net | June 22, 2011, 6:55 am
  7. Great idea. Can this be done with windows xp. I have the same stup as u but I’m having some trouble installing xp on it. Can u give me some instructions on how to do it. Thanks

    Posted by Matt Hatcher | August 24, 2011, 5:32 pm
  8. @matt. This can be easily done on Windows too. But you will need another machine with Windows Server and RDS running. This will allow you to remotely deploy Windows XP, Vista or 7 to the target machine
    .

    Posted by Vinod Unny | September 14, 2011, 5:10 pm
  9. Didn´t work on my system maybe there have no network boot enabled but without monitor i can´t enabled it.

    My system is complet headless without any grafik output and no pcie slot.

    Posted by Guest | December 20, 2011, 12:18 am

Post a comment

Recent Tweets

Follow Me on Twitter