In this tutorial, we will go over how to get a Godot dedicated server up and running on a virtual private server (VPS) running Ubuntu Linux.
This tutorial assumes you already have a VPS with Ubuntu running. There are many companies that allow you to rent VPS’ for very cheap and some even free.
First you need to export your Godot project using the Linux preset. We will only need the .pck file.
It’s also possible to export to other platforms by compiling the server build of Godot. You can find more specific instructions on the official Godot documentation.
SSH into the Server
We then need to SSH into the (VPS) server using the terminal.
If you’re using Windows 10, I highly recommend Windows Terminal. It allows you to create multiple tabs and use the various command line tools that Windows uses such as Command Prompt, PowerShell, and WSL all in one program. It also features more robust visual customization options than the various tools offer on their own.
I will be using Powershell through Windows Terminal in this tutorial, but you can just use regular Powershell too.
First you’ll need the IP address of your server, as well as the login credentials of the user. Your VPS provider should give you this information once you’ve spun one up.
SSH into your VPS. Replace the IP address with the IP address of your VPS. The -l argument defines the username you are logging in as.
ssh 127.0.0.1 -l root
It’s possible you will get an warning that the authenticity of the host can’t be established.
The authenticity of host can’t be established.
ECDSA key fingerprint is SHA256.
Are you sure you want to continue connecting (yes/no)?
If you are renting the VPS from a reputable company, you can safely ignore this warning. Type ‘yes’ to continue.
Next you will be prompted to enter the password.
As you type, there will be no indication that you have typed anything. This is a standard Linux security feature. It ensures that people watching your screen as you type in your password cannot see how many characters long your password is.
Create a New User
Next we will want to create a new user. The root user has all permissions to edit and change anything and everything in the system. Running third-party software, such as the Godot server build, under these permissions can be a major security risk if the software hasn’t been thoroughly tested. It is safer to create a new user which by default will have more restricted permissions and run programs from that new user’s profile.
You will be prompted to set a password for the new user. This will also create a home directory for them. If it asks for you to enter additional information, you can just leave those fields blank.
Let’s navigate to the home directory of the new user. First we need to use
cd command to change directory up.
You can use the ls command to list the contents of the current directory.
Enter the home directory.
And then enter the directory of the user you created.
We now need to switch our user to the new one we created.
We alternatively could have switched users first. And then changed directories with
cd ~ which brings you to your user’s home directory. But I wanted to show you the
ls commands just in case you were unfamiliar.
Transfer the .pck File to the Home Directory
We now need to tranfer the .pck file from our local machine to the VPS. This can be done in the terminal. But you may find a GUI with drag-and-drop features to be more approachable. Just search for an FTP client. I personally use FileZilla since it’s open source.
I will show you how to both transfer the file with the terminal and an FTP client. But you only need to do one of them.
Using the terminal
Open a new terminal tab or window. For this next part we will work from our local machine. Navigate to where you exported the .pck file on your computer using the
Once you are there, use the
scp command to secure copy the file to the VPS. Be sure to your .pck filename, your VPS’ IP address, and your new user you created. The
~ symbol means we are tranferring to the home directory of the user.
scp .\GameServer.pck firstname.lastname@example.org:~
If you go back to the terminal tab/window you used to
ssh in, and list the contents of the home directory, you should now see file existing on the server.
Using an FTP Client
Most FTP clients have you enter the server’s credentials at the top. Your computer’s files are listed on the left. The server’s files are listed on the right. You can drag and drop the files between the two machines.
Download the Godot Linux Server Build
Go to your web browser and navigate to https://godotengine.org/download/server.
Go to the Linux Server tab. The server build removes all visual elements from your game and includes other optimizations for running on servers.
We need to grab the link location. We will be downloading this file directly from the VPS.
Right-click on the appropiate Server (64-bit) button and copy the link location.
Go back to the terminal tab where you are ssh’d in to the server. We will download the Godot server build directly to the server.
Once its finished downloading, we need to unzip the .zip file.
Check if your Linux server has the
unzip program installed. My Ubuntu server did not, so I will have to install that software.
If you try to install
unzip using the new user, you will get a permission-denied error.
We need to change back to the root user.
And then install
apt install unzip
Change the user back to your new user. Again, we don’t want to run third-party softare with root permissions.
Unzip the .zip file.
Run the new Godot server file, specifying our .pck file as an argument. We use the
./ syntax to denote from the current directory run this program.
./Godot_v3.2.3-stable_linux_server.64 --main-pack FPSServer.pck
Your Godot dedicated server is now running! Change the IP address you are connecting to in your client. You and your friend’s can now test your game.