An automated installation of EuroLinux Desktop via network

An automated installation of EuroLinux Desktop via network

In large environments, manually installing multiple operating systems can be time-consuming and tedious. However, the process can be fully automated. In this article, we will describe a solution for automatic, unattended installation of EuroLinux Desktop on a computer that has access to the installation server via a LAN interface.

In large environments, manually installing multiple operating systems can be time-consuming and tedious. However, the process can be fully automated. In this article, we will describe a solution for automatic, unattended installation of EuroLinux Desktop on a computer that has access to the installation server via a LAN interface.

A network installation requires the simultaneous use of three solutions: a DHCP server, TFTP and HTTP. For the purpose of this article, we will install all these servers on a single host machine (based on EuroLinux 9 or Desktop) and save the configuration of this machine as permanent. This will allow it to perform multiple automatic installations of EuroLinux Desktop in the future as well.

The following configuration is for BIOS-based clients only. To boot the client from the network, in the client’s BIOS, booting over the network must be set to the first position of the boot list and the Secure Boot option must be disabled. For some computers, the option to boot from the network may be disabled or unavailable. We will describe the option of automatic network installation from UEFI in a separate article in the future. To begin with, however, a little theory.

PXE

PXE (Preboot Execution Environment) is a solution that allows an operating system to start up on a computer even though it is not installed on it, nor does the computer/client have access to the physical installation media. Once the installation starts, the client will query the DHCP server. It will get the boot files from the TFTP server and download the installation image from the HTTP server. We will configure the DHCP server to use SYSLINUX boot images.

Preparing the ISO image

We will perform the entire following procedure as root. First, we install the web server:

dnf install -y httpd

We download the EuroLinux Desktop ISO image to the /media directory:

wget -P /media https://dn.euro-linux.com/ELD-9-x86_64-latest.iso

We add the ISO image mount point in the root directory of the web server:

mkdir /var/www/html/eld-iso && chown nobody:nobody /var/www/html/eld-iso

Let’s now add a line to the /etc/fstab file that mounts our ISO image in the newly created subdirectory:

/media/ELD-9-x86_64-latest.iso /var/www/html/eld-iso iso9660 ro,nofail 0 0

Although each of the listed servers may be running on a different physical system, the procedures in this section assume that all servers are running on a single system.

Kickstart

We will also make use of the Kickstart project, which allows unattended installation and configuration of the operating system to be performed automatically. The system will install itself automatically over the network with the following default settings:

  • the full available disk space will be used;
  • partitions will be created:
    • root /;
    •  swap;
    • /boot;
    • and on disks over 50 GB also a /home partition;
  • the default user and system password will be the word eurolinux;
  • the installation will run in graphical mode;
  • Polish system language and Polish keyboard layout will be used;
  • the Europe/Warsaw time zone will be selected.

For problems with automatic partitioning on older computers, it may be helpful to supplement the following line configuration: ignoredisk --only-use= by adding to the end the system disk used on the client, such as sda.

The following lines save the Kickstart configuration to the web server’s root directory:

cat << EOF > /var/www/html/ks.cfg
graphical
%addon com_redhat_kdump --enable --reserve-mb='auto'
%end
keyboard --xlayout='pl'
lang pl_PL.UTF-8
url --url=http://10.0.0.1/eld-iso/
%packages
@^eld
%end
firstboot --enable
clearpart --all --initlabel
autopart
timesource --ntp-disable
timezone Europe/Warsaw --utc
rootpw --plaintext --lock eurolinux
user --groups=wheel --name=eurolinux --password=eurolinux --plaintext
EOF

The HTTP, TFTP and DHCP servers

We can now start the HTTP server:

systemctl enable httpd --now

Next, let’s install TFTP and DHCP servers for pxeboot:

dnf install -y tftp-server dhcp-server

We also add services on the firewall for all newly created servers:

firewall-cmd --add-service=http --add-service=tftp --add-service=dhcp --permanent

firewall-cmd --reload

Now we can configure the DHCP server:

cat << EOF > /etc/dhcp/dhcpd.conf
option space pxelinux;
option pxelinux.magic code 208 = string;
option pxelinux.configfile code 209 = text;
option pxelinux.pathprefix code 210 = text;
option pxelinux.reboottime code 211 = unsigned integer 32;
option architecture-type code 93 = unsigned integer 16;

subnet 10.0.0.0 netmask 255.255.255.0 {
  option routers 10.0.0.254;
  range 10.0.0.2 10.0.0.253;
  class "pxeclients" {
    match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
    next-server 10.0.0.1;
      filename "pxelinux/pxelinux.0";
  }
}
EOF

We start the DHCP server:

systemctl enable dhcpd --now

Network connection

We will execute two commands to get static connections between the prepared pxe server and the automatically installed systems – after ifname we must use the network interface name of the hosting machine:

nmcli connection add con-name pxe type ethernet ifname enp0s25 ip4 10.0.0.1/24 gw4 10.0.0.1 ipv4.dns 10.0.0.1

nmcli connection up pxe

For the configuration to work correctly, it is required to copy the files from syslinux-tftpboot:

rpm2cpio /var/www/html/eld-iso/AppStream/Packages/syslinux-tftpboot*.rpm | cpio -imdv
mkdir /var/lib/tftpboot/pxelinux/
cp tftpboot/* /var/lib/tftpboot/pxelinux/
rm -rf tftpboot

and copy the kernel and init ramdisk images:

cp /var/www/html/eld-iso/images/pxeboot/* /var/lib/tftpboot/pxelinux/

We will also configure the pxelinux bootloader so that two system boot positions are displayed on the client: from the network or from the hard drive and so that the configuration points to the installer image hosted on the HTTP server.

Note: the first line creates a directory, not a file – this is not an error :)

mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg
cat << EOF > /var/lib/tftpboot/pxelinux/pxelinux.cfg/default
default vesamenu.c32
prompt 1
timeout 600

display boot.msg

label linux
  menu ^Install system
  menu default
  kernel /vmlinuz
  append initrd=/initrd.img ip=dhcp inst.repo=http://10.0.0.1/eld-iso/ inst.ks=http://10.0.0.1/ks.cfg
label local
  menu label Boot from ^local drive
  localboot 0xffff
EOF

Now we can start the TFTP server:

systemctl enable tftp --now

and the client computer. A fully automated system installation via LAN should begin.

Summary

The described solution is particularly useful for multi-workspace installation of EuroLinux Desktop. The automated installation process over the network without the use of physical media is very simple, convenient and resource-free on the part of the client. This is because multiple installations can be carried out even by a person without technical training.

Authors

The blog articles are written by people from the EuroLinux team. We owe 80% of the content to our developers, the rest is prepared by the sales or marketing department. We make every effort to ensure that the content is the best in terms of content and language, but we are not infallible. If you see anything that needs to be corrected or clarified, we'd love to hear from you.