Ubuntu Server 18.04 – Creating virtual machines

How to Configure Network Static IP Address on Ubuntu 19.10

Now, the time has come to put your new virtual machine server to the test and create a virtual machine. At this point, I’m assuming that the following is true:

  • You’re able to connect to your KVM server via virt-manager
  • You’ve already copied one or more ISO images to the server
  • Your storage directory has at least 10 GB of space available
  • The KVM server has at least 512 MB of RAM free
  • Go ahead and open up virt-manager, and let’s get started
Before continuing, I highly recommend that you set up public key authentication for SSH between your workstation and virtual machine server. If you’re using a local connection, you won’t need to do this. But when you’re connecting to a remote KVM instance, without setting up public key authentication between your workstation and server, you will likely be asked for your SSH password repeatedly. It can be very annoying. If you haven’t used public key authentication for SSH yet, please refer back to Chapter 4, Connecting to Networks for an overview.

In virt-manager, right-click your server connection and click on New to start the process of creating a new virtual machine:

The first screen while setting up a new VM

The default selection will be on Local install media (ISO image or CDROM); leave this selection and click on Forward:

Creating a new VM and setting VM options

On the next screen, click on Browse to open up another window where you can select an ISO image you’ve downloaded. If you click on your ISO storage pool, you should see a list of ISO images you’ve downloaded. If you don’t see any ISO images here, you may need to click the refresh icon. In my sample server, I added an install image for the minimal version of Ubuntu, because it’s small and quick to download. You can use whatever operating system you prefer. Click on Choose Volume to confirm your selection:

Choosing an ISO image during VM creation

Next, you’ll be asked to allocate RAM and CPU resources to the virtual machine.¬†For most Linux distributions with no graphical user interface, 512 MB is plenty (unless your workload demands more). The resources you select here will depend on what you have available on your host. Click on Forward when you’ve finished allocating resources:

Adjusting RAM and CPU count for the new VM

Next, you’ll allocate free disk space for your virtual machine’s virtual hard disk. This space won’t be used up all at once; by default, KVM utilizes thin provisioning that basically just fills up the virtual disk as your VM needs space. You can select Allocate entire disk now if you’d like to claim all the space all at once, but that isn’t necessary. Click on Forward when done:

Allocating storage resources for the new VM

Finally, you’ll name your virtual machine. This won’t be the hostname of the virtual machine; it’s just the name you’ll see when you see the VM listed in virt-manager. When you click on Finish, the VM will start and it will automatically boot into the install ISO you’ve attached to the VM near the beginning of the process. The installation process for that operating system will then begin:

Naming the new virtual machine
When you click on the VM window, it will steal your keyboard and mouse and dedicate it to the window. Press Ctrl and Alt at the same time to release this control and regain full control of your keyboard and mouse.

Unfortunately, I can’t walk you through the installation process of your VM’s operating system, since there are hundreds of possible candidates you may be installing. If you’re installing another instance of Ubuntu Server, you can refer back to Chapter 1, Deploying Ubuntu Server, where we walked through the process. The process will be the same in the VM. From here, you should be able to create as many VMs as you need and have resources for.

Comments are closed.