Virtual machines Proxmox............................
Stuart Burns shows you how to take your first steps in virtualising servers using the ProxMox virtualisation platform.
Stuart Burns shows you how to take your first steps into virtualising servers using the ProxMox virtualisation platform.
Many readers will be familiar with using desktop virtualisation products such as VirtualBox or VMwareWorkstation. These types of virtualisation products are known as ‘type two hypervisors’, which essentially run on top of the operating system alongside normal applications. As solutions they are useful, but they do have limitations. They are not designed to run applications 24/7. Not least because if you have to reboot the underlying PC (or worse, it crashes) all the virtual machines will also have to be rebooted. Type one hypervisors, on the other hand, are designed to run on dedicated hardware that’s as near to bare metal as possible for the best possible performance gains and stability. ProxMox is a type one hypervisor (as are VMware ESXi and Hyper-V).
ProxMox is a hypervisor platform based on Debian with a KVM virtualisation suite sitting on top – with an easy-to-use GUI to make things even easier. ProxMox also supports containers if so desired. What makes ProxMox stand out as an ideal Linux-based first choice is that the majority of the administration tasks don’t require using the command line. The KVM command line toolset is also available under the hood via SSH. All the functions are available in the free version, however we still recommend showing support by buying a support contract if you can, to show support for all the free-to-use goodness.
For this introduction to ProxMox the reader will need to have a reasonably modern PC or server with a bare minimum of 1GB of RAM. In the real world 4GB is a more reasonable starting point to do anything useful. ProxMox also requires two reasonably sized hard disks. A burnt copy of the ProxMox 4.4 Installation media will also be required. It can be downloaded at www.proxmox.com/en/downloads along with various documentation.
Installing the hypervisor
To start installing your ProxMox server, boot from the 4.4 installation CD-ROM that you burnt earlier and follow the few installation steps. The initial installation splash screen presents a number of options. For the purposes of this article select the highlighted entry Install ProxMox VE or just press the Enter key. On the following screen accept the licence by clicking the ‘I agree’ button on the right-hand side.
The next screen deals with the hard disk configuration. ProxMox will install on the first available disk (usually the sda disk). There are additional advanced options that be configured such as disk format or disk layout. Ext4 is the default, but options including ZFS and other disk configurations are available. In a production environment, the boot device should be mirrored to prevent a failure that would cause an outage to the host and therefore the virtual machines. All done? Click to the next page on the wizard.
The ProxMox installation is designed to be as easy, trouble-free and quick to perform as possible. There are very few questions and most of them are obvious. One quirk is that anyone looking for the UK keyboard will find that it is under Britain rather than United Kingdom. The installer will ask for several pieces of information including country, email address and network configuration details. Setting the country will also automatically configure the time zone and the keyboard layout. The email address used needs to be realworld one or you may be unable to get a ProxMox support account set up properly.
On the last screen that requires interaction the administrator will need to configure the IP address, DNS and hostname. By default, the network options will be filled with a DHCP-obtained network configuration where available. It is strongly recommended that a static IP is used. Setting up a DNS entry for the server ahead of time is also highly advisable, the default one needs to be changed irrespective. Type your network configuration over the DHCP-obtained settings. Finally, once the install is complete the final screen invites the user to reboot.
The administrator will also need to set a root password. Once the system installation is complete it will need to be rebooted. After the reboot an administrator can navigate to the IP address given on the console screen.
Login to that URL using HTTP and port 8006. As an example, our URL is:
https://10.0.0.40:8006
At the login prompt use the username ‘root’ with the password that was set during the install earlier. Depending on the configuration in question you may get a browser security certificate warning. Accepting the local SSL certificate will be OK in this instance. If so desired, the ProxMox server can use LDAP/AD authentication once configured, although that’s beyond the scope of this introduction to ProxMox. In the meantime, welcome to the management console where most of the administrative duties are performed!
At this point, a notice will pop up notifying the user that there is no support contract in place. Don’t worry about that – ProxMox is free to use as you see fit. No contract is required. That said, a support contract can be always be useful and your money is always welcome.
To understand how the console works, first know that there are several different views available. To change the current view, select the desired view from the view dropdown list in the top left-hand corner. Depending on the view the hosts, disks, clusters will all appear in the leftmost column. To the right of this is the menu area that consists of both a ribbon section along the top and a set of hyperlinks to the left. It is in this portion of the window that most of the configuration will be done. It is important to note that the pulldown menu on the left-hand side exposes different options and configurations depending on the option selected. Therefore, if an item appears to be missing, double check the context/view being used.
Virtual beginners
ProxMox has a lot of flexibility and can be used in either a standalone setup, or clustered setups that use shared storage and multiple ProxMox hosts with features such as live migration and HA (High Availability), where if a host fails the affected VMs restart on another available host. By default, the single host that we installed earlier has been configured and will appear under the root object called ‘DataCenter’. Additional hosts (if added) will be added under the DataCenter object.
Note that it is possible to cluster several ProxMox hosts together and use shared storage to provide high availability. Setting up a cluster requires additional configuration. Best practice after installation is to ensure that the host operating system is up to date. This can be done by navigating to the ProxMox host in the server view (not the DataCenter view) and selecting Upgrade from the left-hand menu. These
updates upgrade the ProxMox host to the latest community edition. Doing this also installs some applications such as parted that are needed further on in this tutorial, so please don’t skip it.
Adding ProxMox users
Using the root account is not a wise idea for various reasons. It is advisable to create a new user for each administrative user. In our configuration, the user database is stored locally. Add a new admin user by selecting Permissions from the lefthand menu, Permissions > Users and then Add from the menu bar. Add the desired user’s Unix name, first name and other details as required. Leave realm and group settings as they are. Click Add to add the user.
Assigning roles is done by using the permissions. With the root DataCenter items selected from the left-hand menu select Permissions > Add. To assign admin rights to the new user select Add > User Permissions from the tool ribbon. The path should be set to ‘/’, ie, the root. Select the user from the drop-down box and then the role. Select the administrator role from the drop down to give full admin rights. It is possible to create customised roles if required. The administrator can also set rights at the folder level.
Configuring local storage
By default, the boot disk is restricted to the first disk, with very little space allocated for virtual machines irrespective of actual disk size. The administrator will need to use the second disk. That said, there is room on the first disk to install a very small (sub 10GB) VM if desired. In the configuration shown, we have added a second physical disk to store the virtual machines on. ProxMox does support a range of storage subsystems including ISCSI, NFS and other storage infrastructure. It is not possible to add raw or formatted local disks. All locally attached disks must be configured to use LVM (Logical Volume Management)
Setting up the second disk does require a few simple command line entries. To add the second disk to the ProxMox host ssh in the ProxMox server as root (root login is allowed by default) using the root account and password. In this situation, the administrator can use the gparted tool to create a second LVM based disk. To create this second disk, use the following commands. It is assumed the second disk is sdb, but your mileage may vary:
ssh root@10.0.0.0.40 (Substituting your ProxMox IP address and the password set in the installer) parted --script /dev/sdb mklabel gpt parted -- /dev/sdb mkpart primary ext2 1 -1 parted /dev/sdb set 1 lvm on vgcreate newData /dev/sdb1
If you receive the error message that parted isn’t installed you can install it using this command: apt-get –y install parted
Once the disk has been partitioned use the pvcreate command as shown below to create the physical volume (PV) of the LVM disk: pvcreate /dev/sdb1
At this point the newly configured LVM disk can be made available to the ProxMox System for storage. To add the new storage, select the DataCenter view and then from the ribbon button ribbon select Add. This will expand and present a number of possible options. Select LVM from the dropdown list. The first field is for human readable names (making them short and useful is the best practice. Spaces are not allowed.) Finally, select the newly created disk from earlier in the volume group dropdown field. The newly created LVM disk should appear in the dropdown list. Once you click OK the storage is added to the server. It is also possible to create a storage area specifically for ISO files.
By default, the newly created disk can store virtual machines and containers but you can use any volume available. To restrict the usage of storage to certain types,
open the content dropdown list and select the desired options. In this example, we are leaving this as default. Depending on the storage format there are additional options available, for example ISO, backups etc.
With regards to network setups, the connection previously set up during the installation functions as a network bridge to allow other virtual machines to appear on the network. In other words, the virtual guests and devices will appear on the same network as that of the ProxMox server. Now is the time to upload ISO images for the desired virtualised servers that will be created. To upload the install disks select the server view in the web management console and navigate to the local disk. This exposes all the disks, so click the new disk. The Upload button should be available from the menu ribbon above them. Click Upload and select the local ISO image on your local system. This will take several minutes for the system to ingest and make available to the ProxMox host.
Creating machines
To create a virtual machine ensure that Server view is selected and click Create VM from the top right button cluster. This opens the VM creation wizard. Each virtual machine is assigned a unique number (ID) starting at 100. On this first screen give the server a name (the name field) avoiding using any spaces. Leave all the other settings as they are and click Next.
The next screen will display a variety of Linux and Windows installation flavours. In this example we’re going to install a copy of Ubuntu Linux server so select Linux 4.x/3.x/2.6 Kernel. This will enable the system to use optimal defaults for the version of the OS. It will cause the wizard to default to optimal configuration options in terms of disk types. On the hard disk menu leave most of the options as default. The only field you may wish to change in this example is disk size. Click Next. On the CPU tab we suggest using two sockets and leave the rest as defaults.
Memory is a little more complicated. By default, the administrator can appoint a fixed amount of RAM. However, it is also possible to be a little more flexible with the RAM configuration. It is also permissible to set more flexible minimums and maximums.
Since the early days of the 3.x kernel, KVM guest support has been built-in. Click the Linux 4.x radio button followed by Next. Using the Ubuntu image uploaded earlier (selected by default), select the disk that contains the ISO image from the dropdown list. Select the ISO image to use (ie, the one uploaded earlier) and click next to go to the disk configuration page. On the next page leave the networking as is for our simple example. Finally follow this up with confirmation of the VM creation by clicking Finish.
On the next screen set up the disks as appropriate. The default selections are appropriate for this basic installation. On the next page, We’d advise setting the RAM usage to 512MB or even better 1024MB so that the VM has a reasonable amount of memory to work with when running. Leave the network as default and then confirm the setup.
An entry should appear in the task list. Once completed, click the console button (right-hand side). This will give access to the console and enable the user to interact with it. At this point the administrator should be able to install their choice of Linux. Most modern distros will work without issue out of the box, with the optimised virtualisation drivers being built into the kernel.
To start installing Ubuntu on the VM navigate to the newly created VM and click Start from the button ribbon at the top right of the page. Opening the console window will allow direct interaction with the VM console. This installation is identical to a normal Ubuntu installation. On completion, it should be as simple as using SSH to remotely manage the server.
ProxMox also supports a range of Windows servers if so desired. Unfortunately, the virtualisation drivers are not natively built-in to Windows. The installation therefore gets a bit more complex and the administrator will need to install boot-time drivers during installation.
This walkthrough barely scratches the surface of what can be done using ProxMox. It is an easy to use but also powerful and capable hypervisor. As administrators become more used to ProxMox, they can begin experimenting with the underlying KVM tools and other functionality, such as setting up clusters with additional hosts and using shared storage. These features take ProxMox to a new level of usability. More information can be found on the ProxMox website and forums if the administrator wants to develop their setup further.