Book Image

Proxmox High Availability

By : CHENG MAN
Book Image

Proxmox High Availability

By: CHENG MAN

Overview of this book

Table of Contents (15 chapters)
Proxmox High Availability
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Basic administration on Proxmox VE


After we have talked about so many concepts, let's learn how to configure Proxmox! I assume you have downloaded and installed your own Proxmox. If you face any difficulty during the installation, you can refer to the following link:

https://pve.proxmox.com/wiki/Quick_installation

The following steps will help you perform basic administration in Proxmox VE:

  1. After the installation, you should be able to see the following screen:

  2. In this step, access the Proxmox VE using a web browser, and make sure you have network access and you are connected in the same subnet as Proxmox. Then, type in a URL in the following format in your browser: https://<Proxmox_IP>:8006. When you first visit the page, your browser will warn you that the SSL certificate is not a trusted one. It is normal if you have experience in building your self-signed SSL certificate on your web server. If you have a domain name for your Proxmox server and would like to have a SSL certificate signed by an authorized CA, please take a look at the following sites:

  3. Next, simply choosing Continue to this website in Internet Explorer adds to the exception. Similarly, choose I understand the risk in Firefox and Chrome. Next, just log in to the system with the root account since we haven't created our own user account. Being logged in, the following warning message indicates that you do not have a valid subscription plan. You can ignore this warning message if you currently don't need to have technical support.

  4. Within the web GUI, you will be able to manage most features of the Proxmox platform. For example, you can create new virtual machines by using the buttons located in the upper-right corner, as shown in the following screenshot:

    There are two ways to create new virtual machines: Create VM and Create CT.

  5. By clicking on the Create CT button, you can create a virtualized Linux platform under the OpenVZ container. It is recommended for GNU/Linux guests because the Linux kernel is shared with the host server, which means that the used memory on the host server will be reduced. When you go through the wizard after clicking on the Create CT button, a virtualized OS is created based on the OS template you used. An OS template is an operation system (for example, CentOS, Debian, and others) with customized packages installed and predefined system parameters. The templates are available in the form of a brand new system or installed with a web server or an application like Drupal. Typically, no graphical user interface (GUI) is preinstalled in the virtualized guests if you use this type of installation.

Uploading the OS template or the ISO file to Proxmox

Before we can start trying to build our own virtual machines with OpenVZ, we have to first upload either an OS template or an ISO file that contains the operating system installation files to Proxmox. The following steps will help us understand how to do this:

  1. Double-click on the icon that is named as the hostname of Proxmox, then choose local, click on Content, and choose Upload from the panel on the right-hand side, as shown in the following screenshot:

  2. After we have clicked on the Upload button, three options are available, as shown in the following screenshot:

    The three options available are as follows:

    • ISO image: This is used as the installation source file for Kernel-based virtualization

    • VZDump backup file: This is used to upload backup files created by Proxmox for restoration

    • OpenVZ template: This is used for the installation source for OpenVZ virtualization

  3. Then, we can simply browse the file that we would like to upload. Pay attention when uploading the OpenVZ template file; you need to use the following naming format:

    {OSName}-{OSVersion}-{OSName}_{OSType}_{amd64/i386}.tar.gz

    This format is shown in the following example:

    centos-6-CentOS_standard_amd64.tar.gz

    The output can be seen in the following screenshot:

We are now ready to create our own virtual machines; let's see how we can create an OpenVZ-based virtual machine first. For example, the OpenVZ template file will be stored inside /var/lib/vz/template/cache/; you can also manually upload it to that directory if you don't wish to use the web interface.

Creating an OpenVZ-based virtual machine

To create an OpenVZ-based virtual machine, please follow these steps:

  1. Click on the Create CT button, and the following window pops up; a system hostname and a password for the root account can be defined, as shown in the following screenshot:

  2. Next, the system will ask you for the template you want to use; for example, you can choose centOS-6-CentOS_devel_amd64.tar.gz:

  3. Then, you will be asked to assign resources to the VM; we can accept the default setting for testing purposes:

  4. After we have allocated system resources to the new virtual machine, we reach an important part: networking. Here, you have the following two options:

    • Routed mode: This uses the default network interface used by Proxmox, and simply specifies an IP address. Only select routed mode if you create a guest system that lies in the same IP subnet as the host system. It would be slightly easier during the system configuration than in the Bridged mode.

    • Bridged mode: This allows you to choose a network adapter other than the default one (including a VLAN-enabled interface). It requires a DHCP server for IP assignment or is manually configured under VM. A demonstration on how to configure the Bridged mode will be shown in Chapter 4, Configuring a Proxmox VE Cluster.

    In the following screenshot, we choose the Routed mode and specify an IP address for demonstration:

  5. The following settings regarding the DNS parameters are saved to the /etc/resolv.conf file in the virtualized guest:

  6. A summary for the configuration is displayed before the VM is created.

  7. After the VM creation is completed, you can view its status in the Summary tab, as shown in the following screenshot:

Creating a kernel-based virtual machine

We have seen how to create OpenVZ-based virtual machines; now, let's learn how we can create a kernel-based virtual machine:

  1. Click on the Create VM button in the top-right corner, as shown in the following screenshot:

  2. Specify a name for identification, but please note that the name is not directly applied to the VM's hostname, as shown in the following screenshot:

  3. Then, we need to choose the type of platform we are going to create, shown as follows:

  4. Next, the OS installation source is specified, shown as follows:

  5. After that, we have to allocate the hard disk for the virtual machine. Pay attention to the hard disk's Format you have chosen; the raw format will instantly allocate the space you have defined (that is, if you defined a 20 GB hard disk, a disk image with 20 GB will be created under the host server) while the QEMU format will only allocate the space based on the current usage of the guest OS. If the guest OS takes up 8 GB, then a disk image with 8 GB in size will be created. For more details, refer to the Virtual disk options under Proxmox VE section. The hard disk window is shown in the following screenshot:

  6. The number of cores/sockets and the CPU types have to be specified for the guest, as shown in the following screenshot:

  7. Of course, we need to allocate the amount of memory for the guest platform, shown as follows:

  8. For the network part, similar to the OpenVZ creation, we have bridged mode and NAT mode. Here, we can specify Model for the virtualized VM; generally, choosing Intel E1000 and Realtek RTL8139 should be fine. The VirtIO option provides better performance, but the driver must be installed on the guest OS before it can be used. This is shown in the following screenshot:

  9. A summary of the configurations is displayed for confirmation.

  10. Just as it appears for OpenVZ, we can find our created VM under the menu, as follows:

Isn't it easy to create a virtual machine with a web interface? By the way, you can identify whether a virtual machine is an OpenVZ container or KVM by its associated icons, as shown in the following screenshot:

Accessing the new virtual machine

Congratulations! You have just created your own virtual machine! Wait, how can we access the system? That's a good question; here, we have two options to achieve our goal. One option is to access it from the web browser. What? Access an operating system with a web browser? Yes, let's see how it works:

  1. Right-click on the virtual machine you would like to access from the panel on the left-hand side, and then choose console.

    Prior to Proxmox 3.2, a new console mode, SPICE, was introduced, which provides a better usage performance especially in a KVM machine. You can refer to https://pve.proxmox.com/wiki/SPICE for more details.

    Make sure you have the latest JAVA runtime (JRE), preferably with JAVA 7 on your browser, and allow it to run if there is any prompt message. You can download it from http://www.oracle.com/technetwork/java/javase/downloads/index.html. If you cannot run the applet, refer to Chapter 8, Troubleshooting on a Proxmox Cluster, for troubleshooting.

Pay attention to OpenVZ-based VM; you will see that it cannot be accessed from the console because you have to configure a getty service inside the VM. So, we need to use another method for this purpose, for example, the OpenVZ management CLI:

  1. Access your Proxmox console with the root account, as shown in the following screenshot:

  2. You can check the existing running OpenVZ containers with the vzlist command as shown in the following screenshot:

  3. Then, access it with vzctl enter <CTID>, for example, vzctl enter 102.

  4. Create a new file under /etc/init.d/tty.conf with vi or any text editor you like.

  5. Paste the following code in the tty.conf file:

    # This service maintains agetty on tty1 from the point the 
    # system is started until it is shut down again.
    start on stopped rc RUNLEVEL=[2345]
    stop on runlevel [!2345]
    respawn
    exec /sbin/agetty -8 tty1 38400
    
  6. Reboot the guest VM or type start tty to reboot.