How to create your own Rust Server
Prerequisites
- Windows WSL 2 → https://docs.microsoft.com/en-us/windows/wsl/install-win10
- Docker for windows → https://hub.docker.com/editions/community/docker-ce-desktop-windows/
- Docker Linux → https://docs.docker.com/engine/install/ubuntu/
- Port forward the following ports: 28015, 28016, 8080 both TCP and UDP to your computer that is hosting the server.
System requirements
- 4 GB RAM Minimum for the server
- i7 7700K
- 25GB Space
Server Setup
The aim of this guide is to host a server you and a small group of friends 20 people maximum. If you want to host a large server with 50 people or more, then you would need to look into a dedicated solution. This is mainly due to the fact of the upload speed that most home broadband connections have aren’t good enough for large scale servers.
Download and Run Docker container
A docker container can thought of as a very light weight VM that you execute application inside. But we are using it because there is already server that is pre-built for us.
DockerHub Link: https://hub.docker.com/r/didstopia/rust-server
Reference Docker Flags: https://docs.docker.com/engine/reference/run/
Open your Terminal or Ubuntu Terminal App (Windows), copy and paste the following:
docker run --name rust-server --restart -d --memory="4g" \
-p 28015:28015 -p 28015:28015/udp -p 28016:28016 -p 8080:8080 \
-e RUST_SERVER_NAME=<SERVER_NAME> -e RUST_SERVER_WORLDSIZE=3500 -e RUST_RCON_PASSWORD=<CHANGE ME> \
-e RUST_OXIDE_ENABLED=1 \
-v <WHERE_YOU_WANT_SAVE_YOUR_SERVER>:/steamcmd/rust \
didstopia/rust-server
Okay, this looks like it’s doing a lot but we can break it down. You can just use this command to get a server up and running.
- memory=”4g” Limits the container to only use 4G of RAM if you have performance issue increase this.
- -P allows a port to talk from the container to your window host machine. The defaults will just fine, if you need to change them do the following:
<PORT>:28015 <PORT>:28016 <PORT>:8080
- -v stands volume you need to change
<WHERE_YOU_WANT_SAVE_SERVER>
to the place where you want to keep your server on your machine. For example on a folder on your desktop. - Change the password for rcon
<CHANGE ME>
- Change the server name
<SERVER_NAME>
- You can see more options here -> https://hub.docker.com/r/didstopia/rust-server
Connect to the server from the Rust Game
- Start the Rust game from stream
- Wait until you can see the main menu
- Press
F1
then copy and pasteclient.connect <HOST_IP>:28015
into the terminal that has opened and hit enter - First time you connect it might take a few minutes
Useful docker commands
Start Rust Server
If you already have the container there i.e you have already used docker run
command.
docker start rust-server
Stop Rust Server
docker stop rust-server
Remove Rust Server
This is need if you want to change anything in the create command, you will need to remove and create the server again. Keep -v <WHERE_YOU_WANT_SAVE_YOUR_SERVER>
the same if you want to use the same server that you had before.
docker rm -f rust-server
Look at the Rust Server logs
docker logs rust-server
Check how much CPU and RAM the server is using
docker stats rust-server
Useful Server Commands
https://rust.fandom.com/wiki/Server_Commands
Issuing commands to rust server
docker exec rust-server rcon <command>
Example Command
docker exec rust-server rcon fps
Set someone as teleport TP user 1 to user 2
docker exec rust-server rcon teleport "<rust_name_1>" "<rust_name_2>"
Save Server
docker exec rust-server rcon "server.save"
Set Time
docker exec rust-server rcon "env.time 12"
Turn off decay for buildings
docker exec rust-server rcon "decay.upkeep false"
Install Rust IO Map
- http://playrust.io/manual/#!index.md#Installation
- You need to save your ddl in the
<WHERE_YOU_WANT_SAVE_YOUR_SERVER>
folder on your computer.