.. _Installing Virtuozzo with CLI Management:

Installing Virtuozzo with CLI Management
----------------------------------------

To install Virtuozzo with CLI management in graphics mode, choose **Install Virtuozzo 7 with CLI management** on the welcome screen. After the installation program loads, you will see the **Installation Summary** screen. On this screen, you need to specify a number of parameters required to install Virtuozzo.

.. image:: ../../../images/vzinstall1.png
   :align: center
   :class: align-center

Accepting EULA
~~~~~~~~~~~~~~

You need to accept the Virtuozzo End-User License Agreement to install Virtuozzo.

To accept the Virtuozzo EULA, open the **EULA** screen, select **Accept**, and click **Done**.

.. image:: ../../../images/vzinstall1_1.png
   :align: center
   :class: align-center

Setting Date and Time
~~~~~~~~~~~~~~~~~~~~~

If you need to set the date and time for your Virtuozzo installation, open the **DATE & TIME** screen and make the necessary changes.

.. image:: ../../../images/vzinstall2.png
   :align: center
   :class: align-center

Selecting the Keyboard Layout
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The selected keyboard layout can be used during installation and, once the installation is complete, in the console (e.g., for entering localized descriptions, configuration file comments, and such).

If you need to change the default English (US) keyboard layout, open the **KEYBOARD** screen, click the plus sign to add a layout, and click **Options** to choose a key combination for switching layouts.

.. image:: ../../../images/vzinstall3.png
   :align: center
   :class: align-center

Configuring Network
~~~~~~~~~~~~~~~~~~~

Usually network is configured automatically by the installation program. If you need to modify network settings, you can do so on the **NETWORK & HOST NAME** screen.

To install Virtuozzo, you will need to have at least one network card configured and you will also need to provide a hostname: either a fully qualified domain name (``<hostname>.<domainname>``) or a short name (``<hostname>``).

.. image:: ../../../images/vzinstall4.png
   :align: center
   :class: align-center

Creating Bonded and Teamed Connections
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. include:: ../../../virtuozzo_storage_2_installation_guide/source/installing-virtuozzo-storage/configuring-network.rst
   :start-line: 13
   :end-line: 61

Creating VLAN Adapters
^^^^^^^^^^^^^^^^^^^^^^

While installing Virtuozzo, you can also create virtual local area network (VLAN) adapters on the basis of physical adapters on the **NETWORK & HOSTNAME** screen as described below.

#. To add a new VLAN adapter, click the plus button in the bottom, select **VLAN** from the drop-down list, and click **Add**.

   .. image:: ../../../images/vzinstall34.png
      :align: center
      :class: align-center

#. In the **Editing VLAN connection...** window:

   #. Select a physical adapter the VLAN adapter will be based on from the **Parent interface** drop-down list.

   #. Specify a VLAN adapter identifier in the **VLAN ID** field. The value must be in the 1-4094 range.

   .. image:: ../../../images/vzinstall35.png
      :align: center
      :class: align-center

#. Configure other parameters if required and click **Save**.

The VLAN adapter will appear in the list on the **NETWORK & HOSTNAME** screen.

.. image:: ../../../images/vzinstall36.png
   :align: center
   :class: align-center

Choosing the Storage Type
~~~~~~~~~~~~~~~~~~~~~~~~~

To choose the storage type, open the **SELECT STORAGE TYPE** screen:

.. image:: ../../../images/vzinstall5.png
   :align: center
   :class: align-center

Virtuozzo with CLI management can be installed on two types of storage:

-  Basic storage, i.e. local hard drive(s). This option is chosen by default and requires no configuration.

-  Virtuozzo Storage, as a part of a new or existing Virtuozzo Storage cluster. If you choose this option, you will need to set additional options described in :ref:`Setting Virtuozzo Storage Installation Options`.

   .. note:: Virtuozzo Storage is a solution that transforms local hard drives into a highly protected enterprise-level storage (like SAN or NAS) with data replication, high-availability, and self-healing features. Using Virtuozzo Storage, you can safely store and run virtual machines and containers, migrate them with zero downtime, provide high availability for your Virtuozzo installations, and much more. For more information on Virtuozzo Storage, see the *Virtuozzo Storage Administrator's Guide*.

.. _Setting Virtuozzo Storage Installation Options:

Setting Virtuozzo Storage Installation Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

If you choose to install on Virtuozzo Storage, you need to choose one of these options:

-  join the server to an existing Virtuozzo Storage cluster (see :ref:`Joining an Existing Virtuozzo Storage Cluster`), or

-  create a new Virtuozzo Storage cluster (see :ref:`Creating a New Virtuozzo Storage Cluster`).

   .. note:: For detailed information on working with Virtuozzo Storage clusters, consult the *Virtuozzo Storage Administrator’s Guide*.

.. _Creating a New Virtuozzo Storage Cluster:

Creating a New Virtuozzo Storage Cluster
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you choose to create a new Virtuozzo Storage cluster, you will need to provide the cluster name and password and select one or more roles for your server.

.. image:: ../../../images/vzinstall7.png
   :align: center
   :class: align-center

First, in the **Name** field, specify a name for the cluster that will uniquely identify it among other clusters in your network. A cluster name must consist of the characters a-z, A-Z, 0-9, minus (-), underscore (\_), and must not be longer than 63 characters long.

.. image:: ../../../images/vzinstall7_2.png
   :align: center
   :class: align-center

Next, click **Configure security** next to the **Name** field and specify a password for your cluster. The password must be at least 8 characters long. It is encrypted and saved to the file ``/etc/vstorage/clusters/<cluster_name>/auth_digest.key`` on the server.

.. note:: A server needs to be authenticated only once. After that, you can configure it as a metadata server, chunk server, or a client. If later you decide to configure the server where you are setting the first MDS as a chunk server, no additional authentication will be required.

Next, choose the cluster role(s) for your server. See :ref:`Virtuozzo Storage Server Roles`. When you create a new Virtuozzo Storage cluster, the **Metadata Server Role** option is selected by default.

.. _Joining an Existing Virtuozzo Storage Cluster:

Joining an Existing Virtuozzo Storage Cluster
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

If you choose to join an existing Virtuozzo Storage cluster, you will need to provide the cluster name and password and select one or more roles for your server.

.. image:: ../../../images/vzinstall6.png
   :align: center
   :class: align-center

First, in the **Name** field, specify a name of the cluster to join.

.. image:: ../../../images/vzinstall7_3.png
   :align: center
   :class: align-center

Next, click **Configure security** next to the **Name** field and specify a password for your cluster.

Next, choose the role(s) for your server. See :ref:`Virtuozzo Storage Server Roles`.

.. _Virtuozzo Storage Server Roles:

Virtuozzo Storage Server Roles
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Each Virtuozzo server can have one, some, or all of the following roles.

-  Metadata Server Role. MDS servers are an essential part of any Virtuozzo Storage cluster. They store metadata about chunk servers and control how files keeping the contents of virtual machines and containers are split into chunks and where these chunks are located.

   .. image:: ../../../images/vzinstall8.png
      :align: center
      :class: align-center

   As a static IP address is required for an MDS server, the IP address detected by the installation program is specified in the corresponding field by default. If multiple IP addresses are available, you need to to choose one to assign to the MDS server. In some cases, you may need to enter a valid IP address manually.

   .. note:: MDS servers require static IP addresses. If you are using DHCP, map an IP address to the MAC address of the MDS server.

-  Chunk Server Role. Chunk servers (CS) store the contents of virtual machines and containers in the form of fixed-size chunks and provide access to these chunks. All data chunks are replicated and the replicas are kept on different chunk servers for high data availability. If one of the chunk servers goes down, other chunk servers continue providing the replicas of data chunks that were stored on the failed server.

   .. image:: ../../../images/vzinstall9.png
      :align: center
      :class: align-center

   .. warning:: Virtuozzo Storage has redundancy built in, so you should avoid running Virtuozzo Storage on redundant types of RAID like 1, 5, or 6 over local storage. In this case, a single write operation may affect a significant number of HDDs resulting in very poor performance. For example, for 3 Virtuozzo Storage replicas and RAID5 on servers with 5 HDDs each, a single write operation may result in 15 I/O operations. For recommendations on optimal local storage configurations, consult the *Virtuozzo Storage Administrator’s Guide*.

   By default, the installer does the following:

   -  If your server has several disk drives, the installer will automatically configure each disk drive except system to act as a separate chunk server.

   -  If one or more SSD drives are available on the server, they will be set up to store chunk server write journals (one journal per chunk server). By using SSD drives for write journaling, you can boost the performance of write operations in the cluster by up to two or more times. For more information on using SSD drives, consult the *Virtuozzo Storage Administrator’s Guide*. If you need to disable this setting, click **Configure** under the chunk server role checkbox and clear the checkbox **Enable the use of SSD drives for the CS journal**.

      .. image:: ../../../images/vzinstall10.png
         :align: center
         :class: align-center

      .. note:: If one or more SSDs are not detected automatically, find out their device names (for example, invoke the console by pressing **Ctrl+Alt+F2** and run ``lsblk -d -o name,rota``, zeroes in the **ROTA** column will indicate non-rotational drives, i.e. SSDs), reboot to the installer welcome screen, and follow instructions in :ref:`Enabling Forced Detection of SSDs`.

-  Client Server Role. Clients are computers with Virtuozzo 7 from where you run virtual machines and containers stored in your Virtuozzo Storage cluster.

   .. image:: ../../../images/vzinstall11.png
      :align: center
      :class: align-center

   By default, if one or more SSD drives are available on the server, the installer configures them to store a local cache of frequently accessed data. By having a local cache on an SSD drive, you can increase the overall cluster performance by up to 10 and more times. For more information on using SSD drives, consult the *Virtuozzo Storage Administrator’s Guide*.

      .. note:: If one or more SSDs are not detected automatically, find out their drive letters (for example, invoke the console by pressing **Ctrl+Alt+F2** and run ``lsblk -d -o name,rota``, zeroes in the **ROTA** column will indicate non-rotational drives, i.e. SSDs), reboot to the installer welcome screen, and follow instructions in :ref:`Enabling Forced Detection of SSDs`.

   To change either of these settings, click **Configure** under the client role checkbox and set the corresponding checkboxes in the client settings window.

   .. image:: ../../../images/vzinstall12.png
      :align: center
      :class: align-center

.. _Partitioning the Hard Drives:

Partitioning the Hard Drives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Having chosen the storage type, you need to choose partitioning options on the **INSTALLATION DESTINATION** screen.

.. warning:: All the existing partitions on all disks will be deleted.

.. image:: ../../../images/vzinstall13.png
   :align: center
   :class: align-center

Firstly, you will need to choose which of the disks are marked as **System**, **Datastore**, and **Cache**:

- Use the **System** radio button to select a disk where the root partition with Virtuozzo system files (mounted to ``/``) will be kept.

- Use **Datastore** checkboxes to mark disks where virtual machines and containers will be kept. All such disks will be organized into a single volume group and mounted to the ``/vz`` mount point. At least one disk need to be marked as a data store. If Virtuozzo Storage chunk server role is selected, a chunk server will be created on each disk marked as a data store (in this case, the system disk cannot be marked as a data store).

- Use **Cache** checkboxes to mark SSD drives where journals and cache will be kept. This option is only applicable for SSD drives to be used in Virtuozzo Storage clusters.

Secondly, in the bottom of the screen, you will need to choose:

-  **Automatically configure partitioning** and click **Done** to have the installation program create the default layout on the server.

-  **I will configure partitioning** and click **Done** to manually partition your disk(s).

When partitioning the disks, keep in mind that Virtuozzo requires these partitions:

-  Boot: mount point ``/boot``, 1 GB, boot partition with Virtuozzo boot files, created on each HDD,

-  Root: mount point ``/``, 12-24 GB, root partition with Virtuozzo files, created on the HDD marked **System**,

-  Swap: paging partition with the ``swap`` file system, created on the HDD marked **System**. The size depends on RAM:

   -  if RAM is below 2 GB, swap size should be twice the RAM,

   -  if RAM is 2-8 GB, swap size should be equal to RAM,

   -  if RAM is 8-64 GB, swap size should be half the RAM,

   -  otherwise swap size should be 32 GB.

-  Data storage, depends on the chosen storage type:

   -  Local: mount point ``/vz``, at least 30 GB, storage for virtual machines, containers, and OS and application templates, an LVM volume group that spans all HDDs marked **Datastore**. The ``/vz`` partition must be formatted to ``ext4 tuned for VZ`` (which is ext4 with additional mount options that improve Virtuozzo performance).

   -  Virtuozzo Storage chunk server: mount point ``<cluster_name>-cs<N>``, at least 100 GB, only required if the chunk server role is chosen. Chunk servers can only be created on partitions formatted to ``ext4 tuned for CS`` (which is ext4 with additional mount options that improve Virtuozzo Storage performance).

-  In addition, either a 1 MB partition with the BIOS boot file system or a 200 MB partition with the EFI boot file system is required depending on your server configuration.

A typical partition layout for Virtuozzo on basic storage may look like this:

.. image:: ../../../images/vzinstall14.png
   :align: center
   :class: align-center

A typical partition layout for Virtuozzo on Virtuozzo Storage may look like this:

.. image:: ../../../images/vzinstall15.png
   :align: center
   :class: align-center

.. _Finishing Installation CLI:

Finishing Installation
~~~~~~~~~~~~~~~~~~~~~~

Having configured everything necessary on the **INSTALLATION SUMMARY** screen, click **Begin Installation**.

.. image:: ../../../images/vzinstall16.png
   :align: center
   :class: align-center

While Virtuozzo is installing, click **ROOT PASSWORD** to create a password for the root account. Installation will not finish until the password is created.

.. image:: ../../../images/vzinstall17.png
   :align: center
   :class: align-center

While Virtuozzo is installing, you can also activate a Virtuozzo license and disable the automatic updating of Virtuozzo ReadyKernel patches if required.

.. _Activating License CLI:

Activating License
^^^^^^^^^^^^^^^^^^

To activate a Virtuozzo license, click **LICENSE KEY**, enter a key, and click **Done**.

.. image:: ../../../images/vzinstall32.png
   :align: center
   :class: align-center

If you do not have a license, you can get one by clicking "Try Virtuozzo Today" at https://virtuozzo.com/.

Alternatively, you can activate a license with the ``vzlicload`` command after the installation is complete. For more details, see the `Virtuozzo 7 User's Guide <http://docs.virtuozzo.com/virtuozzo_7_users_guide/learning-virtuozzo-basics/understanding-licensing.html>`__.

.. note:: If the license is not activated, containers and virtual machines will be deactivated (suspended without a possibility to resume) after a grace period. All the newly created containers and virtual machines will run for 5 minutes. Containers with Virtuozzo Storage and Virtuozzo Automator management panels (if installed) will run for 24 hours.

.. _Configuring ReadyKernel CLI:

Configuring ReadyKernel
^^^^^^^^^^^^^^^^^^^^^^^

With automatic updating enabled by default, ReadyKernel will check for new patches daily at 12:00 server time. If a patch is available, ReadyKernel will download, install, and load it for the current kernel. For more details, see the `Virtuozzo 7 User's Guide <http://docs.virtuozzo.com/virtuozzo_7_users_guide/keeping-your-system-up-to-date/updating-virtuozzo-kernel-with-readykernel.html>`__.

While Virtuozzo is installing, you can disable the automatic updating of Virtuozzo ReadyKernel patches if required. To do this, click **READYKERNEL**, uncheck **ReadyKernel automatic update**, and click **Done**.

.. image:: ../../../images/vzinstall33.png
   :align: center
   :class: align-center

.. _Completing Installation CLI:

Completing Installation
^^^^^^^^^^^^^^^^^^^^^^^

Once the installation is complete, click **Reboot** to restart the server.

.. image:: ../../../images/vzinstall18.png
   :align: center
   :class: align-center

.. note:: If you are installing Virtuozzo from a USB drive, remove the drive before restarting the server.

After restart, you will see the login prompt as well as the server IP address and hostname that you can use to connect to the server remotely.

To manage virtual machines and containers on the Virtuozzo server, you will need to log in as the root user. After you do so, you will see a shell prompt and can start creating and managing your virtual machines and containers. For quick-start instructions, run ``man afterboot``. More detailed information is provided in the `Virtuozzo 7 User's Guide <http://docs.virtuozzo.com/virtuozzo_7_users_guide/index.html>`__.
