> For the complete documentation index, see [llms.txt](https://docs.glesys.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.glesys.com/products/compute/vmware-virtual-machines/how-tos/create-virtual-machines.md).

# Create virtual machines

***

## Create a VMware VM using a template in the control panel

In the control panel, navigate to **Compute → Virtual machines** and then click **Create**. Alternatively, click the plus icon directly next to **Virtual machines** under **Compute** in the left-hand menu. The plus icon appears when hovering over **Virtual machines**.

<div align="left"><figure><img src="/files/uM3dGC3JxBAbUc0qSfqh" alt="" width="375"><figcaption></figcaption></figure></div>

### Basic configuration

At the top of the page, select **VMware** 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. It is also possible to select *None*, which allows you to install the operating system directly from an ISO. Instructions for this process are provided in the section [Create a VMware VM from an ISO file using the control panel](#create-a-vmware-vm-from-an-iso-file-using-the-control-panel).

In the **data center** dropdown menu, select the data center or region where you want to create your VM. 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.

<figure><img src="/files/WaibYmcqyO4A8KlrxWuw" alt=""><figcaption></figcaption></figure>

### Set a hostname

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

<div align="left" data-full-width="false"><figure><img src="/files/U87BKwrAVlrpoAqAvBCL" alt=""><figcaption></figcaption></figure></div>

#### **How to retrospectively modify the hostname**

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

{% tabs %}
{% tab title="Linux" %}
In Linux, change the hostname by utilizing the command `hostnamectl`:

{% code title="Command" %}

```
sudo hostnamectl set-hostname new-name.example.com
```

{% endcode %}

In this example, the hostname is changed to *new-name.example.com*.
{% endtab %}

{% tab title="Windows Server" %}
In Windows, you can change the hostname by going to **Settings** → **System** → **About** and clicking **Rename this PC**.

<div align="left"><figure><img src="/files/kGY86GHYIy5fuIn5krGo" alt="" width="563"><figcaption></figcaption></figure></div>
{% endtab %}
{% endtabs %}

### Add users

You also need to create one or more users. These users will be created on the virtual server 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**.

<div align="left"><figure><img src="/files/zfKKdwU7os489QZvkV5V" alt="Image showing how to add users in the UI"><figcaption></figcaption></figure></div>

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

#### **Linux 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, two saved keys named *glesys* and *glesys-2* are shown.

<div align="left"><figure><img src="/files/4cX44xNXDpnHz5EKVYR5" alt=""><figcaption></figcaption></figure></div>

It's also possible to manage your SSH keys using the [**SSH keys**](/products/compute/manage-ssh-keys.md) 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.

<div align="left"><figure><img src="/files/b3LWccY3gMajdbkIGW4F" alt=""><figcaption></figcaption></figure></div>

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.

{% tabs %}
{% tab title="Debian and Ubuntu" %}
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.

```yaml
## template: glesys
#cloud-config
{{> users }}
package_update: true
packages:
  - apache2
  - tmux
  - vim
write_files:
  - path: /var/www/html/index.html
    permissions: '0644'
    owner: 'root:root'
    content: |
      <!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>My very own webpage</title>
      </head>
      <body>
        <h1>My very own webpage</h1>
      </body>
      </html>
```

#### **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:

{% code title="Command" %}

```
sudo cloud-init clean
```

{% endcode %}

Cloud-init will execute all the commands again at the next server restart.
{% endtab %}

{% tab title="AlmaLinux and Fedora" %}
If you create an AlmaLinux server, paste the following snippet into the Cloud Config text field as an example. This will install the following packages: `vim`, `tmux`, and `httpd` (Apache2). A simple webpage will also be created. Additionally, Apache2 will be started, and the firewall will be configured to allow web traffic. Modify it to suit your needs.

```yaml
## template: glesys
#cloud-config
{{> users }}
package_update: true
packages:
  - httpd
  - tmux
  - vim
write_files:
  - path: /var/www/html/index.html
    permissions: '0644'
    owner: 'root:root'
    content: |
      <!DOCTYPE html>
      <html lang="en">
      <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>My very own webpage</title>
      </head>
      <body>
        <h1>My very own webpage</h1>
      </body>
      </html>
runcmd:
  - [ systemctl, enable, httpd.service ]
  - [ systemctl, start, httpd.service ]
  - [ firewall-cmd, --add-service=http, --permanent ]
  - [ firewall-cmd, --reload ]
```

#### **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:

{% code title="Command" %}

```
sudo cloud-init clean
```

{% endcode %}

Cloud-init will execute all the commands again at the next server restart.
{% endtab %}

{% tab title="Windows Server" %}
Cloud-config also works for Windows Server and uses the same syntax. An example of a cloud-config for Windows is shown here. Note that we use `{{> windowsUsers }}` in the template instead of `{{> users }}` as we do for Linux.

In the example below, the text “*Hello world”* will be written to the file `C:\test.txt`. After that, the NTP server in Windows will be changed to `gbg1.ntp.netnod.se`.

Finally, we will run the `echo` command, writing the text *"hello"* to `C:\output1.txt`.

```yaml
## template: glesys
#cloud-config
{{> windowsUsers }}
write_files:
   content: Hello world
   path: C:\test.txt
ntp:
  enabled: True
  servers: ['gbg1.ntp.netnod.se']
runcmd:
  - 'echo "hello" > C:\output1.txt'
```

{% endtab %}
{% endtabs %}

### 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*.

<div align="left"><figure><img src="/files/tKNTaXG4M4wRRhhktoLN" alt=""><figcaption></figcaption></figure></div>

It is possible to add more IP addresses to the VM later; however, you will need to configure them manually within the VM's operating system. Learn how to do this in the [Manage IP addresses](/products/compute/vmware-virtual-machines/how-tos/manage-virtual-machines.md#manage-ip-addresses) section.

### Choose resources

The final step is to choose how many 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 VM 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 VM configurations, click **Create Server**. Normally, it takes only a few seconds for the new VM to become ready.

<figure><img src="/files/YmhvKRIdli8CxeJB8GbI" alt=""><figcaption></figcaption></figure>

## Create a VMware VM from an ISO file using the control panel

In VMware, you can create empty servers where you install the operating system yourself from an ISO file. The advantage is that you can install operating systems for which there are no pre-configured templates. For example, Glesys currently offers ISO files for FreeBSD, OpenBSD, ArchLinux, pfSense, Slackware, Windows Server, and many other operating systems. This also allows you to configure the system exactly as you want.

### Basic configuration

At the top of the page, select **VMware** as the virtualization solution.

For the **template**, choose ***None***.

In the **data center** dropdown menu, select the data center or region where you want to create your VM. 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.

<figure><img src="/files/dV5i76kUhJ6wNhgw3vGU" alt=""><figcaption></figcaption></figure>

### Set a hostname

Next, assign a name to the virtual machine that will be used in the control panel.

### Choose IP addresses

This step involves selecting an IPv4 and IPv6 address for the VM. You will need to enter these as static IP addresses in the operating system during the installation process.

<div align="left"><figure><img src="/files/tKNTaXG4M4wRRhhktoLN" alt=""><figcaption></figcaption></figure></div>

### Choose resources

The final step is to choose how many resources you want the server to have. As you adjust the sliders, the server's price is updated.

These resources can be reconfigured later. 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 VM configurations, click **Create Server**. Normally, it takes only a few seconds for the new server to become ready.

<figure><img src="/files/YmhvKRIdli8CxeJB8GbI" alt=""><figcaption></figcaption></figure>

### Mount the ISO file and install the operating system

After the VM is created, scroll to the top of the page and click the **CD/DVD** tab. Here, you select the ISO file from which you want to install the operating system. In this example, we select FreeBSD 14.2. Then, click **Mount ISO**.

<figure><img src="/files/62HvWGcmrut8S2AyDJpi" alt=""><figcaption></figcaption></figure>

Now you need to start the server. This is done from the **Actions** menu for the VM. Here, click **Power on**.

<figure><img src="/files/rYlVpx3vrjtt9Te4ogyU" alt=""><figcaption></figcaption></figure>

Since the operating system now needs to be installed, you open the server's console. This can be found under **Actions** and then **Console**.

<figure><img src="/files/1hdPQNkLHpQp2hA3qOHw" alt=""><figcaption></figcaption></figure>

#### Example FreeBSD installation

The console opens, and you can install the operating system using the system's installation guide.

<figure><img src="/files/HP8vNmmqOA2u1WdYmuam" alt=""><figcaption></figcaption></figure>

Most of the time, the local keyboard layout works in VMware's console. In this example, select the current local keyboard layout—Swedish—in FreeBSD's installation program. If any issues arise with the keyboard, you can force US English layout by clicking **Enforce US Keyboard Layout** in the console. To switch back, click **Stop enforcing US Keyboard Layout**.

<figure><img src="/files/8h0Mvr0fMKz75ydNPXfI" alt=""><figcaption></figcaption></figure>

When you reach the networking section of the installation guide, you select static IP address configuration and enter the IP address assigned to the VM during its creation. To determine the IP address's subnet mask and gateway, look it up under **IP addresses** in the left-hand menu under **Networking**. Refer to the section [Find gateway and netmask](/products/connectivity/ip-addresses/how-tos/find-gateway-and-netmask.md) for instructions on where to find this information. Here, you also find details about Glesys DNS servers.

<figure><img src="/files/xAxYxaIQRpfYdtjoLiuK" alt=""><figcaption></figcaption></figure>

You select a static IP address for the IPv6 configuration as well if you want the server to be accessible over IPv6.

<figure><img src="/files/mhjbWDfwBvZLf6gbtrSU" alt=""><figcaption></figcaption></figure>

Since you have chosen a static configuration, you need to enter the addresses of the Glesys DNS servers manually.

<figure><img src="/files/jIkzAkLRpg2Bii8pEice" alt=""><figcaption></figcaption></figure>

When the installation of the operating system is complete, the VM restarts into the newly installed system. Once logged in, you can verify that the internet connection is working.

<figure><img src="/files/VZQy6OFieMhQe04mN5Z7" alt=""><figcaption></figcaption></figure>

## Create a VMware VM using the API

To create a VMware virtual machine using the Glesys [API](/platform/control-panel/api.md), use the [server/create](https://github.com/GleSYS/API-docs/wiki/API-Documentation#servercreate) endpoint.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.glesys.com/products/compute/vmware-virtual-machines/how-tos/create-virtual-machines.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
