Creating a VM on Hetzner

From Delft Solutions
Revision as of 05:15, 4 July 2024 by Tannaz (talk | contribs) (Created page with "== Creating a Virtual Server (VM) on Hetzner == === Step 1: Generate an RSA Key Pair === First, you need to create an RSA key pair to have a public key for your server. >> ssh-keygen -t rsa === Step 2: Create an account on Hetzner to get access to their development cloud === === Step 3: Set Up a Virtual Server on Hetzner === Ensure you have access to create a virtual server on Hetzner. Follow the instructions in this article to create a cloud server on the Hetzner Cloud...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Creating a Virtual Server (VM) on Hetzner

Step 1: Generate an RSA Key Pair

First, you need to create an RSA key pair to have a public key for your server. >> ssh-keygen -t rsa

Step 2: Create an account on Hetzner to get access to their development cloud

Step 3: Set Up a Virtual Server on Hetzner

Ensure you have access to create a virtual server on Hetzner. Follow the instructions in this article to create a cloud server on the Hetzner Cloud Console: Creating a Server on Hetzner.

Step 4: Configure Your Server

You will likely need both IPv4 and IPv6 addresses for your VM, so make sure to configure both. Choose the latest version of Debian as your operating system and complete the configuration based on your needs. Name the server properly using the format <your-name server>.dev.delftsolutions.nl, replacing <your-name> with your actual name server. Once configured, purchase your virtual server. This will take you to the new virtual server page, where you can see both your IPv4 and IPv6 addresses.

Step 5: Update DNS Repository

Add your IPv4 and IPv6 addresses to the DNS-basic repository and create a merge request. For the IPv6 make sure “/64” at the end is replaced by 1 just like other IPv6s in the script. And try to make the format like the other lines. Make sure

Step 6: Generate a Fingerprint

Your VM will generate a fingerprint to recognize you. This fingerprint acts as a unique identifier for the server and is stored locally. Use the following command to add the fingerprint to the DNS system: >> ssh-keyscan -D <your-virtual-server-IPv4>

This command will generate a fingerprint that you need to add to the DNS-basic repository (make sure to remove any lines starting with a semicolon and replace the first IP to your name, again just like the other lines in there).

Step 7: Test Your Virtual Server

To ensure your virtual server is working correctly, use these commands: >> dig @ns1.delftsolutions.nl. >> dig <your-name-server> @ns1.delftsolutions.nl. >> dig <your-name-server>

These commands will verify if your name server is functioning properly and if you have access to ns1.delftsolutions.nl. But these commands are fun to do, they are not necessary :)

Step 8: SSH into Your Virtual Server

Once everything is verified and functioning correctly, you can SSH into your virtual server using the following command: >> ssh root@<your-name-server>

Replace <your-name-server> with the actual name of your server, using root before your name server means you want to be root to make changes in your virtual server. When it is your first time to get access to your virtual server it will ask you “Are you sure you want to continue connecting (yes/no/[fingerprint])?” and when you say yes, you will be permanently added to the host, and you need to enter the passphrase of your RSA key pair. Then boom, you have your virtual server :)