Skip to content

Instantly share code, notes, and snippets.

@prasanjit-
Created February 4, 2019 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prasanjit-/10c306822e6681cf9217dfffe39f5c98 to your computer and use it in GitHub Desktop.
Save prasanjit-/10c306822e6681cf9217dfffe39f5c98 to your computer and use it in GitHub Desktop.
Proxmox Private Cloud

You've probably heard of terms such as KVM and OpenVZ, but until now, large data center virtualization operations were beyond the reach of most individuals or small organizations. In addition, many individuals and organizations face challenges with data privacy relating to having personal or customer data in a public cloud. A relatively simple and inexpensive solution is to run your own private cloud infrastructure inside your firewall.

Proxmox Virtual Environment (PVE) is based on Kernel-based Virtual Machine (KVM) hypervisor and OpenVZ, a solution for container based virtualization. PVE is easy to install and configure. Using its wizard installation and configuration and web-based management interface and consoles, you can have an easy-to-use virtualization environment in under an hour even if you have little experience in virtualization. PVE is made by Proxmox Server Solutions GmbH is a privately held corporation based in Vienna, Austria.

Once installed and configured, you can choose from a variety of easily downloadable OpenVZ container appliances based on TurnKey Linux (TKL) to solve many of the most demanding software development or business needs such as wikis, version control, databases, cloud infrastructure, continuous integration, and more.

Additionally, you can download or install a variety of open source operating systems as well as Microsoft Windows using downloaded ISO files or a physical installation disk.

This document uses the term host to refer to the Proxmox Virtual Environment server. The term guest refers to any virtual machine running on the host.

Choosing a machine

Pick a commodity PC for installation. I use cheap Dell machines from Micro Center such as this Dell Powerspec.

Before you buy, get the Intel processor model from the machine and google it. Check on intel's site that the processor supports Intel Virtualization Technology aka VT-x. You can run PVE without a VT-x capable chip, but it will be limited to OpenVZ container virtualization and will not be able to take advantage of KVM virtualization to run Windows or arbitrarily downloaded open source operating systems using ISO files.

The key for Proxmox is to find a machine that has as much RAM and hard disk as you can afford. A practical mininum is 8 GB RAM and 1 TB disk though you could get started with 4 GB and 250 MB disk. Ultimately, the RAM and disk will limit how many virtual machines you can run effectively.

A reasonable rule of thumb would be that each linux virtual machine requires 512 MB of RAM and 10 GB disk for a server install and 1 GB RAM and 20 GB of disk for a desktop install. Windows machines will generally perform better with 2 GB RAM and 30 GB of disk though you can get away with less in a pinch.

Installing Proxmox

  1. Download Proxmox VE 2.3 from the Proxmox website
  2. Burn it to a disk
  3. Insert the disk into the drive
  4. Boot the machine
  5. Press enter at the boot prompt
  6. Click the I agree button on the license agreement
  7. Click the next button on the Proxmox Virtualization Environment Installer
  8. Type your country in the country field
  9. Choose your timezone in the time zone field
  10. Choose your keyboard layout in the keyboard layout field
  11. Click the next button
  12. Type an administrator password in the password field
  13. Type the administrator password again in the confirm field
  14. Type your email address in the email field
  15. Click the next button
  16. Type your fully qualified domain name in the hostname field (for example: proxmox.local)
  17. Type your static IP address in the IP address field (on my network: 192.168.2.20 - yours may be different)
  18. Type your netmask in the netmask field (Mine is class C or 255.255.255.0, yours may be different)
  19. Type your network's default gateway in the Gateway field (Mine is 192.168.2.1, yours may be different)
  20. Type your network's DNS Server in the DNS server field (Mine is 192.168.2.1, yours may be different)
  21. Click the "next button*
  22. After the progress bar reaches 100%, click the reboot button

Congratulations! You've successfully installed PVE

Booting PVE

When PVE boots, there's not too much exciting stuff to see. You'll see a whole bunch of server gobbledygook roll by, most of which shouldn't matter to you. The only parts that matter are the last two bits that PVE spits out after booting. Proxmox will stop at a boot prompt. If you want to confirm that your administrator password is correct, you can type root at the proxmox login and type your password and you should get a prompt that looks like this:

root@proxmox:~# _

This step is optional as there's not a lot of exciting stuff to do at that prompt unless you're a Unix geek who wants to see what's going on in the system. If you did login as root, be sure to logout by typing logout at the prompt.

The more important thing to note at the tail of the boot process is this message:

Welcome to the Proxmox Virtual Environment. Pleasue use your web browser to configure this server - connect to:

https://192.168.2.20:8006/

Your IP address or hostname details will differ. But you should type that address being careful not to omit the https or the 8006 in your browser's address bar.

Note If you're running chrome, chrome will warn you that the Proxmox machine's certificate is self-signed. This is normal since it is self-signed. Just click the proceed anyway button.

About OpenVZ Containers

We'll begin by creating an OpenVZ container virtual machine based on a Turnkey Linux Appliance. We'll start out by creating the simplest possible virtual machine: one based on the linux operating system.

Wikipedia explains how OpenVZ containers work:

OpenVZ is not true virtualization but really containerization like FreeBSD Jails. Technologies like VMWare and Xen are more flexible in that they virtualize the entire machine and can run multiple operating systems and different kernel versions. OpenVZ uses a single patched Linux kernel and therefore can run only Linux, all containers share the same architecture and kernel version. However because it doesn't have the overhead of a true hypervisor, it is very fast and efficient.[citation needed] The disadvantage with this approach is the single kernel. All guests must function with the same kernel version that the host uses.

The advantages, however, are that memory allocation is soft in that memory not used in one virtual environment can be used by others or for disk caching. OpenVZ uses a common file system so each virtual environment is just a directory of files that is isolated using chroot, newer versions of OpenVZ also allow the container to have its own file system.[1] Thus a virtual machine can be cloned by just copying the files in one directory to another and creating a config file for the virtual machine and starting it.

source: Wikipedia

PVE's OpenVZ templates include a wide range of linux distributions including centos, debian, and ubuntu.

Downloading OpenVZ Container Templates

  1. In the PVE Server View on the left-hand side, click Datacenter, then Proxmox, then local (proxmox) in the tree
  2. Click the content tab in the list view on the right-hand side
  3. Click templates in the menu
  4. Scroll until you see * Section: system (9 items)
  5. Click your favorite linux distribution in the list - I chose debian 7.0
  6. Click the download button
  7. Wait for the OpenVZ container template to download to your PVE server

The system will display dots and primitive percentage lines as it downloads the template:

0K ........ ........ ........ ........ ........ ........  2%  256K 9m8s
3072K ........ ........ ........ ........ ........ ........  4%  111K 14m44s
6144K ........ ........ ........ ........ ........ ........  6%  123K 15m40s
9216K ........ ........ ........ ........ ........ ........  8%  123K 15m55s
12288K ........ ........ ........ ........ ........ ........ 10%  145K 15m23s
15360K ........ ........ ........ ........ ........ ........ 12%  116K 15m30s
18432K ........ ........ ........ ........ ........ ........ 14%  118K 15m25s
21504K ........ ........ ........ ........ ........ ........ 17%  145K 14m52s

PVE will store the template for future use so you only have to download it once. You can make as many virtual machines from a single template as you like.

If you need to cancel the download for any reason, simply click the status tab and click the stop menu button.

Once the template download has reached 100%, you should see something like this:

141312K ........ ........ ........ ........ .                100%  342K=12m10s

2013-04-06 19:36:53 (197 KB/s) - `/var/lib/vz/template/cache/debian-7.0-standard_7.0-1_i386.tar.gz.tmp.1748' saved [146906680/146906680]

download finished
TASK OK

At this point, you can close the window labeled Task Viewer: download by clicking the X at the top right of the window.

If you refresh your browser using Ctrl-R, Cmd-R, or F5, you will now see a single template in the template list.

Creating Your First Virtual Machine

  1. Click the Create CT button at the top right of the page. This will launch the Create OpenVZ container window.
  2. Type a hostname
  3. Type a password
  4. Type the password again in the confirm field
  5. Click the next button
  6. Select the template that you just downloaded in the template dropdown
  7. Click the next button
  8. Review the resources and adjust to suit or accept the defaults by clicking the next button
  9. Type an IP address into the IP address field
  10. Click next
  11. The default is to use the DNS settings from the PVE server, change this if you need different DNS settings
  12. Click next
  13. Review the settings
  14. Click finish

Proxmox spits out status information:

Creating container private area (/var/lib/vz/template/cache/debian-7.0-standard_7.0-1_i386.tar.gz)
Performing postcreate actions
CT configuration saved to /etc/pve/openvz/100.conf
Container private area was created
TASK OK

You can close the window by clicking the X at the top right of the window once you see TASK OK.

Notice that under the Server View tree the proxmox node now has a child node labeled with the hostname that you gave the virtual machine.

Congratulations! You've just created your first PVE virtual machine.

Starting Your Virtual Machine

The new virtual machine will not be booted by default. To start it running, do the following:

  1. Click on the Server View tree node corresponding to the new virtual machine that you just created
  2. Click the start button at the top right of the list view

** Accessing Your Virtual Machine Via Console

  1. Click the console button at the top right of the page
  2. A console window to your new virtual machine appears
  3. If you don't see a login prompt, hit the enter key
  4. Login with the username root and the password that you entered while setting up the VM guest

Stopping Your Virtual Machine

Normally, if you want to stop a virtual machine, you should shutdown so that the VM guest is able to shut down cleanly. However, if a VM guest is inoperable, you can click the stop button to stop it immediately without shutting down first.

  1. Click on your guest VM in the Server View Tree
  2. Click the shutdown button

Removing a VM

  1. Click on your guest VM in the Server View Tree
  2. Click the remove button
  3. Click yes in the dialog box to confirm removal

Proxbash: A Better Way To Create OpenVZ Container Virtual Machines

Creative Commons Attribution Share-Alike License

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment