Installing Linux over network (no CDROM drive)

Wednesday, 9 January 2008, michuk

Installing Linux is trivial nowadays. You just need to download ISO image, burn it on CD/DVD and reboot the machine. But, what if… the computer doesn’t have a CD drive? Well, don’t worry. In such case you can install Linux directly through the net. This is called PXE and in this article you’ll learn how to use it.

Author: Borys Musielak

The problem — although it does not concern all of us — is not taken from outer space. It actually exists even in case of modern laptops, like Thinkpad X61, which lack a CD drive to save on weight. Installing Linux over network is one of the few options in such case. But it is handy also in more conventional situations. It’s generally faster (downloading and installing can be done in parallel), cheaper (you don’t need to burn a CD/DVD) and of course ozone-friendly :)

Well, so let’s get it working then! Here is what you need:

  • a computer connected to Internet (called from now on: the server) with any distribution of GNU/Linux installed (I used a Debian system here),
  • second computer (the client) on which we want to install Linux, it needs to be placed in the same network as the server and its BIOS need to provide a network boot option (usually called PXE),
  • files needed for netboot,
  • about one hour free,
  • pizza and coke.

Download netboot files

Netboot is tiny installation image, usually a single file, which is used to load the essential installation modules and connect to the Internet to download the rest of the installation files and packages. It is usually downloadable for any install-worthy distributions. It should be also located on the real installation ISO, especially in catalog called netboot.

Netboot for Ubuntu 7.10 can be downloaded (do this on server computer of course) by issuing the command: wget http://archive.ubuntu.com/ubuntu/dists/gutsy/main/installer-i386/current/images/netboot/netboot.tar.gz. Next you need to unpack it: tar zxf netboot.tar.gz and place in a selected catalog. In our case it is /home/johnny/netboot.

The procedure is similar for any other distribution, however I won’t help you with the localization of the netboot image. Fortunately, my friend knows the answer and all you need to do is ask him for it. She’ll help.

Preparing a TFTP server

The installation files need to be shared over network. It’s usually done via a TFTP which is a very lightweight protocol implemented by most of the PXE environments. So, we’re going to install the following packages on the server machine:

# apt-get install tftpd-hpa xinetd

When installed, TFTP server needs to be configured so that it points to the correct files needed by the client. Let’s create a file /etc/xinetd.d/tftp and fill it with something like this:

service tftp
  {
        disable                 = no
        socket_type             = dgram
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -v -s /var/lib/tftpboot
        only_from               = 192.168.1. 127.0.0.1
  }

Please watch the last line, though: only_from. Here you should put all the subnets over which you want to share your files. Usually the local network (192.168.1.*) and the local machine (for testing) is fine. If your network configuration is different, you need to adjust this line to fit your needs. If you don’t know your IP, you can easily find it out by issuing /sbin/ifconfig -a in the terminal window.

The last thing to do is to actually share the files over TFTP. You can do it by copying the needed files to the shared folder of TFTP as you just configured it:

cp /home/johnny/netboot/* /var/lib/tftpboot/

Of course if you are using an Ubuntu CD, just copy the files from the CD, you don’t need to download them separately:

cp /media/cdrom/install/netboot/* /var/lib/tftpboot/

Finally restart the xinetd service:

/etc/init.d/xinetd restart

And you are more or less done with TFTP. The server should be up and running, files shared over the local network. It’s time to configure DHCP now so that the client knows how to find your server machine and point to the correct installation file over TFTP.

But first get a slice of pizza, prepared beforehand. It’s cold… strange.

Setting up a DHCP server

DHCP servers are used to automatically distribute IP addresses to client computers in a network. In our case the DHCP server will also point the client to the relevant netboot file. Thanks to this we’ll be able to install Ubuntu over network without even knowing the actual location of the file.

So, let’s install DHCP server with the following command:

# apt-get install dhcp3-server

Of course this should be done on the server machine. Easy so far? Sure it is. What can be a bit troublesome is the configuration of the server. It is done via editing the file /etc/dhcp3/dhcpd.conf. Debian should have created this file for us filling it up with the default values. What we need to do is:

  • to specify the permissions (basing on IP or MAC address),
  • set up the proper DNS servers to be used,
  • and to specify the installation file that should be downloaded by the client after connecting with the server.

In my case the essential part of the dhcpd.conf file that I had to edit looks like this:

# router localization
option routers 192.168.1.254;
# network mask
option subnet-mask 255.255.255.0;
# main DNS server to be used
option domain-name-servers 194.74.65.68;

# set up if our DHCP server is supposed to be the default one in the network
authoritative;

# ping allowed
ping-check = 1;
# important! this is the location of the installation file!
filename = "pxelinux.0";
# subnet IP address
subnet 192.168.1.0
# accepted IDs in the netmask
netmask 255.255.255.0 {
range 192.168.1.10 192.168.1.254;
}

And this was enough in order for DHCP to work properly and assign the right IP addresses to the client computers in the specified local network as well as for downloading the pxelinux.0 file in the PXE mode.

If it looks good, restart DHCP server:

/etc/init.d/dhcp3-server start

and proceed with the installation!

Network installation (PXE)

On the client computer in BIOS (which we can access while rebooting the computer, usually with under keys F12, DEL or such) the first boot option should be set to network (PXE). If this is so, save the BIOS settings, reboot and… wait what happens.

If everything is OK, we should be informed that the DHCP connection has been successful, that we have been assigned an IP address and that the installation file is being downloaded from the TFTP server. In a few seconds time the default installation screen of Ubuntu (or your favorite Linux distribution) should appear. I assume that from now on you’ll be fine. If you encounter issues, first search for “ubuntu network installation” on Google. The process should be explained in detail with screenshots. In case of big trouble, use forums or IRC to find help.

If nothing happens… then… oh well… an error must have occurred. We’ll deal with it soon, but first, grab the second slice of pizza and drink some coke. Already warm… huh.

Coping with errors

If an error occurred (read: the installed did not launch), first of all, don’t panic. This is normal. You need to figure out what prevented it from loading. This is what the system logs are for! Let’s take a quick look at the syslog file on the server::

# less /var/log/syslog

and read it with understanding. The problem may have occurred in a few places: while connecting via DHCP, while downloading the file though TFTP or during the installation — for instance the package list could fail to be downloaded due to incorrect DNS settings.

Testing TFTP is trivial. Just try to connect with the TFTP server locally using a client: tftp localhost. If it works, try to get the installation file: > get pxelinux.0. Exit the program (bye) and see if the file got downloaded. If you can see it in the current folder, this means the server works. At least locally.

DHCP can be tested from a different machine (also a virtual one) by issuing a command like: dhclient eth0. If you managed to connect, it means the DHCP server works fine. If you can ping any network domain on the client machine (try ping polishlinux.org, this means the DNS works fine as well. But in this case everything works so you shouldn’t have had any problems with network installation :)

Of course it’s impossible to predict any problem. In my case the procedure worked flawlessly, except for the fact I had a typo in the DNS address and the remaining installation files failed to download forcing me to restart the installation after altering the DNS IPs in the DHCP server configuration file.

The key thing in solving issues is to think reasonably and try to exclude possible problems one by one. If you get stuck, don’t worry. Just post a comment and we’ll try to help you if you can.

Now when the system in finally being installed via PXE, you can finally eat the rest of the cold pizza and empty the warm cola bottle. Doesn’t it taste good!?

Alternative options

In the article I purposely omitted alternative options of doing the same thing. Obviously there are a lot of them (we are using Linux, aren’t we?!). You can achieve the same using multiple methods. Some of them being:

  • instead of xinetd+tftp pair you can use inetd+tftp or run tftp as a standalone daemon service,
  • using alternative TFTP implementation like atftpd…
  • use another operating system as the server (any distribution or GNU/Linux, some BSD family system or even MS Windows),
  • instead of the coke order a sprite or a mountain dew,
  • etc.

The aim of this article was simply installing a Linux distribution over the network so that you can enjoy the free operating system on a computer with no CD drive. I hope we have managed to achieve this goal together successfully.

References

Subscribe to RSS feed for this article!

23 Comments

fold this thread Freak_lick  Thursday, 10 January 2008 o godz. 4:46 pm #  Add karma Subtract karma  +1

Really helpful article!
Can’t wait to use it!

(Comments wont nest below this level)
 
fold this thread Jeff Smith  Monday, 14 January 2008 o godz. 3:55 pm #  Add karma Subtract karma  +0

Good article. I have had to use this technique before when installing Linux to a CD-less laptop. I have also used it to install a DVD-only distro to a computer with only a CD drive. After I was done, I would turn the DHCP server off. Generally I want to leave that job to my router.

(Comments wont nest below this level)
 
fold this thread Volker  Tuesday, 15 January 2008 o godz. 4:45 pm #  Add karma Subtract karma  +0

Other option: put harddrive in other laptop with cd drive, install Ubuntu, return harddrive. Needed: screwdriver and additionally some doughnuts :-)

(Comments wont nest below this level)
 
fold this thread me  Tuesday, 15 January 2008 o godz. 7:51 pm #  Add karma Subtract karma  +0

Slackware 12.0 comes with PXE network install as an option.

(Comments wont nest below this level)
 
fold this thread Lisa  Tuesday, 15 January 2008 o godz. 10:55 pm #  Add karma Subtract karma  +0

I’ve seen solutions for installing over a network many times in the last several years. All the solutions use dhcp. Is there any method or adjustment to the above instructions which allows network installation when the lan is static based instead of using dhcp?

(Comments wont nest below this level)
 
fold this thread Spanky  Tuesday, 15 January 2008 o godz. 10:58 pm #  Add karma Subtract karma  +0

Yeah, there got to be a faster, easier, newbie friendly way.

A CD boot is hard to beat (time and ease).

This is a great how-to though. PXE is interesting.

Problem #1: A computer has to boot something first. PXE is an alternative.

Problem #2: The dynamic and rapidly upgrading software one needs is in repositories on-line (first).

CD’s and DVD disks (especially HD and Blue-Ray) are only holding on (progressively speaking) for their ability to boot an install.

So, I suppose (if it’s not already done) a faster bridge between PXE and an internet “net install” might be helpful. But only for PXE enabled systems.

A CD might be that bridge but it wouldn’t offer advantage over a regular install CD.

That leaves USB. Perhaps a live USB PXE (TFTP) server, and link to the internet installable repositories would be a (time saving) solution. This requires a USB bootable (or boot floppy helped) server system for the flash drive and the PXE capable computer target for install. This, if the target machine can not itself, just boot a live USB installer (Similar to a live CD).

So we are pretty much back to a live, bootable (with Floppy disk helper for non-USB bootable boxes) because almost everything has (or can be low-cost added) a USB port. Even a slow USB 1.0 and 1.1 port could be made to work.

This way, we’re done with CD’s (BURNING!) and CD drives (size and weight). Then the USB drive used, is of course, easily re-writable and upgradeable.

As was said, NOTHING beats the time of physically pulling the hard drive and putting it temporarily into a CD installable system. But you still need to obtain the “next” (Clean install ONLY, Kubuntu 3 months AFTER it’s released, is my strong SUGGESTION) CD to install.

Hmmm, perhaps the ultimate would be a booting floppy to USB disk (for non-USB booting computers) that has a live and bootable NET-INSTALLER system on the USB flash drive. Thus you could install the new and dynamic system (upgraded too) for the Internet repositories. But this would require a special enhanced net installer for your wireless devices. Wired would be a no brainier.

(Note: One can convert another working and distance wireless connected computer, into wired; like with ICS/Firestarter, in order to do a common “net install” on another target box with wired Ethernet, that does not first have wireless drivers available.)

Not having wireless has been a drawback (compared boot CD) for the advantages (mainly time) of a “net install”.

So I say we start asking for the USB installer downloads, over the regular (CD) iso’s. Have you seen the new low prices of FAST flash drives? Have you notice the low cost of USB 2.0 add-on ports? Thus, no more out dated coasters.

Plus, a net install for bootable USB drive and with helper floppy image and wireless drivers would seem ideal and efficient. Perhaps even surviving the next release, being a net installer.

It’s all about time. That, you do not get back.

(Comments wont nest below this level)
fold this thread khushi  Monday, 19 May 2008 o godz. 2:59 pm #  Add karma Subtract karma  +0

Can you suggest any changes that are to be made in the configuration file(Syslinux) so as to make my live USB flashdrive as client of PXE server.I want to provide Boot options (like 1.Boot from my-USB 2.localboot 3.Boot from Network) as i insert my USB flashdrive into the USb port.

 
 
fold this thread Spanky  Tuesday, 15 January 2008 o godz. 11:04 pm #  Add karma Subtract karma  +0

Oh yeah, Kubuntu likes 384MB RAM, at least.

(Comments wont nest below this level)
 
fold this thread Spanky  Tuesday, 15 January 2008 o godz. 11:13 pm #  Add karma Subtract karma  +0

Also, in a related matter, I have heard of a project that lets Windows users do a simple download that would then install Kubuntu. I’m not sure how up to date it is though.

Plus, installing Windows is INSANELY time consuming. Kubuntu is about 20 minutes and with more then install, comparatively and massively more then easily available. It’s the best package management. (Pssssst, for free!)

(Comments wont nest below this level)
 
fold this thread Spanky  Tuesday, 15 January 2008 o godz. 11:19 pm #  Add karma Subtract karma  +1

It is also possible BTW to make a non-PXE bootable system PXE bootable, by using a bootable floppy or other device. They usually have floppy drives.

One might try Xubuntu but then install icewm and use it instead of XFCE for older systems (about 128MB RAM). You have the support and the upgrades but with speed again. You’ll have to tweak icewm and drive mounting though.

(Comments wont nest below this level)
 
fold this thread gvsrinivasan  Friday, 18 January 2008 o godz. 6:28 pm #  Add karma Subtract karma  +1

one small question cp /home/arun/netboot/* /var/lib/tftpboot/

arun is the name of my home directory

cp: omitting directory `/home/arun/netboot/pxelinux.cfg’
cp: omitting directory `/home/arun/netboot/ubuntu-installer’

i am unable to diagnose what have went wrong then i have also used copying it with sudo command

help needed immediately

(Comments wont nest below this level)
fold this thread michuk  Friday, 18 January 2008 o godz. 11:20 pm #  Add karma Subtract karma  +0

Do you have read access to /home/arun/netboot/ and write access to /var/lib/tftpboot? Try ls -la to see what are the current permissions.

 
fold this thread bmk789  Tuesday, 29 January 2008 o godz. 10:10 pm #  Add karma Subtract karma  +0

If you have subdirectories in that netboot folder, you will have to use “cp -R” instead of just “cp”.

 
 
fold this thread Christophe  Saturday, 26 January 2008 o godz. 5:04 pm #  Add karma Subtract karma  +0

Works Ok, but you should remember to check the permission on the tftpboot folder and its contents. The default in ubuntu is too restricted

(Comments wont nest below this level)
 
fold this thread celia  Tuesday, 13 May 2008 o godz. 5:17 am #  Add karma Subtract karma  +0

I have a home network which uses a cable modem/router with DHCP integrated. How can I adapt this hardware configuration to follow your procedure? I mean, I don’t want to mess the already DHCP service provided by the reouter, and I have a Dell laptop with no usb-aware BIOS, nor CD nor floppy drive… a small and thin laptop Latitude L400.

I will greatly appreciate your help. Thanks in advance.

Regards,
cpgt

(Comments wont nest below this level)
 
fold this thread yipcs  Wednesday, 21 May 2008 o godz. 6:48 pm #  Add karma Subtract karma  +0

How to install game-redalert, microsoft office, dreamweaver, flash in this enviroment?

anyone can guide me?

(Comments wont nest below this level)
 
fold this thread yipcs  Wednesday, 21 May 2008 o godz. 6:59 pm #  Add karma Subtract karma  +0

How about performance?

Who able provide performance with 50clients winxp connect to one linux server?

It is network performance very slow?

(Comments wont nest below this level)
 
fold this thread andrea  Saturday, 21 June 2008 o godz. 7:47 pm #  Add karma Subtract karma  +0

Thank you Borys all works fine on my eeepc!I have a question about eeeXubuntu:is it possible to install it in pxe mode?I think it is very useful for those who don’t have a cdrom or don’t want to buy it!

(Comments wont nest below this level)
fold this thread michuk  Sunday, 22 June 2008 o godz. 12:38 am #  Add karma Subtract karma  +0

Yes, it should be perfectly possible to install Xubuntu. Follow the same process as with Ubuntu. The files should in in the same location as well.

 
 
fold this thread andrea  Thursday, 18 September 2008 o godz. 5:47 pm #  Add karma Subtract karma  error

I can not find netboot.tar.gz for eeeXubuntu and for xubuntu.Do you know where i can download it?

(Comments wont nest below this level)
 
fold this thread kailas  Wednesday, 24 November 2010 o godz. 8:23 pm #  Add karma Subtract karma  +0

In my install, it didn’t work as written. I needed to actually fully restart the dhcp server

/etc/init.d/dhcp3-server restart

instead of

/etc/init.d/dhcp3-server start

thanks for the great tutorial!

(Comments wont nest below this level)
 
fold this thread top ten blenders for Smoothies  Wednesday, 5 June 2013 o godz. 3:47 pm #  Add karma Subtract karma  +0

Locations are undoubtedly communities along with Wi-Fi support and so are whether obtainable for no extra charge or
perhaps for fees. Our own Waring company logo accumulated well-liked visibility using Fred’s musical show reputation, and his awesome Waring Blender begin to arrive almost, obtaining at once claimed it is stick amongst the best mixers already in the market! Whilst you are typically weight loss you can create appetizing flavorsome regular food which means you can cherish your food consumption without requiring realising that you’ll on a diet.

Before anything else, our prime date mechanism of fruit and vegetable blenders may drainage you
see, the wheat-grass from the advantagous nutrients together with purely
remove, as we say, the dog’s precious nourishing substances. That this brand primarily that has become important to most likely the Juice-n-Server hands free operation juice extractor which takes juicing to another level by offering you’ll with hands absent from method of manufacturing a new alcoholic beverages
that you genuinely such an abundance of.

(Comments wont nest below this level)
 
fold this thread Http://Minpin.lv/vai-zinaji-ka-hansapost-lv-piedava-dazadus-monitorus  Saturday, 21 December 2013 o godz. 7:01 pm #  Add karma Subtract karma  +0

At this time it appears like BlogEngine is the top blogging platform available right now.
(from what I’ve read) Is that what you’re using on your blog?

(Comments wont nest below this level)
 
Name (required)
E-mail (required - never shown publicly)
URI

Adjust field size: shrink | enlarge)


You can use simple HTML in your comments. Some examples are as follows:
  • A hyperlink: <a href="polishlinux.org">GNU/Linux for everyone!</a>,
  • Strong text: <strong>Strong text</strong>,
  • Italic text: <em>italic text</em>,
  • Strike: <strike>strike</strike>,
  • Code: <code>printf("hello world");</code>,
  • Block quote: <blockquote>Block quote</blockquote>

Warning: include(0php’): failed to open stream: No such file or directory in /sites/polishlinux.org/wp-content/themes/jakilinuxorg/page.php on line 70

Warning: include(): Failed opening '0php’' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /sites/polishlinux.org/wp-content/themes/jakilinuxorg/page.php on line 70