Preparing for a Network Installation

A network installation using an installation server allows you to install CentOS on multiple systems using a network boot server. This way, all systems configured to do so will boot using an image provided by this server and start the installation program automatically.

Red Hat Satellite has the ability to automate the setup of a PXE server. See the Red Hat Satellite User Guide for more information.

A minimum of two systems is required for a network installation:

  • A server - a system running a DHCP server, a TFTP server to provide boot files, and an HTTP, FTP or NFS server which hosts the installation image. Theoretically, each of the servers can run on a different physical system; procedures in this section assume a single system runs all of them for simplicity.

  • A client - the system which you are installing CentOS to. When the installation begins, the client will query the DHCP server, obtain boot files from the TFTP server, and download the installation image from the HTTP, FTP or NFS server.

Unlike most other means of installation, no physical boot media is required to be plugged in the client (that is, the system you are installing into) in order to begin the installation. This chapter describes the steps you must take to prepare for network installations.

The following steps must be performed to prepare for a network installation:

  1. Configure the network server (NFS, HTTPS, HTTP, or FTP) to export the installation tree or the installation ISO image. For procedures describing the configuration, see Installation Source on a Network.

  2. Configure the files on the tftp server necessary for network boot, configure DHCP, and start the tftp service on the PXE server. See Configuring Network Boot Services for details.

    The GRUB2 boot loader supports network boot from HTTP in addition to a tftp server. However, obtaining boot files (the kernel and initial ram disk for the installer) over this protocol is very slow and suffers a risk of timeout failures. Using a tftp server to provide the boot files is recommended.

    This warning only applies to the kernel and initial ram disk (vmlinuz and initrd). Obtaining the installation source from an HTTP server does not carry this risk.

  3. Boot the client (the system you want to install CentOS on) and start the installation.

The procedures in this chapter describe setting up a network boot server on a CentOS 7 system. For details about configuring network boot on earlier releases of CentOS, see the appropriate Installation Guide for that release.

Configuring Network Boot Services

After setting up a network server containing the package repositories to be used in the installation, the next step is to configure the PXE server itself. This server will contain files necessary to boot the CentOS and start the installation. Additionally, a DHCP server must be configured, and all necessary services must be enabled and started.

The network boot configuration procedure differs based on whether the AMD64/Intel 64 system you want to install CentOS on uses BIOS or UEFI. Consult your hardware’s documentation to see which system is used on your hardware, and then follow the appropriate procedure in this chapter.

A separate procedure is provided for booting IBM Power Systems from a network location with the GRUB2 boot loader. See Configuring Network Boot for IBM Power Systems Using GRUB2 for details.

For more information on configuring a network boot server for use with headless systems (systems without a directly connected display, keyboard and mouse), see Headless Systems.

Configuring a TFTP Server for BIOS-based AMD64 and Intel 64 Clients

The following procedure will prepare the PXE server for booting BIOS-based AMD64 and Intel 64 systems. For information on UEFI-based systems, see Configuring a TFTP Server for UEFI-based AMD64/Intel 64 and ARM Clients.

Configuring a TFTP Boot Server for BIOS-based Systems
  1. Install the tftp-server package. To do this, enter the following command as root:

    # yum install tftp-server
  2. Allow incoming connections to the tftp service in the firewall:

    # firewall-cmd --add-service=tftp

    The above command only enables access until the next server reboot. To allow access permanently, add the --permanent option. For more information about firewall configuration, see the Red Hat Enterprise Linux 7 Security Guide.

  3. Configure your DHCP server to use the boot images packaged with SYSLINUX. If you do not have one installed, see the Red Hat Enterprise Linux 7 Networking Guide for instructions.

    A sample configuration in the /etc/dhcp/dhcpd.conf file might look like:

    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;
    
    	  if option architecture-type = 00:07 {
    	    filename "uefi/shim.efi";
    	    } else {
    	    filename "pxelinux/pxelinux.0";
    	  }
    	}
    }
  4. You now need the pxelinux.0 file from the SYSLINUX package in the ISO image file of the full installation DVD. To access it, enter the following commands as root:

    # mount -t iso9660 /path_to_image/name_of_image.iso /mount_point -o loop,ro
    # cp -pr /mount_point/Packages/syslinux-version-architecture.rpm /publicly_available_directory
    # umount /mount_point

    Extract the package:

    # rpm2cpio syslinux-version-architecture.rpm | cpio -dimv
  5. Create a pxelinux/ directory within tftpboot/ and copy the pxelinux.0 file into it:

    # mkdir /var/lib/tftpboot/pxelinux
    # cp publicly_available_directory/usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/pxelinux
  6. Create the directory pxelinux.cfg/ in the pxelinux/ directory:

    # mkdir /var/lib/tftpboot/pxelinux/pxelinux.cfg

    Add a configuration file named default to the pxelinux.cfg/ directory.

    A sample configuration file at /var/lib/tftpboot/pxelinux/pxelinux.cfg/default might look like:

    default vesamenu.c32
    prompt 1
    timeout 600
    
    display boot.msg
    
    label linux
      menu label ^Install system
      menu default
      kernel images/CentOS-7/vmlinuz
      append initrd=images/CentOS-7/initrd.img ip=dhcp inst.repo=http://10.32.5.1/mnt/archive/CentOS/7/Server/x86_64/os/
    label vesa
      menu label Install system with ^basic video driver
      kernel images/CentOS-7/vmlinuz
      append initrd=images/CentOS-7/initrd.img ip=dhcp inst.xdriver=vesa nomodeset inst.repo=http://10.32.5.1/mnt/archive/CentOS/7/Server/x86_64/os/
    label rescue
      menu label ^Rescue installed system
      kernel images/CentOS-7/vmlinuz
      append initrd=images/CentOS-7/initrd.img rescue
    label local
      menu label Boot from ^local drive
      localboot 0xffff

    The inst.repo= Anaconda option, shown in the example above, must always be used to specify the installation program’s image as well as the installation source. Without this option, the installation program will be unable to boot. For more information about boot options for Anaconda, see Configuring the Installation System at the Boot Menu.

  7. Create a subdirectory to store the boot image files within the /var/lib/tftpboot/ directory, and copy the boot image files to it. In this example, we use the directory /var/lib/tftpboot/pxelinux/images/CentOS-7/:

    # mkdir -p /var/lib/tftpboot/images/CentOS-7/
    # cp /path-to-x86-64-images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/pxelinux/images/CentOS-7/
  8. Finally, start and enable the services:

    • The dhcpd service:

      # systemctl start dhcpd
      # systemctl enable dhcpd
    • The xinetd service, that manages the tftpd service:

      # systemctl start xinetd
      # systemctl enable xinetd

After finishing this procedure, the PXE boot server is ready to serve PXE clients. You can now start the system you want to install CentOS on, select PXE Boot when prompted to specify a boot source, and start the network installation. For more information, see Booting from the Network Using PXE (x86).

Configuring a TFTP Server for UEFI-based AMD64/Intel 64 and ARM Clients

The following procedure will prepare the PXE server for booting UEFI-based AMD64/Intel 64 and ARM systems. For information on BIOS-based systems, see Configuring a TFTP Server for BIOS-based AMD64 and Intel 64 Clients.

Configuring TFTP Boot for UEFI-based Systems
  1. Install the tftp-server package. To do this, enter the following command as root:

    CentOS 7 UEFI PXE boot supports a lowercase file format for a MAC-based grub menu file. For example, the MAC address file format for grub2 is grub.cfg-01-aa-bb-cc-dd-ee-ff.

    # yum install tftp-server
  2. Allow incoming connections to the tftp service in the firewall:

    # firewall-cmd --add-service=tftp

    The above command only enables access until the next server reboot. To allow access permanently, add the --permanent option. For more information about firewall configuration, see the Red Hat Enterprise Linux 7 Security Guide.

  3. Configure your DHCP server to use the EFI boot images packaged with shim. If you do not have one installed, see the Red Hat Enterprise Linux 7 Networking Guide for instructions.

    A sample configuration in the /etc/dhcp/dhcpd.conf file might look like:

    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;
    
    	  if option architecture-type = 00:07 {
    	    filename "shim.efi";
    	  } else {
    	    filename "pxelinux/pxelinux.0";
    		}
      }
    }
  4. You now need the shim.efi file from the shim package and the grubx64.efi file from the grub2-efi package in the ISO image file. To access them, enter the following commands as root:

    # mount -t iso9660 /path_to_image/name_of_image.iso /mount_point -o loop,ro
    # cp -pr /mount_point/Packages/shim-version-architecture.rpm /publicly_available_directory
    # cp -pr /mount_point/Packages/grub2-efi-version-architecture.rpm /publicly_available_directory
    # umount /mount_point

    Extract the packages:

    # rpm2cpio shim-version-architecture.rpm | cpio -dimv
    # rpm2cpio grub2-efi-version-architecture.rpm | cpio -dimv
  5. Copy the EFI boot images from your boot directory:

    # cp publicly_available_directory/boot/efi/EFI/redhat/shim.efi /var/lib/tftpboot/`
    # cp publicly_available_directory/boot/efi/EFI/redhat/grubx64.efi /var/lib/tftpboot/`
  6. Add a configuration file named grub.cfg to the tftpboot/ directory. A sample configuration file at /var/lib/tftpboot/grub.cfg might look like:

    set timeout=60
    menuentry 'CentOS' {
      linuxefi images/CentOS-7/vmlinuz ip=dhcp inst.repo=http://10.32.5.1/mnt/archive/CentOS-7/7/Server/x86_64/os/
      initrdefi images/CentOS-7/initrd.img
    }

    The inst.repo= Anaconda option, shown in the example above, must always be used to specify the installation program’s image as well as the installation source. Without this option, the installation program will be unable to boot. For more information about boot options for Anaconda, see Configuring the Installation System at the Boot Menu.

  7. Create a subdirectory to store the boot image files within the /var/lib/tftpboot/ directory, and copy the boot image files to it. In this example, we use the directory /var/lib/tftpboot/images/CentOS-7/:

    # mkdir -p /var/lib/tftpboot/images/CentOS-7
    # cp /path-to-x86-64-images/pxeboot/{vmlinuz,initrd.img} /var/lib/tftpboot/images/CentOS-7/
  8. Finally, start and enable the services:

    • The dhcpd service:

      # systemctl start dhcpd
      # systemctl enable dhcpd
    • The xinetd service, that manages the tftpd service:

      # systemctl start xinetd
      # systemctl enable xinetd

After finishing this procedure, the PXE boot server is ready to serve PXE clients. You can now start the system you want to install CentOS on, select PXE Boot when prompted to specify a boot source, and start the network installation. For more information, see Booting from the Network Using PXE (x86).

Configuring Network Boot for IBM Power Systems Using GRUB2

Configuring a Network Boot Server for IBM Power Systems Using GRUB2
  1. Install the tftp-server package. To do this, enter the following command as root:

    # yum install tftp-server
  2. Allow incoming connections to the tftp service in the firewall:

    # firewall-cmd --add-service=tftp

    The above command only enables access until the next server reboot. To allow access permanently, add the --permanent option. For more information about firewall configuration, see the Red Hat Enterprise Linux 7 Security Guide.

  3. Create a GRUB2 network boot directory inside the tftp root:

    # grub2-mknetdir --net-directory=/var/lib/tftpboot
    Netboot directory for powerpc-ieee1275 created. Configure your DHCP server to point to /boot/grub2/powerpc-ieee1275/core.elf

    Note the command’s output, which informs you about which file needs to be configured as the filename in your DHCP configuration. This will become important further in the procedure.

  4. Create a GRUB2 configuration file: /var/lib/tftpboot/boot/grub2/grub.cfg. The grub.cfg syntax is described in the Red Hat Enterprise Linux 7 System Administrator’s Guide.

    Below is an example configuration file:

    set default=0
    set timeout=5
    
    echo -e "\nWelcome to the CentOS 7 installer!\n\n"
    
    menuentry 'CentOS 7' {
      linux grub2-ppc64/vmlinuz ro ip=dhcp inst.repo=http://10.32.5.1/mnt/archive/CentOS/7/Server/ppc64/os/
      initrd grub2-ppc64/initrd.img
    }

    The inst.repo= Anaconda option, shown in the example above, must always be used to specify the installation program’s image as well as the installation source. Without this option, the installation program will be unable to boot. For more information about boot options for Anaconda, see Configuring the Installation System at the Boot Menu.

  5. Configure your DHCP server to use the boot images packaged with GRUB2. If you do not have one installed, see the Red Hat Enterprise Linux 7 Networking Guide for instructions.

    A sample configuration in the /etc/dhcp/dhcpd.conf file might look like:

    subnet 192.168.0.1 netmask 255.255.255.0 {
      allow bootp;
      option routers 192.168.0.5;
      group { #BOOTP POWER clients
        filename "boot/grub2/powerpc-ieee1275/core.elf";
        host client1 {
        hardware ethernet 01:23:45:67:89:ab;
        fixed-address 192.168.0.112;
        }
      }
    }

    Adjust the sample parameters (subnet, netmask, routers, fixed-address and hardware ethernet) to fit your network configuration. Also note the filename parameter; this is the file name which was output by the grub2-mknetdir command earlier in the procedure.

  6. Finally, start and enable the services:

    • The dhcpd service:

      # systemctl start dhcpd
      # systemctl enable dhcpd
    • The xinetd service that manages the tftpd service:

      # systemctl start xinetd
      # systemctl enable xinetd

After finishing this procedure, the PXE boot server is ready to serve PXE clients. You can now follow the steps described in Booting the Installation on IBM Power Systems to boot your Power Systems client from this server.

Additional information about setting up network boot for IBM Power Systems clients can be found in the Netbooting on POWER - An Introduction at the IBM DeveloperWorks website.