Terraria Server with Ubuntu 10.04 LTS (Linux)

Jan 2nd, 2012 Update

TDSM has supposedly decided to shut down. You can still follow the blog post below (mostly) but try using TShock for the server now instead of TDSM. Visit their GitHub downloads page.

First: My two cents on Linux distros…

I’ve recently become somewhat addicted to my new virtual dedicated Linux server. I love Ubuntu because of their outstanding support, vast community, and massive, up-to-date package repo. While we’re talking about distros I have to say that I HATE CENT OS with a deep, burning passion. It’s a horrible, convoluted, out-of-date distro and no one should ever use it. Ever. I’m looking at you, MediaTemple. I really wanted to use your servers, but I refuse to settle for Cent OS.

Headaches, compiling and dependencies (You don’t need them!)

Let’s move on. I did a lot of research into this while trying to get it to run, so here is a little background…

Terraria is written in Microsoft’s .NET framework with XNA. It’s pretty much perfect for Microsoft platforms as .NET and XNA gives a TON of flexibility with Windows, Phones, Xbox, and more. Personally, I love the .NET framework to death. It’s effective, pretty clean, and it gets the job done quickly. There’s tons of other features (anonymous types, LINQ, etc..) that I could gush about, but I’ll skip it for now. Unfortunately, that’s where the fun stops. Once you go .NET you’re effectively vendor locked to Microsoft, or at least you used to be. Enter the Mono project

What is Mono?

Mono is a project lead by Xamarin (formerly by Novell) that is trying to open up the .NET framework so that anyone can use it on any platform.

Cool, so Mono is basically the .NET framework… right?

Well, almost. It’s a constant work in progress playing a massive game of catch-up with the real .NET framework. The real Terraria server doesn’t actually work inside of Mono. My understanding is that the core reason behind this is the XNA framework isn’t readily available inside of Mono. So I went off on a research spree… I tried compiling MonoGame and MonoXNA to work the dependencies into Mono. While we’re talking about them… they should both be horribly, horribly ashamed of the lack of documentation around their build processes. Mostly because there is none. I had to go digging around into the source to figure out that OpenTK is required for MonoGame, and for MonoXNA I stopped caring before I could get very far into the 50+ compile errors it was throwing fresh out of version control.

Well that was a wild goose chase… and lucky for you because compiling all of that junk is confusing, prone to errors and tons of other headaches. After some more research I found that I had missed another solution. Instead of running the stock game files, the wonderful (I haven’t met them, but their software rocks.) person/people over at Terraria Dedicated Server Mod (TDSM) have whipped up a modded server that is actually super powerful in comparison to the stock server. Now you may be thinking, “Hey buddy, don’t mod my server. I like things stock!” But hold on. The mod server seems to run totally stock, but has some extra power and options in the console. It’s even open source on GitHub!

An open, dedicated Terraria server

I finally worked through the whole process and it’s super simple compared to what I thought it was going to be. Here is the culmination of my effort in semi-bash script format, but don’t try to run it, it’s not actually a script. Follow along with my double hash (##) comments to get a firm understanding on what’s going on.

## To start, we'll work inside our home directory.
## You can work elsewhere if you prefer, but this makes permissions easy.
cd ~
## First, add BadgerPorts into your sources list
## For more information on BadgerPorts visit http://badgerports.org
sudo nano /etc/apt/sources.list
## Add these lines to the end of sources.list (the first line is a comment for your reference!)
# BadgerPorts apt source for Mono
deb http://badgerports.org lucid main
## Download and add the GPG key for BadgerPorts
wget http://badgerports.org/directhex.ppa.asc
sudo apt-key add directhex.ppa.asc
## Update your apt repo and install the Mono package
## For more information on Mono visit http://mono-project.com
sudo apt-get update
sudo apt-get install mono-devel
## Check your Mono version. It needs to be 2.10 or greater.
mono -V
## Download the Terraria Dedicated Server Mod (TDSM)
## For more information on TDSM visit http://www.tdsm.org
wget http://update.tdsm.org/Terraria_Server.exe
## Move the executable elsewhere if you desire.
## It will generate some files when it is run.
mono Terraria_Server.exe
## That's it! Edit the server.properties file to update settings.
## You'll be asked if you want to stop and edit on the first run.


Hey, it works! A Terraria server on Ubuntu!

Congratulations! You can keep running unchained from Windows. If you’re looking for an excellent way to manage your servers, I cannot recommend tmux highly enough. It’s excellent for backgrounding tasks that take over the console like Terraria’s server. In addition you can come back later on and run `tmux attach` to get back to your existing sessions. Check it out, and seriously consider reading the manual. It’s a little complicated at first, but it will pay off. Installing tmux in Ubuntu is as easy as `sudo apt-get install tmux` – I seriously love the package manager and repos Ubuntu has.

About James

I own this site. I love code. The end?
This entry was posted in Hacks, Linux, PC Games, Programming and tagged , , , , , , , , . Bookmark the permalink.

23 Responses to Terraria Server with Ubuntu 10.04 LTS (Linux)

  1. maheulbeuk says:

    Good tuto
    thx for all

  2. Andrew says:

    Love the Post works Great Thanks for all of the help! Im so glad some else love ubuntu as i do!

    • James says:

      With the 1.1 release of Terraria it is a little out of date, but I’m following TDSM with anticipation waiting for it to get up to speed! Even tried to contribute a little source code tonight… 🙂

  3. Tyler says:

    Thanks. Solved the problem AND was well written — short, to-the-point, with quick reference cheat sheet.

  4. James Miller says:

    TDSM is down. Can someone point me to a new place to wget terraria_server.exe?

  5. Andrew Potter says:

    Works on archlinux with the mono in the main repos, using TShock. Much easier than i was expecting!

  6. Jan says:

    For some reason I terribly fail at the apt-get update, since it seems that badgerports are not working properly

  7. Solenki says:


    I used your method but I have some problems running the server.
    Connection is good but I’m having two issues:
    – no monsters spawn
    – crash at NPC spawn:
    Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.

    Does any one has an idea?


  8. Simo says:

    When I went to put in the final command, mono Terraria_Server.exe. The terminal says Cannot open assembly ‘Terraria_Server.exe’: File does not contain a valid CIL image.

    How do I fix this?

  9. Will Venn says:

    Hey thanks very much for this works fine! cheers mate 🙂

  10. Samus says:

    Any updates for the Mono version of Terraria_Server.exe ? I am trying to get this running on a Raspberry Pi (My current Terraria verision wont connect to my 1.1.2 mono server).

    • James says:

      Check out TShock and see what they’re up to – though I wouldn’t expect great performance on this from Raspberry Pi. Tried it on a BeagleBoard once and it really chugged.

    • David Dietrich says:

      I just finished working my way through a rocky install of mono + tshock on an Ubuntu system. I was getting some nasty-looking mono errors upon trying to launch TerrariaServer.exe, but after rooting around online for a couple of hours, I found my problems were twofold: that the default Ubuntu repos were giving me a version of mono that wasn’t working and secondly, I didn’t have all of the necessary dependencies installed as described under “Can I run the server in Linux?” at tshock.atlassian.net.

      In short, here’s how I got it installed and running:

      1. Get the Beta update channel as described on mono-project.com:

      echo “deb http://download.mono-project.com/repo/debian beta main” | sudo tee /etc/apt/sources.list.d/mono-xamarin-beta.list
      sudo apt-get update

      2. Install the tshock dependencies listed under “Can I run the server in Linux?” on tshock.atlassian.net:

      * mono-runtime
      * libmysql6.4-cil
      * libmono-corlib2.0-cil
      * libmono-system-drawing4.0-cil
      * libmono-system-runtime4.0-cil
      * libmono-system-runtime-serialization4.0-cil
      * libmono-system-numerics4.0-cil
      * libmono-system-xml-linq4.0-cil

      (I actually installed mono-complete, which took care of most of the above)

      3. Download, unzip and run TShock’s TerrariaServer.exe as described at verious places around the Web, including “How to run a dedicated Terraria server on Ubuntu” on Reddit:

      wget https://github.com/NyxStudios/TShock/releases/download/v4.3.12/tshock_4.3.12.zip

      unzip TShock. -d tshock

      screen ./tshock/TerrariaServer.exe

  11. janko2206 says:

    mono Terraria_server.exe and i get FATAL ERROR 🙁 HELP

  12. mark says:

    Go it working on my Amazon EC2 ubuntu instance with the following repo for mono:

    sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF

    echo “deb http://download.mono-project.com/repo/debian wheezy main” | sudo tee /etc/apt/sources.list.d/mono-xamarin.list

    and using tshock.

    Just select the latest .zip and wget it..

Leave a Reply

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