In this tutorial, we will show you how to host your own Rust server on a Linux-based operating system.
Rust is a hugely popular multiplayer survival game. It is known for its gun, survival, building mechanics, and ability to host hundreds of players in the one-game world.
With no enforced player limit, some servers have player limits of 500. Of course, your mileage will vary greatly depending on your hardware and internet connection.
Linux is a great operating system for hosting game servers because it is fairly lightweight compared to Windows. This means that you will be able to play with even more players as you are getting more out of the same hardware.
One great thing is that you don’t need to own Rust to be able to host your server on Linux. The FacePunch team allows anyone to download and run the server.
The following steps are written with a focus on Debian-based operating systems such as Ubuntu. However, they should work for most other systems with some slight adjustments.
How to Install and Run the Rust Server on Linux
Over the following sections, we will walk you through the process of installing and running a Rust server on a Linux system.
These steps are relatively straightforward. They involve setting up SteamCMD to install the server itself and then writing a service to manage it.
Preparing Your Operating System
1. Before we install the Rust server on Linux we will need to download and install the SteamCMD tool. This tool is what allows you to download and install software directly through Steam without having to have the full client installed.
To get this tool installed to your device, be sure to follow our guide on installing SteamCMD on Linux.
https://pimylifeup.com/linux-steamcmd/
Creating a User to Run your Rust Server on Linux
2. Our next step is to create a user, which we will use to run the Rust server on your Linux system. We can create this user by using the useradd command.
It is good practice to run programs under separate users as it helps isolate them from parts of your system.
sudo useradd -m rust
3. To avoid the chance of running into permission issues, we will want to change to the “rust
” user we created in the previous step.
You can change to the user by using the following command.
sudo -u rust -s
4. Now that you have changes to the Rust user, you will want to change to its home directory by using the cd command followed by the tilde symbol.
cd ~
Installing the Rust Server on Linux using SteamCMD
5. We are finally at the point where we can download the Rust server onto our Linux system using the SteamCMD tool we downloaded earlier.
The command below will install the Rust server to the “/home/rust/server/
” directory.
/usr/games/steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir /home/rust/server +login anonymous +app_update 258550 +quit
6. With the server downloaded, we can exit and return to your normal user using the following command.
exit
Creating a Service for your Rust Server
7. Our next step is to create a service that will start and manage the Rust server on your Linux machine.
You can begin writing this service using the nano text editor with the command below.
sudo nano /etc/systemd/system/rustserver.service
8. In this file, type in the lines shown in the code block below. These lines define the service and how it should run Rust on your system.
Additionally, within this service we have added a command that will update your server before it starts.
While filling out this file, you must replace a few placeholders. You can add additional configuration here if you want but what we have included is a good base.
<WORLD_SEED>
: Use this placeholder to specify a seed that Rust will use to generate your map. Different seeds generate a different map.
This value can be a number between0
and2147483647
. For a default value, you can use “12345
“.<WORLD_SIZE>
: With this option, you can control the size of the world that your Rust server will generate. The larger the world the more RAM will be consumed.
The minimum world size is1000
, and the largest is6000
. A decent world size is typically4000
, but adjust this value to suit your needs.<MAX_PLAYERS>
: Replace this placeholder with the maximum number of players you want on your Linux Rust Server.
The more players you have, the more powerful CPU you will require.<SERVER_NAME>
: With this option, you can specify a name for your server.
This is how your server will be seen when shown in the server list.<SERVER_DESCRIPTION>
: Use this placeholder to specify a short description of your server.<INTERNAL_SERVER_NAME>
: This value needs to be replaced with an internal name used for your server. It shouldn’t contain any spaces or symbols.
It is safe to just use a name such as “server1
” in this field.<RCON_PASSWORD>
: RCON is a protocol allowing you to remotely control your Rust server without needing access to your Linux server.
Replace this placeholder with a secure password.
[Unit]
Description=Rust Dedicated Server
Wants=network-online.target
After=network-online.target
[Service]
Environment=SteamAppId=258550
Environment=LD_LIBRARY_PATH=/home/rust/server:$LD_LIBRARY_PATH
Type=simple
TimeoutSec=900
Restart=on-failure
RestartSec=10
KillSignal=SIGINT
User=rust
Group=rust
WorkingDirectory=/home/rust/server
ExecStartPre=/usr/games/steamcmd +@sSteamCmdForcePlatformType linux +force_install_dir /home/rust/server +login anonymous +app_update 258550 +quit
ExecStart=/home/rust/server/RustDedicated -batchmode \
+server.port 28015 \
+server.level "Procedural Map" \
+server.seed <WORLD_SEED> \
+server.worldsize <WORLD_SIZE> \
+server.maxplayers <MAX_PLAYERS> \
+server.hostname "<SERVER_NAME>" \
+server.description "<SERVER_DESCRIPTION>" \
+server.identity "<INTERNAL_SERVER_NAME>" \
+rcon.port 28016 \
+rcon.password "<RCON_PASSWORD>" \
+rcon.web 1
[Install]
WantedBy=multi-user.target
9. After writing out the service file, you can now save and quit by pressing CTRL + X, Y, and then ENTER.
Starting up the Rust Server on Linux
10. To get the Rust server to start whenever your Linux system boots, you must enable the service.
To enable the service, use the command below.
sudo systemctl enable rustserver
11. We are finally at the point where we can start the Rust server up.
You can start the server by simply using the following command within the terminal.
sudo systemctl start rustserver
12. Now, you should be able to connect and play on your Rust server. Simply use your servers IP address followed by the port 28015. For example, connecting locally to our server we use “192.168.0.23:28015
” as our address.
If you have a firewall running on your machine, ensure that you allow access through port 28015
.
Additionally, if you are running your server from your home and want outside access, port forward port 28015
to your server.
13. If you ever need to update your server, restarting the service will force an update.
You can restart the service by using the command below.
sudo systemctl restart rustserver
Conclusion
You should now have a Rust dedicated server up and running on your Linux machine.
Rust is one of those games that are truly special when you have other people to play with. Hosting your own server allows you to have a place where you can play with your friends without having to worry about other people ruining your experience.
Please comment below if you have any issues with getting this game server running on your machine.
If you found this tutorial to be helpful, we recommend exploring our other game server guides.
Hi Emmet,
1. Was wondering if there was a way of viewing the rust server output when you restart the service (the loading output). In windows when you run the batch file it shows the output live on the cmd window.
2. Also, I broke the whole thing the other day by adding a password to the “rust” user account as I wanted to access the data via FTP so needed a password on the account. so ended up rebuilding and installing the server and service via my admin account to get the ftp to work. Is there a way to add the password to the rust user/service so i can FTP in? (using vsftp by the way)
PS: Your guide is the best linux setup I’ve come across. There is a lot of trash out there!
Hi Sam,
1. You can view a live output of what the server is doing by using the following command. Please note that this is just the logs and is not interactive.
If you need an interactive shell then we would need to make some adjustments to the service.
2. Adding a password to the user shouldn’t break anything as far as I can tell at a quick glance.
First you would need to modify the user to have a password. Since it was a passwordless user you can’t simply set one.
Next, set the password you actually want to use for the rust user
Please let me know if that helps you. Also glad to hear that you have found this guide to be helpful!
Kind regards,
Emmet
Thank you so much for this guide! Really appreciate the time and effort you have put into this. 1 quick question. So how do I keep the Steam/Rust server up to date.
Hi Sam,
I am glad to hear that you liked the guide. To update the Rust server with the way we have set it up, all you need to do is restart the service.
During the start up of the Rust server service we wrote in this guide we run the “steamcmd” command to update the server before the server is started.
Please let me know if that helps answer your question.
Kind regards,
Emmet
Thanks Emmet that’s great! I saw this in the service config after I posted!