After rediscovering an old favorite in the Google Play Store, Terraria, a game I adored playing in my youth, I felt inspired to set up a server on my Proxmox server for some nostalgic gaming sessions during my downtime. To my surprise, I found that it was possible to connect to a standard desktop server using the Android version. A brief google search led me to TShock (https://github.com/Pryaxis/TShock), a community-maintained open-source Terraria server written in C# .NET 6.0, compatible with Linux, the option for plugins and better performance than the original. With this knowledge in hand, I started working on setting up my own server following these steps:

Setup a LXC Container on Proxmox

Start by creating a new LXC Container in your Proxmox Web GUI by clicking on “New CT”:

proxmox new ct button

Configure the ID, the hostname and set a password, or input your SSH key to access the container later.

proxmox container config

Select a Container template. I chose Debian 12 as I’m very familiar with Debian and like the OS, but Ubuntu does the same job fine.

proxmox container config

I think, as Terraria is not the most disk-intensive game, an 8GB rootfs will be enough for it. Keep in mind that you can always enlarge it afterwards.

proxmox container config

As I think the maximum player count the server will ever see will be my girlfriend and me, one CPU core and 1GB of RAM is going to handle everything with ease. Increase the values if you plan on having more players.

proxmox container config

proxmox container config

Setup the network config. I’ll be using a static IP. Change to DHCP if you want the easy way, but keep in mind that your server’s IP might change if you use DHCP!

proxmox container config

Keep the default DNS settings.

proxmox container config

Check everything on the summary page, and tick the “Start after created” checkbox if everything looks right. Proceed.

proxmox container config

Wait for the container to boot, and you’ll see the green triangle in your VM and Container list.

proxmox container config

Setting up the server

Now it’s time to connect to the server using your favorite SSH client and set up the TShock server. We’ll start by installing the latest .NET 6.0 version from Microsoft.

Visit: https://dotnet.microsoft.com/en-us/download/dotnet/6.0

Scroll down until you see the .NET Runtime, and click on “Package manager instructions”.

proxmox container config

Select the Debian OS (or other if you chose another), and follow the instructions on the site https://learn.microsoft.com/de-de/dotnet/core/install/linux-debian.

The first step should be to set up the Microsoft repository, which is done by executing these commands:

1
2
3
wget https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Now install the .NET Runtime.

1
apt install -y dotnet-runtime-6.0

If everything finished correctly, we’re able to start setting up the TShock server. We’ll start by grabbing the latest version from the GitHub releases: https://github.com/Pryaxis/TShock/releases/. Download the Linux x64 version using wget like this:

proxmox container config

1
wget https://github.com/Pryaxis/TShock/releases/download/v5.2.0/TShock-5.2-for-Terraria-1.4.4.9-linux-x64-Release.zip

Unzip it to the ./server/ folder.

1
unzip TShock-5.2-for-Terraria-1.4.4.9-linux-x64-Release.zip -d server

cd into the extracted server files and start the server.

1
2
cd server
./TShock.Server -c

You’ll be prompted to select a world or create a new one. As this is a new server, we create a new world by entering “n”. Then you’ll be prompted to configure the world.

proxmox container config

proxmox container config proxmox container config proxmox container config proxmox container config proxmox container config

Now select the world by typing the number and pressing enter.

proxmox container config

The server is going to prompt you for some more config stuff.

proxmox container config proxmox container config proxmox container config proxmox container config

When everything went well, you should see “Server started” in the output. At this point, you could connect to the server and start playing, but as soon as your SSH session goes down, the server will too. So we need to run the server in the background. To achieve that, let’s first stop the server by typing stop in its console.

proxmox container config

I’ll be using tmux to start the server in the background. To install tmux, run this command:

1
apt install tmux

Then simply run this command to start a new session:

1
tmux new -s terraria ./TShock.Server -c

It opens tmux and runs the Terraria server. Select your world and enter the config values, and your server should be up running again. You can now simply press CTRL+D to detach from the session, and your server will continue to run in the background. If you want to reconnect to the session, run this command.

1
tmux attach -t terraria

Autostart the Server on Boot

To autostart the server on container boot, we’ll create a systemd service file with the following content at /etc/systemd/system/terraria.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
[Unit]
Description=Terraria Server

[Service]
Type=forking
WorkingDirectory=/root/server/
ExecStart=/root/run_terraria.sh
ExecStop=/bin/tmux send-keys -t terraria 'stop' C-m
ExecStop=/bin/sleep 8
Restart=always
User=root

[Install]
WantedBy=multi-user.target

And a script to start the server at /root/run_terraria.sh

1
2
3
4
5
#!/bin/sh

cd /root/server
tmux new -d -s terraria ./TShock.Server -c
tmux send-keys -t terraria '1' C-m C-m C-m 'n' C-m C-m

Dont forget to make it executable.

1
chmod +x /root/run_terraria.sh

Now enable the systemd service, and your server should start on boot.

1
systemctl enable --now terraria

To enter the tmux session and control the server, simply run this command and press CTRL-D when you are done.

1
tmux attach -t terraria

If you need to modify some of the config, adjust the tmux send-keys command in the /root/run_terraria.sh script. Every C-m is sending an ENTER keystroke to the server. So, if you want to modify the player count, change the sequence to this. You’ll get the point.

1
2
# this allows 32 player to connect
'1' C-m '32' C-m C-m 'n' C-m C-m

Connect to the Server

As said, I’ll be using the Android version of Terraria, but the same goes for the desktop version.

proxmox container config

proxmox container config

proxmox container config

If you don’t see your server in the list, add it manually using its IP and the port you configured.

proxmox container config

Enjoy your self-hosted Terraria Server!

proxmox container config

To learn how to use plugins and do some advanced configuration, see the TShock wiki: https://ikebukuro.tshock.co/#/