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.
Step 2: From the list of cloud providers, select Hetzner Cloud. Next, select the “Deploy Server Automatically” to create a new server.
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.
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.
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.
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.
Step 3: After copying the key, go back to the RunCloud dashboard and click on “Add API Key“.
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.
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”.
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.
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.
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.
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.
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/id_ed25519.pub“.
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.
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”.
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.
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.
Give a suitable name to your firewall rule and click “Create Firewall“.
Creating A New Hetzner Cloud Server
Go to the Servers submenu and click on “Add Server” to create a new server.
Pick the location of your server and select the OS image that you want to use. RunCloud recommends using Ubuntu 22.04.
Select the server size – more powerful servers cost more. We recommend starting with cheap servers to avoid unexpected costs.
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.
Next we will select the firewall rule that we created in the Creating A Firewall Rule step.
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.
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.
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.
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.
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.
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.
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.
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.
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”.
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.