Installing Mandriva Linux with PXE
From Mandriva Community Wiki
PXE is a standard for booting a system via its network connection. Mandriva Linux can be installed via PXE, allowing you to install it on a system with no CD drive or bootable USB media (and no currently installed operating system) via a network connection.
How it works
A network installation will use several protocols almost simultaneously; these are the file transfer protocols. When a machine is booted over the network, the following things happen:
- Your network card contains a small BIOS, which boots the system.
- It will independently find an IP address. This address is provided by a DHCP server.
- It will then look for a server capable of sending it a small file. This server is called a TFTP server.
- It will download this file and transfer control of the system to it.
- This file, in our case, will contain the 'stage 1' of the Mandriva installer, which is a small program to which you provide the location of the installation media (in this case, the Mandriva ISO files).
- We will tell this program to use NFS to find the ISO files and run the full installer from them.
- Finally, the first ISO will be launched as if it were a CD in the local machine.
Everything referred to as "the server" below will be the same machine in our example: the one which distributes the installation ISOs.
The server must be connected to the machine which will install Mandriva via a local network, which means it will need two network cards if it is connected to the internet through one (it is actually possible to do this with one physical network card, if you use a "virtual" interface, but this is outside the scope of this article). It is also of course possible to disconnect the server from the internet in order to connect it to the other machine via a local network.
To complete a network installation, you will need several things on the server:
- Mandriva ISOs on the hard disk
- The drakpxelinux package
- The dhcp-server package
- The drakwizard package
- The nfs-utils package
Once you have all of this installed, open the Mandriva Control Center. If you did not have drakwizard installed before, you will notice several new functions. The one we are currently interested in is under Network Services: "Configure DHCP".
When you run it, it will ask several very simple questions. Make sure to read the explanations! Choose the card connected to the local network and provide two non-public IP addresses that define a range, for example: 192.168.0.10 to 192.168.0.250. Give the IP address of the server as the gateway and activate PXE.
Your DHCP server is ready: the other machine should now be able to receive an IP address. Now we have to provide something for it to run: the Mandriva installer stage 1.
Providing stage 1
Stage 1 is provided in the form of a kernel and an initrd (which contains modules to be loaded by the kernel). It is located on the first Mandriva ISO.
Let's assume the ISOs are in the /iso directory and the first Mandriva ISO is called cd1.iso. Enter the following commands as root:
mkdir /mnt/tmp mount -o loop /iso/cd1.iso /mnt/tmp
You can now access the contents of the ISO file in the /mnt/tmp directory. Enter the isolinux/alt0 subdirectory. You will see the stage1 kernel and initrd.
PXE Configuration: drakpxelinux
Now you can run drakpxelinux as root. A wizard will launch that will help you get PXE up and running on your DHCP server. At the right hand side of the screen you will see the 'default' profile - click on it. Then click on "Add a PXE entry" at the bottom of the screen. A second wizard will launch to configure the TFTP server which will distribute the stage1.
Give it the path of the kernel and initrd image which the TFTP server will provide to the other machine. Once the PXE configuration is done, select this entry (named "Mandriva" by default) as the boot time default at the bottom right of the screen.
Go into the "Systems" tab. You will see a MAC address corresponding to the other machine (if it is on and connected to the network). If this is not the case, restart the other machine and boot it over the network: it should appear, even if it does not manage to boot correctly.
At the bottom right of the screen, choose "default", then select the entry corresponding to your machine and click on the two buttons: "Set the installation profile" and "Set the startup profile". Finally, click on OK, which will close drakpxelinux.
NFS server configuration
You are finished with the PXE configuration. Now you just have to configure the server to act as an NFS server, which is very simple. Edit the file /etc/exports. You must add this line:
Where /iso/ is the directory where the Mandriva ISOs are located, and ip/netmask is the address range of your local network, for example 192.168.0.0/255.255.255.0. (sync) indicates that transfers should be sent in synchronous mode between the server and the client (a little slower than asynchronous, but recommended).
To export the directory via NFS, run exportfs -a.
Everything is now configured! All you have to do now is boot the machine which will receive the installation, choose the NFS method in stage 1, and provide the IP address of the server and the directory of the ISOs (/iso in our example). The installation will start from CD1 as if it was in the CD-ROM drive. You can now proceed to do a normal Mandriva installation. Note that you could use any other installation method too, once the system has booted over PXE.