Hosting your own Rust Server on Linux

In this tutorial, we will show you how to host your own Rust server on a Linux-based operating system.

Rust Dedicated Server Linux

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 setting up Rust on our Linux system, we should ensure we have an updated operating system to work off of.

These first two commands update the package list and upgrade any out-of-date packages.

sudo apt update
sudo apt upgrade -y

2. After updating your operating system, you will want to install the “software-properties-common” package.

This package will be used to add additional repositories to your package list.

sudo apt install software-properties-common

Installing the SteamCMD Client

3. For our next step, we will need to install the SteamCMD client on our system. This tool will allow us to download the Rust server on Linux and keep it updated.

Our first step is to add the “i386” architecture to our package manager.

sudo dpkg --add-architecture i386

4. If you are on an Ubuntu system, we must add the multiverse repository. The reason for this is that SteamCMD is closed source and is not provided through the default repositories.

Luckily, adding that repository is as simple as using the following command.

sudo add-apt-repository multiverse

Alternatively, if you use a different system, like Debian, you will want to try using the command below to add the “non-free” repository.

sudo add-apt-repository non-free

5. Since we changed the available package architectures and repositories, we must update the package cache.

You can update the package cache by running the command below.

sudo apt update

6. Finally, we can install the SteamCMD tool that is needed to download the Rust server using the command below within the terminal. It is also the same tool that will allow us to easily update the game server later.

sudo apt install steamcmd

Creating a User to Run your Rust Server on Linux

7. 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

8. 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

9. 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

10. 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

11. 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

12. 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

13. 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 between 0 and 2147483647. 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 is 1000, and the largest is 6000. A decent world size is typically 4000, 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
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

14. 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

15. 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

16. 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

17. 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.

18. 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.

Leave a Reply

Your email address will not be published. Required fields are marked *