Create virtual machines

Creating a new KVM VM is fast, and you can choose between various Linux and Windows images.


Create a KVM virtual machine using the control panel

Before creating your virtual machine, verify that you are in the correct organization and project. The server will be created for the organization and project you are currently working on.

In the control panel, navigate to Compute Virtual machines and select Create. Alternatively, click the plus icon next to Virtual machines when hovering the mouse.

Basic configuration

At the top of the page, select KVM as the virtualization solution.

You choose the image for your virtual machine in the template dropdown menu. Operating systems include Linux images (like AlmaLinux, Debian, and Ubuntu) and Windows Server.

In the data center dropdown menu, select the data center or region where you want to create your virtual machine. A suitable default has been selected for you; however, please choose the data center closest to you and your users to ensure optimal performance and minimal latency.

Set a hostname

Next, assign a name to the virtual machine that will be used in the control panel and as the server’s hostname.

How to retrospectively modify the hostname

Changing the hostname in the control panel later will not automatically update it on the virtual machine. To change the hostname, follow the guide below.

In Linux, change the hostname by utilizing the command hostnamectl:

In this example, the hostname is changed to new-name.example.com.

Add users

You also need to create one or more users. These users will be created on the virtual machine's operating system with sudo privileges in Linux and administrator rights in Windows. If you need to create regular users without administrator rights, you can add them manually to the VM's operating system later.

You can create multiple users by clicking Add user.

Image showing how to add users in the UI

Please note that the SSH key field is displayed only for Linux servers.

Linux servers and SSH keys

When creating users for a Linux system, you can provide them with an SSH key and a password. If you select both a key and a password, the user can log in over SSH using their key; however, password-based SSH login will be disabled as a security measure. However, the password can still be used to log in via the console in the control panel in case the user accidentally locks themselves out. With a password, the user must also enter it when using sudo. Without a password, the user can run sudo without any authentication.

Be aware that if any user lacks an SSH key, all users can log in via SSH using their password. This situation could present a security risk, as passwords are generally less secure than SSH keys.

You can save your SSH keys for the current project by clicking the SSH keys dropdown menu and selecting Add SSH key. The next time a new VM is created, you can choose the key directly from the dropdown menu. If you need to modify or delete a key, click Manage SSH keys in the same dropdown menu. In the image below, a saved key named glesys is shown.

It's also possible to manage your SSH keys using the SSH keys menu option in the left-hand menu.

Windows Server and SSH keys

You can't use SSH keys in Windows; otherwise, you create usernames and passwords as you do for Linux.

Provide user data with cloud-config (optional)

With cloud-config, you can automate the creation of new VMs, enabling more customization options than those available in the control panel. For example, you can install specific packages and change configuration files in the operating system. This occurs when the VM starts for the first time.

Click on Cloud config to expand the view.

Cloud-config is especially useful when creating multiple VMs with similar configurations. For example, suppose you need to create a dozen web servers for a project. In that case, you can create a cloud-config that automatically installs Apache, creates a webpage, starts Apache, and opens the firewall.

The commands included in the cloud-config are typically executed only during the system's initial startup. However, they can be executed again if needed.

When creating a Debian or Ubuntu server, paste the following snippet into the Cloud Config text field as an example. This will install the following packages: vim, tmux, and apache2. A simple webpage will also be created with the content specified under content. Modify it to suit your needs.

Verify the configuration

Now, you can try accessing the server's IP address in a web browser once it has started. You should see the text "My very own webpage."

You can verify that cloud-init executed the configuration file by reviewing the log files /var/log/cloud-init.log and /var/log/cloud-init-output.log. The second log file shows the output produced by the commands when executed.

Reviewing the files in the directory /var/lib/cloud is also possible. This includes, among other things, the complete cloud-config file that was executed, along with the expanded sections for {{> users}}.

Important note

Note that the first three lines of the text you pasted were the same as the pre-filled example when you expanded the cloud config section. These three lines are necessary. The lines ## template: glesys and {{> users }} are required to create users, add passwords, and generate SSH keys. The line #cloud-config indicates to cloud-init that the text should be interpreted as cloud-config.

If, for some reason, you need to rerun cloud-init, this is possible. However, remember that files may be overwritten, such as index.html in our example. To rerun the cloud-config, execute the following:

Cloud-init will execute all the commands again at the next server restart.

Choose IP addresses

This step involves selecting an IPv4 and IPv6 address for the server. Choose from the available IP addresses in the dropdown menus. You also have the option to select 'No IPv4' or 'No IPv6.' Note that if you have previously reserved one or more IP addresses, they will be listed at the top of the dropdown menu under Reserved IP addresses.

It is possible to add more IP addresses to the server later; however, you will need to configure them manually within the server's operating system. Learn how to do this in the Manage servers section.

You can enable automatic backups of your virtual server. This adds a cost to the server’s price depending on the frequency of the backups.

Here, you can select Daily Backups or Weekly Backups. Adjust the sliders to manage the number of backups to be retained. In the example below, seven daily and four weekly backups are saved. The backup schedule can be modified later if needed.

The backups are complete disk images of the virtual machine. These images can be used to create new VMs in the exact state the server was in when the backup was made.

It is also possible to create manual backups independently of the automatic backups.

Choose resources

The final step is to choose the amount of resources you want the virtual machine to have. As you adjust the sliders, the server's price is updated.

These resources can be reconfigured later without requiring a server restart. However, note that disk space is an exception; it can be increased later but not decreased. Other resources can be increased or decreased afterward.

When you are satisfied with all the server configurations, click Create Server. Normally, it takes only a few seconds for the new server to become ready.

Create VMs using the API

Use the server/create endpoint to create a VM using the API.

Last updated

Was this helpful?