Setup a Rust Game Server on CentOS

Updated on November 21, 2023
Setup a Rust Game Server on CentOS header image

In this article, I'll will explain how to install a Rust game server, which uses the Steam gaming platform. Follow the steps below to continue. This tutorial was written for CentOS 6.

Step 1: Installing the prerequisites

In order to host a Rust game server, you need a program called steamcmd. With that program, we can obtain all the required game server files and start the server. But first, we need to install some packages for Steam to work properly.

If you have a 32 bit installation, run this set of commands:

yum install glibc libstdc++ screen -y

For 64 bit installations of CentOS, use this set of commands:

yum install glibc.i686 libstdc++.i686 -y

Then, once you've finished installing your package set, execute the following:

yum groupinstall 'Development Tools' -y
yum install libX11-devel freetype-devel zlib-devel libxcb-devel -y
yum install libX11-devel -y 
yum install -y freetype freetype-devel -y

Namely, Steam requires the C/C++ runtimes installed to run properly. Alongside, this set of commands will install screen, a program that you can use to keep other programs running after disconnecting from your SSH/console session.

Step 2: Installing Rust

We'll create another user for security, because running the game server with the root user is dangerous. Feel free to change the user name, if you wish.

useradd rust
su rust

The useradd command will add the user, rust. The su command, will effectively change our current user to "rust".

Now that we're using the unprivileged user, we'll create the folder where Rust will run.

mkdir ~/game_server && cd ~/game_server

Now, let's get the Rust game server files.

wget http://playrust.com/wp-content/uploads/2015/04/Rust_Server.zip && unzip Rust_Server.zip

Because Rust requires Windows to run, we'll be installing a program named WINE. WINE (Wine Is Not a Emulator) is a program that allows us to use Windows software on Linux. The great part is that it's fairly simple to install.

cd /usr/src && wget http://skylineservers.dl.sourceforge.net/project/wine/Source/wine-1.7.50.tar.bz2 && tar xjf wine-1.7.50.tar.bz2

If you're running a 64-bit installation of CentOS, use these:

cd wine-1.7.50 && ./configure --enable-win64

If you're using the 32 bit version of CentOS, use this:

cd wine-1.7.50 && ./configure

To finish installing Wine, run:

make && make install

This will take a fair amount of time, so hang tight while Wine is being built.

Once Wine has finished compiling, execute:

cd /home/rust/game_server/steam
/usr/src/wine-1.7.50/wine64 steamcmd.exe +runscript ../update_script.txt
cd .. && cd rustds

Good job, you have successfully setup a Rust server.

Step 3: Usage

To start your Rust server, execute:

su rust
cd rustds
/usr/src/wine-1.7.50/wine64 RustDedicated.exe -batchmode +server.hostname "rust-server.localdomain" +server.port 28015 +server.identity "my_server" +server.seed 1234567 -logFile "output.txt" -autoupdate

This command will start a server with the hostname rust-server.localdomain, and the seed 1234567. If desired, you can change the server seed, the hostname, and any of the configurable options.

Conclusion

To conclude, you installed a Rust server - all that's left is to recruit some players!