Crmgo Blog

Network Installation of Ubuntu

Network Installation of Ubuntu

Setting up the server for installation First, you will need a computer running Ubuntu or another Linux distribution (this guide is written for Ubuntu) from which you will install the system (the network boot server), as well as the ISO image of the Alternate disk with the required version of Ubuntu...

Network Installation of Ubuntu

Server setup for installation

First of all, you will need a computer with Ubuntu or another Linux distribution (this guide is written for Ubuntu) from which you will install the system (network boot server), and an ISO image of the Alternate disk with the required version of Ubuntu.

Setting up the network boot server

To boot over the network, you will need to install TFTP, HTTP, and DHCP services on the server to allow the second computer to connect and download all necessary files.

It is best to use aptitude to install everything required, as it is not included in the standard Ubuntu distribution starting from version 10.10. Therefore, first install aptitude using any package installation program or via the command

sudo apt-get install aptitude

Next, install everything else needed:

sudo aptitude -R install apache2 atftpd tftpd-hpa dhcp3-server

The key -R is needed so that atftpd installs without the inetd server, which you do not need at all.

Now it is time to configure all components.

TFTP Server

The daemon uses these files - /etc/hosts.allow and /etc/hosts.deny to restrict access.

Open the file /etc/default/atftpd in any text editor with superuser privileges, for example, like this:

sudo nano /etc/default/atftpd

Change the first line from

USE_INETD=true

to

USE_INETD=false

Also, remember the directory located at the end of line OPTIONS. It is most likely /srv/tftp, but in older Ubuntu versions it might be /var/lib/tftpboot. Edit the file /etc/default/tftpd-hpa:

sudo nano /etc/default/tftpd-hpa

enter the remembered directory

TFTP_DIRECTORY="/srv/tftp"

Now simply start atftpd:

sudo /etc/init.d/atftpd start

Now create a folder named ubuntu in the directory from OPTIONS. From now on, we will assume that the directory /srv/tftp is used:

mkdir /srv/tftp/ubuntu

After that, you need to mount your ISO image into the newly created directory. This can be done with a command like this:

sudo mount -o loop /home/tux/ubuntu-11.04-alternate-i386.iso /srv/tftp/ubuntu/
If you do not have an ISO disk image, but have a burned Alternate disk, simply insert it into the CD/DVD drive. The disk will be automatically mounted in /media/cdrom. Then you just need to create a symbolic link for the TFTP server:
sudo ln -s /media/cdrom /srv/tftp/ubuntu

That's it for TFTP configuration.

Apache Web Server

No changes to Apache settings are required; it is sufficient to make the directory ubuntu created in the previous section accessible via HTTP. To do this, create a symbolic link to it from the Apache working directory:

sudo ln -s /srv/tftp/ubuntu /var/www/ubuntu
If you are using a burned disc instead of an ISO image, execute
sudo ln -s /media/cdrom /var/www/ubuntu

DHCP Server

All that remains is to properly configure the DHCP server. Open the file /etc/dhcp3/dhcpd.conf in any text editor with superuser privileges, for example, using the command

sudo nano /etc/dhcp3/dhcpd.conf

In this file, you need to change the following settings:

# Имя вашего внутреннего домена. Если вам это ни о чём не говорит - просто не меняйте.
option domain-name "domain.ru";
# Ваш DNS сервер, который должен использоваться на подключаемом компьютере. Чаще всего тут стоит IP адрес роутера.
option domain-name-servers 192.168.0.1;
# Просто раскомментируйте эту строчку
authoritative;
 
# Теперь надо определить сеть для DHCP сервера:
# Сначала желаемая подсеть и маска подсети.
subnet 192.168.0.0 netmask 255.255.255.0 {
  # Диапазон выдачи сервером адресов
  range 192.168.0.100 192.168.0.199;
  # Роутер для доступа к интернету
  option routers 192.168.0.1;
  # Какой файл загружать при сетевой загрузке - укажите именно в таком виде.
  filename = "ubuntu/install/netboot/pxelinux.0";
}

After that, you need to tell our DHCP server to listen on one of the interfaces. To do this, open the file /etc/default/dhcp3-server and add the name of the required interface to the INTERFACES parameter. For example, like this:

INTERFACES="eth0"

Now you need to start the DHCP server and you can proceed with the installation. However, before starting, make sure there are no other DHCP servers running in your network. Most often, DHCP is running on routers; in this case, you need to log in to the router and stop this service on it.

So, to start the DHCP server, it is sufficient to execute the command

sudo /etc/init.d/dhcp3-server start

Now you need to put the second computer into network boot mode. After that, you should see the Ubuntu installation screen.

Note: This post may be AI-assisted and then human-edited. Editorial responsibility: Dmytro Lomaka, Kaltenkirchen.