February 4, 2018 by Daniel P. Clark

ProxMox; A VM Server For Your Home

Some months ago a friend gave me his old Hackintosh computer to work with.  So I have wiped the computer clean and installed ProxMox onto it.  ProxMox is a headless Linux distribution which lets you install as many operating systems as you want in the space available.  It can run Windows, Mac, Linux, and other operating systems simultaneously.  You can see the OSes boot in a window through your browser when on your ProxMox IP address.  The full desktop is viewable right there in your browser.

There is a limitation of the desktop resolution being 1024×768 in that window.  But if you set up VNC on the operating system you can boot that OS into whatever screen size works for you and simply VNC into it.  Of course most server distros you’ll load onto ProxMox won’t be desktop oriented but rather command line accessible and may have headless web applications to access so the resolution size isn’t a big concern.

One awesome thing I’ve found is that it’s fairly trivial to take any VM image available online and convert it and use it within ProxMox.  More on that later.

CT vs VM

CT is a container virtual machine that shares the same kernel as the ProxMox system host.  It’s faster to install, start up, and more durable.  During a motherboard overclock experiment I had to reset my motherboards BIOS which caused all of my VMs to be come unusable/lost (UPDATE: just a BIOS setting to change to get VM working again) but my CTs all still work.  There are lots of templates available for containers to download including many popular frameworks and CMS systems.  A great deal of which come from TurnKeyLinux.org.  Unlike the typical Docker container or a Heroku instance these containers will persist changes.  So make backups of desired states along the way.

VM images will allow you to run completely different operating systems, such as Windows or Macintosh, in a more contained environment.  Windows is a simple install but Mac will take a great deal of effort.  I like installing different Linux distros as VMs as well, such as Kali Linux for evaluating my own systems network security.  Be sure to backup your VMs so you won’t lose them when the BIOS is reset or perhaps hard drive order gets re-arranged.  I may write a post on a backup solution whenever I work out a good system for myself on this… I have some ideas. Done… see below.

Converting a Virtual Machine Image

I’m a big fan of Bitnami for getting VMs, frameworks, and full system framework installs.    If you click on their “application” section you may click on any system you want to install and on the right they will have a link for VMs.  Click that and at the bottom they will give you two options to download one OVA image and one VMDK.  Download the VMDK, rename it to an iso extension and upload it via your ProxMox template upload page.  You can then shell into your ProxMox server and locate the file at /var/lib/vz/template/iso and rename it back.

Next you’ll want to convert the vmdk file to a raw disk image with the following command

Now you have the raw drive image for your virtual machine.  Install a normal VM in ProxMox for linux and set the disk space to the same size as the raw image.  Once ProxMox has finished creating it you can then go back to your shell and use the dd command to overwrite the provisioned VM drive with the raw VM image you converted earlier.  The command would look something like this:

Be sure to match the disk name for the VM you provisioned.

Once this is done the VM will be good to start up and you’re good to go.

Installing CT Tips

When installing a container I highly recommend you copy your public SSH key into the SSH key input.  This will allow you to shell in from your main computer without needing to remember a password as your systems SSH key will verify itself.  When you have a lot of VMs this makes working with them a lot quicker to get around.  Also when needing to copy files securely between systems a quick scp command works with no hassle.

Adding Hard Drive Space [TODO/WIP]

The place where all your virtual machines and containers get installed to is a virtual drive which you can combine many hard drives as one into.  I currently can’t find the instructions I used to accomplish that but when I do I place them here.

From what I remember I used the fdisk command to format the drives into something like LVM (if that’s an option).  Once that’s done you use a command to merge that drive into the existing pool named pve/data.  I’ll update this when I have more info.

Creating Remote System Backup

My VM Server has plenty of room for installs but very little room for system backups.  So I looked in to how I may remotely backup each of my VMs and CTs and found a tool called sshfs.  So you can use ssh for a remote secure file system mount point to mount locally.

On the ProxMox system you’ll want to make sure you get these installed:

It’s likely your system will only have to install sshfs.

On the “other computer” where you will be backing up your files to you should create an account from which the ProxMox will ssh into.

This will get you as far as having the sshfs user and rsa keys useful for ssh‘ing in/out.  Next you should run cat on your ProxMox system to get your public key.

Copy the text it spits out that looks like what I have above back to the “other computer” into a file in ~/.ssh/authorized_keys .  This will allow ProxMox to ssh in as the user sshfs without needing to enter a password and making mounting a simple thing.

The last thing you will need to do on the “other computer” is create a directory where the backups will go.  Make sure you do it with the sshfs user or at least change the directory’s ownership to that user.  In my case I created a folder at /mnt/raid/proxmox_backup .

Now on the ProxMox system you will need to do the following.  Add this line to the end of your /etc/auto.master file:

Be sure to leave a blank line after it. Then make a mount point where you’ll mount the remote directory.

And add the following line to /etc/auto.sshfs

Be sure to leave a blank line after it.  The first piece of the line needs to be the local backup directory.  The last part :sshfs\#[email protected]\:/mnt/raid/proxmox_backup is the sshfs instruction, remote username, the IP address of the “other computer”, and lastly the directory on the “other computer” to mount.  The IdentityFile field is mandatory.

Then on your ProxMox system run:

The df -h command will show all mounted paths.  The last one should look like:

Woah!  Do you see that?  We get the size and usage of the remote drive on the system.  That’s pretty cool.  In my setup the raid folder is a btrfs file system which works great for me.

Now on the ProxMox web interface you need to go click on Datacenter then click on Storage then Add then Directory and give it a name SystemBackup and the directory /mnt/backups then under the drop down Content select VZDump Backup File.  And there you have it!  Now you can individually go to each of your VMs/CTs and backup to the “other computer”.  If you’d like you may schedule backups as well.

Hardware

Depending on what you want to do may determine your hardware requirements, but this is what I recommend.  Where two core CPUs is an option I would recommend a four core minimum.  The more core the better.  As for speed I started out with a i5-3570k Inetl Processor and the speed was acceptable, but I’ve overclocked it from 3.4GHz to about 4.3GHz (1.225 Volts) and that runs so much better!

I started out with 8GB at the system default speed of 1333MHz but found that major OS full desktop VMs like to have about 6GB of RAM so that will limit running multiple OSes.  I’ve since upgraded to 16GBs of RAM running at their Profile1 setting of 1600MHz (these need to run in normal mode as setting the BIOS to turbo mode the RAM causes system failures for me).  Now I can fully run the majority of major OSes on my system along with multiple Linux server CTs/VMs.  It’s feels nice having these contained systems and the many options they provide.

I recommend the first drive be a SSD of around 120GB (40GB becomes the ProxMox main host and acts as your CT/VM image installer storage).  Then you can add as many drives as you want to the pool of varying sizes, whatever large drives you can scrounge up.

One last tip I’ll recommend for your system is you’ll probably want a really fast NiC installed as copying large files between systems will be a frequent thing once you implement a backup system.

Summary

ProxMox is pretty fantastic with many options for configuring system startup in VMs, system CPU and memory utilization, networking defaults and firewalls, and multiple node spawning/sharing if you have more than one computer running ProxMox.  It’s been a good experience as my first time trying a VM server.  Although finding out specifics for drive pool addition took some digging online.  It’s still well worth getting set up.

#container#CT#hardware#linux#mac#network#proxmox#server#virtual machine#VM#Windows