Proxmox 04 - Linux Virtual Machine

Jarret B

Well-Known Member
Staff member
Joined
May 22, 2017
Messages
454
Reaction score
519
Credits
19,511
The heart of a Proxmox Server is setting up Virtual Machines (VM) and Linux Containers (LXC). In this article, we will look at setting up a virtual machine running Linux.

It really doesn't matter which Linux distro, since they basically all install similarly. So, we will install Linux Mint 22.2 XFCE as a virtual machine.

Installation Media

The first thing to do is download the ISO file needed for the installation of Linux Mint.

I downloaded version 22.2 XFCE from 'https://linuxmint.com/edition.php?id=323' and saved it to your local system where you use the Web User Interface (UI), not on the Proxmox Server. There may be a different version or even another distro you would prefer. All the steps are the same, except for the actual installation of the distro after booting from the ISO. The steps for booting the media is important to know.

NOTE: Keep in mind that if you are running Proxmox on an x86-64 system, then your virtual machines can only be based on x86-64.

After downloading the ISO, you open the Web UI. Find the Node to which you want to install the VM. For me, it is 'PVE1'. Under the selected Node, are a listing of the storage devices, for example:
  • localnetwork (pve1)
  • local (pve1)
  • local-lvm (pve1)
Select the 'local' storage. In the middle pane, there will be an option for 'ISO Images'. Select 'ISO Images' and then in the right pane should be a listing of all ISO images you have placed on the Proxmox Server. My current screen, as shown in Figure 1, shows that I have no ISO images downloaded to the server.

Figure 01.JPG

FIGURE 1

Click on 'Upload', which is in the top middle of the Proxmox screen. After you click it, you will see a window like in Figure 2.

Figure 02.JPG

FIGURE 2

You can click on the 'Select File' button to locate the ISO file. Once selected, it fills in the name and file size for the window. If you have a hash for the file, you can select the type, such as 'SHA-256'. From the Linux Mint website, where I downloaded the file, there is a button for the SHA-256 checksum information. The information it gave was 'dea13e523dca28e3aa48d90167a6368c63e1b3251492115417fdbf648551558f *linuxmint-22.2-xfce-64bit.iso', but all I need is the first part of 'dea13e523dca28e3aa48d90167a6368c63e1b3251492115417fdbf648551558f'. So, I place this checksum value in the box for 'Checksum' after I specify the 'Hash Algorithm' type to match the value.

You do not need to validate the checksum, but it is sometimes best to verify the ISO file.

Once you have all the fields filled in, you can click on 'Upload'.

It will start the upload to the '/var/tmp' folder on the Proxmox server. Once it copies it to the '/var/tmp' folder, it will perform the checksum test if you specified one. After that completes successfully, it will copy the ISO to '/var/lib/vz/template/iso/'.

The other option we have for downloading images to the Proxmox Server is to have the server download the file directly from the internet. If you select the button 'Download from URL', then you need to find the download link, copy it and paste it into the entry for 'URL', as shown in Figure 3.

Figure 03.JPG

FIGURE 3

After you paste in the link, click on 'Query URL' and if the URL is valid, it fills i the rest of the entries, except for the hash information. These two entries you need to fill in yourself if you want to perform the check.

When you fill in all the entries that you need to, click on 'Download' to begin the download of the specified file from the Internet.

After you download the ISO, or have the server download it from the Internet, the system lists it in the right pane, and it is ready to create a VM.

Create a Virtual Machine

You need to select the Node on which you downloaded the ISO, in my case 'pve1'. In the upper right is a button labeled 'Create VM'. Click the button to create the VM. The window, as shown in Figure 4, should appear.

Figure 04.JPG

FIGURE 4

You can see here that we have eight tabs:
  1. General
  2. OS
  3. System
  4. Disks
  5. CPU
  6. Memory
  7. Network
  8. Confirm
So, we have settings to configure on nearly these tabs. And you must set up the first two tabs before you can continue to the rest.

On the 'General' tab, as shown previously in Figure 4, the Node should be the same as the Node you selected before creating the VM. The 'VMID' is an ID associated with each VM and LXC, and the numbers start at 100 and count up as you create more virtual machines or Linux containers. The 'Name' is the entry you need to be concerned with. This is the name of the virtual machine. Click 'Next' after you add the name of the VM.

At the 'OS' tab, shown in Figure 5, you can choose whether to boot the OS from an image, physical media, or no media at all. It sets the storage to 'local', which is where it saves the virtual machine by default. For the 'ISO image', you can click on the sown arrow to get a list of the ISO images that are on the local media that you previously put on the server. Next, set a 'Type' for the OS you are virtualizing. So, in my example, I am installing Linux Mint, so the 'Type' will be Linux. Set the version to the kernel version being used, which in my example is '6.x - 2.6 Kernel'.

Figure 05.JPG

FIGURE 5

If your Proxmox server had an optical drive, you can burn the ISO to a CD/DVD and choose to install from physical media.

After you have made your choices, click on 'Next'.

On the 'System' tab, you can configure the system hardware. I show the 'System' tab in Figure 6. Here, you can change the GPU, Motherboard type (Machine), BIOS (or UEFI) and SCSI Controller. You also enable TPM support and QEMU Agent. The QEMU Agent is like the VirtualBox Guest Additions. Usually, the defaults work fine. Click 'Next' when you have made your selections.

Figure 06.JPG

FIGURE 6

For the 'Disks' tab, you usually only need to worry about 'Disk Size (GiB)' that normally defaults to '32'. If you need more or less storage space for the VM, then you should change it. Click 'Next' when you have finished the tab, as shown in Figure 7.

Figure 07.JPG

FIGURE 7

On the 'CPU' tab, in Figure 8, you can change the 'Sockets' and 'Cores'. The 'Sockets' should be set to how many physical CPUs are on the Proxmox server. The number of 'Cores' is how many system cores are dedicated to the VM. You can also set the CPU Type for the specific VM. As stated before, you only have the choice of CPU types that are compatible with x86-64. Click 'Next'.

Figure 08.JPG

FIGURE 8

For the 'Memory' tab, you can set the amount of RAM to set aside for the VM from the Proxmox Server. This is shown in Figure 9. When done setting the amount of RAM, click on 'Next'.

Figure 09.JPG

FIGURE 9

The last tab is 'Network'. We can change settings on the Network Interface Card (NIC) for the VM, as in Figure 10. We can choose which 'Bridge' to use for the VM to access the network. Each Virtual Machine Bridge (vmbr) can be assigned to a different NIC, or multiple bridges to one NIC. When creating a VM, you can use the same bridge, or a different bridge for various virtual machines. You can also set the 'Model' to a specific card type. Click 'Next'.

Figure 10.JPG

FIGURE 10

The last tab, the 'Summary' tab, is shown in Figure 11 and allows you to look over some choices you made throughout all tabs. Here, you can go back to a specific tab and make any changes you need. You also have a checkbox to start the VM as soon as it is created. If you select 'Finish', the VM will be created. If you did not check the box to auto-start the VM after creation, then you need to start it. In the left pane, there should be a new object created under the Node. The name of the object is the VMID followed by the name of the VM in parentheses. Select the VM, and in the top right should be a button with the label 'Start'. By clicking this button, the VM will start, and you can then click on 'Console' in the middle pane to see the VM display so you can perform the installation as normal. You can look at how this appears in Figure 12.

Figure 11.JPG

FIGURE 11

Figure 12.JPG

FIGURE 12

In Figure 13, you can see that there is a small arrow just to the right of the middle pane in the center of the screen. If you click this, it expands to produce the same buttons as in Figure 13. If you choose the middle option, the screen with the two arrows pointing out, then the Virtual Display will switch to full screen. To exit out of full-screen mode, you can press Escape or press the little button again to undo the full screen.

Figure 13.JPG

FIGURE 13

Start the installation of Linux Mint, or whichever distro you chose, and after you configure all the choices and the install formats the drive and copies files, you can click on 'Summary' in the middle pane, right above 'Console'. In 'Summary', you can see the usage information for the CPU and RAM. There is more information here, and you can see if a VM is maxing out the CPU or RAM allocations. If it is hitting 100% quite a bit during normal use, not the install, then increase the hardware allotment that you assigned it.

If you switch back to the 'Console' and get an error like in Figure 14, just click the window behind it and it will disappear.

Figure 14.JPG

FIGURE 14

After the distro is installed, you will need to click on 'Hardware', which is right below 'Console' to double click on the CD/DVD and change the media to 'Do not use any media' so the ISO will not boot again during the restart.

After the reboot, the distro restarts, and I can perform an update and upgrade. During the upgrade, I can see in the 'Summary' window that the memory is hitting over 90%. So, I can reconfigure the VM and add more RAM in the 'Hardware' window. Of course, the change does not take effect until I reboot the VM.

QEMU Agent

During the configuration of the virtual machine, specifically on the 'System' tab, there was a checkbox for the QEMU Agent. If you look in the 'Summary' window, there is a section at the bottom of the first box that lists 'IPs' and it says the Guest Agent is not running. So, we need to get it installed and started.

We can install the QEMU Guest with the command:

Code:
sudo apt install qemu-guest-agent -y

The service is installed, but not started. Perform the following command to start the service and then make sure it restarts every time the VM starts:

Code:
sudo systemctl start qemu-guest-agent
sudo systemctl enable qemu-guest-agent

Once you start the service, you can look back at the 'IPs' line in 'Summary' and see that it now should show the IP address of the VM.

Conclusion

This is a basic rundown of setting up a VM. I hope to go into more detail on the settings that were in the configuration. We simply accepted the defaults, and it worked fine.

If you are following along, you may try to add another VM using a different distro. This will give you practice uploading an ISO as well as setting up the VM.
 


Follow Linux.org

Staff online

Members online


Top