.. _Preparing Environment:

Preparing Environment
---------------------

This section explains how to set up the environment for installation over network.

.. _Installing PXE Components:

Installing PXE Components
~~~~~~~~~~~~~~~~~~~~~~~~~

You will need these components to set up a PXE environment:

- TFTP server. This is a machine that allows your servers to boot and install Virtuozzo Infrastructure Platform over the network. Any machine that can run Linux and is accessble over network can be a TFTP server.

- DHCP server. This is a standard DHCP machine serving TCP/IP settings to computers on your network.

- HTTP server. This is a machine serving Virtuozzo Infrastructure Platform installation files over network.

  .. note:: You can also share Virtuozzo Infrastructure Platform distribution over network via FTP (e.g., with ``vsftpd``) or NFS.

The easiest way is to set up all of these on the same physical machine:

::

    # yum install tftp-server syslinux httpd dhcp

You can also use servers that already exist in your infrastructure. For example, skip ``httpd`` and ``dhcp`` if you already have the HTTP and DHCP servers.

.. _Configuring TFTP Server:

Configuring TFTP Server
~~~~~~~~~~~~~~~~~~~~~~~

This section describes how to configure the TFTP server for BIOS-based systems. For information on how to configure it for installing Virtuozzo Infrastructure Platform on EFI-based systems, see the `Red Hat Enterprise Linux Installation Guide <https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/installation_guide/chap-installation-server-setup#sect-network-boot-setup-uefi>`__.

Do the following:

#. On the server, open the ``/etc/xinetd.d/tftp`` file, and edit it as follows:

   ::

       service tftp
       {
       disable         = no
       socket_type     = dgram
       protocol        = udp
       wait            = yes
       user            = root
       server          = /usr/sbin/in.tftpd
       server_args     = -v -s /tftpboot
       per_source      = 11
       cps             = 100 2
       flags           = IPv4
       }

   Once you are done, save the file.

#. Create the ``/tftpboot`` directory and copy the following files to it:

   - ``vmlinuz``,
   - ``initrd.img``,
   - ``menu.c32``,
   - ``pxelinux.0``.

   These files are necessary to start installation. You can find the first two in the ``/images/pxeboot`` directory of the Virtuozzo Infrastructure Platform distribution. The last two files are located in the ``syslinux`` directory (usually ``/usr/share/syslinux`` or ``/usr/lib/syslinux``).

#. Create the ``/tftpboot/pxelinux.cfg`` directory and make the ``default`` file in it.

   ::

       # mkdir /tftpboot/pxelinux.cfg
       # touch /tftpboot/pxelinux.cfg/default

#. Add the following lines to ``default``:

   ::

       default menu.c32
       prompt 0
       timeout 100
       ontimeout ASTOR
       menu title Boot Menu
       label ASTOR
               menu label Install Virtuozzo Infrastructure Platform
               kernel vmlinuz
               append initrd=initrd.img ip=dhcp

   .. note:: For detailed information on parameters you can specify in this file, see the documentation for ``syslinux``.

#. Restart the ``xinetd`` service:

   ::

       # /etc/init.d/xinetd restart

#. If necessary, configure firewall to allow access to the TFTP server (on port 69 by default).

   .. note:: When running the TFTP server, you might get the "Permission denied" error. In this case, you may try to fix the problem by running the following command: ``# restorecon -Rv /tftboot/``.

.. _Setting Up DHCP Server:

Setting Up DHCP Server
~~~~~~~~~~~~~~~~~~~~~~

To set up a DHCP server for installing Virtuozzo Infrastructure Platform over network, add the following strings to the ``dhcpd.conf`` file, which is usually located in the ``/etc`` or ``/etc/dhcp`` directory:

::

    next-server <PXE_server_IP_address>;
    filename "/pxelinux.0";

.. note:: To configure a DHCP server for installation on EFI-based systems, specify ``filename "/bootx64.efi"`` instead of ``filename "/pxelinux.0"`` in the ``dhcpd.conf`` file, where ``/bootx64.efi`` is the directory to which you copied the EFI boot images when setting up the TFTP server.

.. _Setting Up HTTP Server:

Setting Up HTTP Server
~~~~~~~~~~~~~~~~~~~~~~

Now that you have set up the TFTP and DHCP servers, you need to make the Virtuozzo Infrastructure Platform distribution files available for installation over the network. To do this:

#. Set up an HTTP server. You can also use an existing HTTP server, if you have one.

#. Copy the contents of your Virtuozzo Infrastructure Platform installation DVD to some directory on the HTTP server (e.g., ``/var/www/html/astor``).

#. On the PXE server, open the ``/tftpboot/pxelinux.cfg/default`` file for editing, and specify the path to the Virtuozzo Infrastructure Platform installation files on the HTTP server.

   .. note:: For EFI-based systems, the file you need to edit has the name of ``/tftpboot/pxelinux.cfg/efidefault`` or ``/tftpboot/pxelinux.cfg/<PXE_server_IP_address>``.

   Assuming that you have the installation files in the ``/var/www/html/astor`` directory on the HTTP server with the IP address of 198.123.123.198 and the ``DocumentRoot`` directory is set to ``/var/www/html``, you can add the following option to the ``append`` line of the ``default`` file to make the Virtuozzo Infrastructure Platform files accessible over HTTP:

   ::

       inst.repo=http://198.123.123.198/astor

   So your default file should look similar to the following:

   ::

       default menu.c32
       prompt 0
       timeout 100
       ontimeout ASTOR
       menu title Boot Menu
       label ASTOR
               menu label Install Virtuozzo Infrastructure Platform
               kernel vmlinuz
               append initrd=initrd.img ip=dhcp inst.repo=http://198.123.123.198/astor
