Jan 2nd, 2012 Update
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.