Setting up a cloud server to host your website can be a daunting task, especially if you are not experienced in server management. However, with the right cloud provider and management tools, the process can be made significantly easier. 

RunCloud supports many different cloud providers, including Hetzner, a well-known cloud provider that offers reliable, affordable, and flexible cloud solutions. In this article, we will guide you on how to set up your Hetzner cloud server to host your website with the help of RunCloud, a server management platform that simplifies server management experience. 

How To Deploy A Server Automatically

Configuring The Settings

Step 1: Start by opening your RunCloud dashboard and open the ‘Servers’ tab. Click on the “Connect a Server” button to deploy a new server.

RunCloud Dashboard Connect Your First Server

Step 2: From the list of cloud providers, select Hetzner Cloud. Next, select the “Deploy Server Automatically” to create a new server.

Selecting Cloud Provider RunCloud

Step 3: Select your preferred installation type, native or containerized.

Next, you need to select whether you want to use Nginx or OpenLiteSpeed. If you are unsure, pick Native installation with OpenLiteSpeed stack. 

Learn more about containerization on RunCloud, OpenLiteSpeed vs. NGINX.

Selecting tech stack on RunCloud

Integrating Hetzner Account With RunCloud Dashboard

You only need to do this step once. If you have already added your Hetzner API key to your RunCloud dashboard then you can skip this step.

Step 1: Open your Hetzner Cloud dashboard in a new browser tab and select the project that you want to use. Now navigate to the “Security” submenu and open the “API tokens” tab. 

Creating API token On Hetzner

Step 2: Click on “Generate API token” to make a fresh key. Give it a suitable description for your reference.

Make sure to select the “Read & Write” option while creating the key.

Finally click on the “Generate API token” to create the key.

Generating an API token on Hetzner

Step 3: After the key is created, it will only be displayed once. Make sure to copy it and add it to RunCloud before closing the dialog box. If you have accidentally closed the box, then you’ll need to delete the existing key and create another one.

For security reasons, it is NOT recommended to save the keys in a text file. 

Successful creation of API token on Hetzne

Step 3: After copying the key, go back to the RunCloud dashboard and click on “Add API Key“.

Adding an API key on RunCloud

Step 4: Paste your API token and give it a descriptive label. Click on the “Test Integration” button to check your connection. If you did everything correctly then you should see a Success pop-up.

Now you can click on “Add API Key” to complete the integration.

Successful testing of API key on RunCloud

Deploying The Server

Step 1: Now you should be able to use the key that we just added to create a server automatically. If you can’t see the new key in the drop-down menu then try refreshing the page. Select the key and click “Next”.

Selecting the API Key on RunCloud

Step 2: Next you need to specify your Operating system, region, and instance type. RunCloud recommends using Ubuntu 22.04 LTS in the region closest to most of your customers.

Now pick the instance type based on your needs. If this is your first time creating a website, we recommend using the cheapest option.

Selecting Pricing plans on Hetzner

Step 3: Now scroll down to the bottom and give a suitable name to this server. You also need to acknowledge that Hetzner will bill you directly for any resources that you use. After this you can click on the “Add Server” button to deploy your server.

This step usually takes 5-10 minutes as RunCloud creates a new server, runs a preliminary inspection, and installs basic tools and dependencies on the server before it can be used to host a web application.

Optionally, you can go back to your Hetzner dashboard to confirm that this created a new server with desired configuration in your account.

Note: Hetzner charges extra for public IPv4 addresses, and you might be billed for an amount slightly higher than what is shown in RunCloud dashboard. The prices shown here should only be treated as an approximation, and you should refer to Hetzner Cloud pricing plans for updated information.

Hetzner dashboard server overview

After you have finished setting up your server, you can move on to Installing WordPress with RunCloud.

Deleting the Server

If you no longer want to use the server, then you should delete it to avoid unnecessary charges. Scroll down to the bottom of the Server Settings page and click on the “Delete Server” button. Confirm that you want to delete the server by specifying its name and click “Proceed to Delete”.

This will permanently delete the server along with any web applications that were deployed on it, and Hetzner will no longer bill you for this server.

Deleting RunCloud Server via API

How To Deploy A Server Manually 

Creating An SSH Key

We need to add an SSH key to our Hetzner account to access the servers. If you have an existing key, you can use that, or you can create a new key-pair by running the following command in Windows PowerShell:

ssh-keygen -t ed25519

You will be asked to specify the location of the key, and enter a passphrase. Press ‘Enter‘ to select the default settings and store your key without any password.

Creating SSH key in Powershell

During the key creation process, two new files will be created – a public key and a private key. After you have created the key, you will get a message saying “Your public key has been saved in …” In the above example, our key was saved in “C:\Users\user/.ssh/“. 

You can use your favorite text editor to view the public key; we used the cat command to view the contents of the key. We will use the private key to connect to the server via SSH. In the above example, our public ssh key is:

ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAYZ+GefPeMeossXzW9Jr/K48s6kBBzdEiO2iWOGKwCa user@deck-stop

Copy the public key and open the Hetzner dashboard. Open a project and head over to the Security sub-menu. Click on the “Add SSH key” button to add a new key.

Adding SSH key on Hetzner

Paste your key, give it a descriptive name, and set it as the default key. Finally, click on “Add SSH key” to save the changes.

Creating A Firewall Rule

We need to create a firewall rule which allows TCP traffic on ports 80, 443, and 34210 so that RunCloud can communicate with the server properly.

Head over to the Firewalls tab and click on “Create Firewall”.

Creating a Firewall Rule on Hetzner

Add new rules to allow incoming TCP connections on ports 80, 443, and 34210. We will be connecting to our server via SSH to set it up.

Add another rule to allow TCP connections on port 22 – you can delete this rule later if you like.

Adding new firewall rules for RunCloud

Leave the Outbound rules unchanged to allow all outgoing traffic. In the “Apply to” section, create a new selector. We will use this selector to mark our servers so that this firewall rule is applied to them.

Configuring firewall selector on RunCloud

Give a suitable name to your firewall rule and click “Create Firewall“.

successful creation of firewall rule on Hetzner

Creating A New Hetzner Cloud Server

Go to the Servers submenu and click on “Add Server” to create a new server.

Adding a server on Hetzner Cloud

Pick the location of your server and select the OS image that you want to use. RunCloud recommends using Ubuntu 22.04.

Selecting Operating System on Hetzner Cloud

Select the server size – more powerful servers cost more. We recommend starting with cheap servers to avoid unexpected costs.

Selecting Machine size on Hetzner Cloud

We plan to host a website on this server which will be accessible from the internet, and so we will need an IP address to do so. Our desired settings are already selected, so we left the network settings unchanged. 

We also note that the SSH key which we just created in the Creating A SSH Key step was selected by default. 

Configuring SSH key on Hetzner Cloud

Next we will select the firewall rule that we created in the Creating A Firewall Rule step.

Setting RunCloud Firewall Rule

Give a suitable name to your machine, verify all the settings, and click “Create” to deploy the server. After the server is created, note down the Public IP address of the server.

Successful Creation of new Server on Hetzner

Connecting The Hetzner Cloud Server To RunCloud

Go to your RunCloud dashboard and click “Connect a Server”. Pick Hetzner Cloud and select “Connect via IP Address” to add the server manually.

Connecting a Server in RunCloud via IP address

Select the installation type and pick the server stack that you want to use. Enter a suitable name for your server and provide its IP address. You can find this address in the Hetzner dashboard.

Setting IP address of Hetzner Server

Connecting To The Server via SSH

Now we need to log into the server to install the RunCloud agent. We use the following SSH command in Windows PowerShell to log in:

ssh root@<ip address> -i <identity file>

In the above command, replace the <ip address> with the IP address of your server, and <identity file> with the path to your identity file. 

Connecting to server via SSH

In the above example, our SSH command was:

ssh [email protected] -i C:\Users\user/.ssh/id_ed25519

If you are connecting to the server for the first time, you will be prompted to verify the fingerprint of the address. Type ‘yes’ and press ‘Enter‘.

Installing the RunCloud Agent 

After logging into the server, we can install the RunCloud agent. Go back to the RunCloud setup process and switch to the “Manual Installation” tab.

Installing RunCloud Agent

Copy the given command and paste it in your PowerShell window, then press ‘Enter‘ to run it on the Hetzner server. This step takes 10-15 minutes to complete.

Executing installation script

After the installation is complete, you can type ‘exit‘ in PowerShell to close the connection to the server. You can type ‘exit’ again to close the PowerShell window as well.

Successful installation of RunCloud Agent

Deleting Your Server

If you have created a server manually, you will need to delete it manually, both from Hetzner and RunCloud.

Go to the Hetzner Cloud dashboard, open the server that you want to delete, and go to the “Delete” tab. Click on the “Delete Server” button and confirm your action by entering the name of the server.

After you have deleted the server, you will no longer be able to access its contents – be sure to make any backups beforehand.

Deleting Hetzner Server

After deleting the server from Hetzner, we need to delete it from the RunCloud as well. Go to the settings menu of the server and scroll down to the bottom. Click on “Delete Server”, confirm by entering the name of the server, and click “Proceed to Delete”.

Deleting server manually on RunCloud

Video Tutorial – Setup Hetzner Server With RunCloud

Next Steps

Using Hetzner and RunCloud as your cloud provider and server management platform respectively is a wise choice. After the initial setup, new servers can be launched with only a few clicks. 

If you are not already using RunCloud to manage your servers, you can start doing so today. Sign up for our free trial and see how it makes server management more effective and easy.

After you have finished setting up our server, you should read about How To Install WordPress and How To Install Magento with RunCloud.