Skip to content

Instantly share code, notes, and snippets.

Last active Jul 6, 2020
What would you like to do?
Terraria server on a DO droplet

Running Terraria on a DO droplet

Code from Debugging my Terraria Server's Startup. for my server (if up).

This runs in a detached screen, managed by systemd.

You can download the server itself off the official Terraria website, place the contents of the Linux directory on a local terraria user in your droplet, with the accompanying server.config and terraria.service.

Set up as a user unit (~/.config/systemd/user/terraria.service) to run the server, which can be taken up/down with systemctl --user start/stop terraria.

To make sure this unit is not stopped when the owning user logs out, run sudo loginctl enable-linger <username> to allow the service to linger. Otherwise, the server will be stopped when you log out of your SSH session.

Runs off port 7777 (make sure its excepted from your firewall).

Attach to the screen (screen -r terraria) if you want to run admin commands.

Useful Links

#this is an example config file for TerrariaServer.exe
#use the command 'TerrariaServer.exe -config serverconfig.txt' to use this configuration or run start-server.bat
#please report crashes by emailing crashlog.txt to
#the following is a list of available command line parameters:
#-config <config file> Specifies the configuration file to use.
#-port <port number> Specifies the port to listen on.
#-players <number> / -maxplayers <number> Sets the max number of players
#-pass <password> / -password <password> Sets the server password
#-world <world file> Load a world and automatically start the server.
#-autocreate <#> Creates a world if none is found in the path specified by -world. World size is specified by: 1(small), 2(medium), and 3(large).
#-banlist <path> Specifies the location of the banlist. Defaults to "banlist.txt" in the working directory.
#-worldname <world name> Sets the name of the world when using -autocreate.
#-secure Adds addition cheat protection to the server.
#-noupnp Disables automatic port forwarding
#-steam Enables Steam Support
#-lobby <friends> or <private> Allows friends to join the server or sets it to private if Steam is enabled
#-ip <ip address> Sets the IP address for the server to listen on
#-forcepriority <priority> Sets the process priority for this task. If this is used the "priority" setting below will be ignored.
#-disableannouncementbox Disables the text announcements Announcement Box makes when pulsed from wire.
#-announcementboxrange <number> Sets the announcement box text messaging range in pixels, -1 for serverwide announcements.
#-seed <seed> Specifies the world seed when using -autocreate
#remove the # in front of commands to enable them.
#Load a world and automatically start the server.
#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
#Sets the world seed when using autocreate
#Sets the name of the world when using autocreate
#Sets the difficulty of the world when using autocreate 0(normal), 1(expert)
#Sets the max number of players allowed on a server. Value must be between 1 and 255
#Set the port number
#Set the server password
#Set the message of the day
motd=Hello World!
#Sets the folder where world files will be stored
#The location of the banlist. Defaults to "banlist.txt" in the working directory.
#Adds addition cheat protection.
#Sets the server language from its language code.
#English = en-US, German = de-DE, Italian = it-IT, French = fr-FR, Spanish = es-ES, Russian = ru-RU, Chinese = zh-Hans, Portuguese = pt-BR, Polish = pl-PL,
#Automatically forward ports with uPNP
#Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.
#Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
systemctl --user start terraria
until ss -lt | grep; do
sleep 1
screen -S terraria -X stuff "password <YOUR-PASSWORD>\n"
systemctl --user stop terraria
screen -wipe
Description=Terraria Server
ExecStart=/usr/bin/screen -dm -S terraria /home/terraria/server/TerrariaServer.bin.x86_64 -config /home/terraria/server.config
ExecStop=/usr/bin/screen -S terraria -X stuff "exit\n"
Copy link

mixels commented Jul 6, 2020

Yes thank you it does! Thank you, that helps it all click. :) Cheers and thanks for the contribution, it helped me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment