Hosting your own Rust Server on Linux (Ubuntu) (Rust FacePunch Game)

Hanco Visagie
8 min readMay 1, 2024

--

Firstly, let’s state the obvious. The FacePunch documentation sucks.. and so do most other tutorials you will find on the internet.
Trying to figure out how to get started, I used various resources, including a number of forums with similar questions to ones I had.
You will find a complete list of references here.

Secondly, this tutorial will not go into details regarding installation of mods of any kind. The purpose of this tutorial is to explain and showcase the setup of a Rust server on your own machine or virtual machine without the need for a 3rd party hosting company. This will include the setup of SteamCMD, the configuration of your server startup script, server configuration files, the network configuration to make your server publicly accessible, and finally the final touches to configure the server to your liking.

For the purposes of this tutorial, I will be using a new Azure Virtual Machine running on Ubuntu Server 20.04 LTS to showcase every step of the process.

Without further ado, let’s get started.

SteamCMD

This should be the very first step, as this is required to download the Rust server files.

There are multiple ways to install steamcmd onto a Ubuntu machine, I will do it via the package manager of Ubuntu.

First run the following command:

sudo add-apt-repository multiverse; sudo dpkg --add-architecture i386; sudo apt update

Once this has completed, you should be able to install steamcmd by doing the following:

sudo apt install steamcmd

After installing steamcmd, in your home directory you should see a .steam directory, which is only visible with a ls -a command, see the output below: (Please note, if you don’t see the below, try running steamcmd and once completed quit to break out, then try again)

azureuser@vm-rusthosting-prod-euwest:~$ cd ~
azureuser@vm-rusthosting-prod-euwest:~$ ls -a
. .. .bash_history .bash_logout .bashrc .cache .config .profile .ssh .steam .sudo_as_admin_successful .viminfo
azureuser@vm-rusthosting-prod-euwest:~$

Next, you need to understand that rust will try to access a file called steamclient.so in the path ~/.steam/sdk64/steamclient.so, however this file is not there by default. Our next step is to create the missing file by running the below command. This will create the missing directory and copy the file.

mkdir ~/.steam/sdk64 && cp ~/.steam/steamcmd/linux64/steamclient.so  ~/.steam/sdk64/steamclient.so

If all the above steps completed successfully you should have a fully working steamcmd installed. This can be verified by running

steamcmd

Once all updates completed and you get the steam cli, you can quit by running the quit command. (See below)

azureuser@vm-rusthosting-prod-euwest:~$ steamcmd
tid(1285) burning pthread_key_t == 0 so we never use it
Redirecting stderr to '/home/azureuser/.steam/logs/stderr.txt'
Logging directory: '/home/azureuser/.steam/logs'
minidumps folder is set to /tmp/dumps
[ 0%] Checking for available updates...
[----] Verifying installation...
UpdateUI: skip show logoSteam Console Client (c) Valve Corporation - version 1709846822
-- type 'quit' to exit --
Loading Steam API...OK

Steam>quit
azureuser@vm-rusthosting-prod-euwest:~$

Rust Server Installation & Configuration

Once again we will need to launch steamcmd by running the steamcmd command. The next step is to make a rust directory in your home folder and download the Rust server files to this directory. We can do this by running the following commands.

mkdir ~/rust
steamcmd +force_install_dir ~/rust +login anonymous +app_update 258550 validate +quit

The above will take some time, this will download and verfiy all the server files. At the end you should see a message like the below:

Success! App '258550' fully installed.

The next step is to set up your server configuration specifically, to do this we need to create a few directories, a server.cfg file and finally a <your-server>-startup.sh script file. Obviously replacing <your-server> with the identity you will give your server. A server identity is an important concept to understand, this will be the unique identifier to target a specific server configuration, with all of it’s associated resources and configuration files.

For this example I will give my server an identity of mediumserver. I don’t know what the naming conventions are, and it is nowhere specified thus I recommend to stick to an identity without special characters and numbers. As this identity will nowhere publicly be used anyway, it doesn’t matter if it doesn’t 100% reflect your company/server name you want to assign it. The name other players will see your sever listed as in the Rust game, will be configured later.

Now that we have our identity, let’s create the missing directories and files.

First we browse to our rust installation directory:

cd ~/rust

Second, create a server directory, your identity name within the server directory and finally a cfg directory within your server directory:

mkdir server && cd server && mkdir mediumserver && cd mediumserver && mkdir cfg && cd cfg

Remember to replace both instances of mediumserver with your server identity. It is only unique per server, meaning if you would like to use mediumserver on your server as an identity that is perfectly fine. The only restriction is you cannot have the same identity on the same server.

If you now run the command pwd you should see similar output to the below:

/home/azureuser/rust/server/mediumserver/cfg

Third, create a configuration file called server.cfg in the cfg directory previously created.

I like to use vim as a text editor but feel free to use whatever you like. To create the file using vim we will do the following:

vim server.cfg

Then press the i button in the vim editor to enable write mode on the file.

Now the next part all depends on your preferences, but the contents of my configuration file looks like this.

server.queryport 28014
server.port 28015
app.port 28082
server.hostname "Medium's Server"
server.tags "monthly,vanilla,EU"
server.maxplayers 10
server.level "Procedural Map"
server.worldsize 3000
server.seed 439876134
server.description "Awesome!"
server.saveinterval 600
hackablelockedcrate.requiredhackseconds 600

after placing the contents, using vim I will now press the esc button then type (including the colon):

:wq

and finally press enter to save and exit vim. You can confirm the contents of the file by running the following command:

cat server.cfg

Lets discuss the most important options in your configuration file:

server.queryport is used to make your server accessible by the rust menu, so for your server to be listed in the server selection, you would need to specify a port and later we will open the ports.

server.port is used for the client to connect to your server. This is used internally by the game of course.

app.port is used to enable Rust+ connections

server.hostname is the name that will be displayed in the server browser of the rust game

server.tags enable players to filter on certain tags for your filter in the games’ server browser. All tags are available here.

The rest of the options are explained here.
PLEASE NOTE: Not all options can be configured in the server.cfg and some are not to be used in the startup script we will create next. There are very limited documentation on what can be used where, but what I do know is the RCON (Remote Console) can not be configured in the server.cfg, but has to be configured in the startup script, the rest as far as I can tell is fine to be in the server.cfg file.

Finally, lets create the startup file. I will place this file in the rust root directory (~/rust), you can place it on your desktop or anywhere else you like.

As mentioned previously, this file/script must contain the RCON configuration, and one other setting which is the server identity. This will tell rust where to get the server.cfg file for your server, ultimately setting up your server as you configured it. That is why it is very important to use your server identity consistently across all the steps.

To create the startup script, let’s first browse back to our root rust directory (or wherever you want to place it):

cd ~/rust
vim mediumserver_start.sh

And again following the same process as before to edit a file in vim, press the i button to allow editing.

The contents of my startup script is as below:

./RustDedicated -batchmode +server.identity "mediumserver" +rcon.port 28016 +rcon.password letmein +rcon.web 1

As mentioned a few times before, this server.identity must match 100% to the folder name you previously used for the server identity. Please also remember to change your rcon.password.

Once completed, press the esc button and type:

:wq

then press enter to save and close the file.

By default you should have owner permissions on the file if you created it but by chance that you can’t execute the startup script, we will also run the following command:

sudo chmod +x mediumserver_start.sh

Network Configuration

You now have your server configured. Finally it is time for the network configuration. As I am working on an Azure Virtual Machine, I don’t have a router to configure, but rather a virtual router or better known as an Azure Network Security Group (NSG), but you would need to make these changes in your router. They work exactly the same. If you are having troubles with this part, ask chat gpt to help you with your specific router model.

Depending on what services you want to enable, you need to open a limited number of inbound only ports. Let’s look at the following services.

28015 (UDP)— Rust Game [REQUIRED]: This port is required to be open for players to connect to your server.

28014 (UPD) — Rust Query [RECOMENDED]: This port allows your server to be discovered by the rust game server browser. Without this port open, you and your friends would need to connect to your server using the public IP address of the server. This can be done by pressing F1 in-game and typing client.connect 1.1.1.1:28015 where 1.1.1.1 refers to your public IP.

28016 (TCP) — RCON [OPTIONAL]: This is optional if you want to enable access to tools such as rcon.io to access your server.

28082 (TCP) — Rust+ [OPTIONAL]: This enables the Rust+ features and enables your server to connect to the Rust+ app of your players.

So as a recap, see the photo below for a full functioning server with all features enabled.

The only outbound requirement is internet which all routers should have by default.

Also see How to configure firewall for rust game server

PLEASE NOTE: If you have VPN connection, this might influence the inbound/outbound security rules and could prevent your server from functioning properly.

Starting the server.

Time for all your hard work to pay off.

You can now start the server by running the following command in the same directory as your startup script.

./mediumserver_start.sh

This will take a reasonable amount of time and you will probably get a bunch of errors. The messages you should be looking out for are:

Server Config Loaded
WebSocket RCon Started on 28016
Generating procedural map of size 3000 with seed 439876134

Should be of size and seed that you specified.

SteamServer Initialized
Server startup complete

And there you have it, a successful server startup on linux. You can now access your admin portal by using one of many rust admin tools, such as http://rcon.io. Specify your public IP, port (which if followed correctly should be 28016) and your password which you hopefully changed, but if not, should be letmein.

References

https://developer.valvesoftware.com/wiki/SteamCMD#Linux
https://wiki.facepunch.com/rust/Creating-a-server
https://umod.org/community/rust/35788-server-startup-creates-my-server-identity?__cf_chl_tk=iG5vO.8hfVr_nsj8hL6v080NG4Xu4aOrVI2uwySRbsU-1714575319-0.0.1.1-1429
https://github.com/SmartlyDressedGames/Unturned-3.x-Community/issues/2305
https://help.tempest.net/en/article/how-to-configure-firewall-for-rust-game-server-1hbjga3/
https://www.reddit.com/r/playrust/comments/4hdyaw/question_about_dedicated_server_startup_bat_and/
https://developer.valvesoftware.com/wiki/Rust_Dedicated_Server
https://wiki.facepunch.com/rust/rust-companion-server
https://oxidemod.org/threads/no-server-cfg.8276/page-2
https://oxidemod.org/threads/where-do-you-make-server-cfg.14095/
https://wiki.facepunch.com/rust/server-browser-tags
https://www.bestrusthosting.com/guides/how-to-configure-your-rust-server-all-options-explained/

--

--