Guide:Setting up a Terraria server

From Terraria Wiki
Jump to: navigation, search
Click to Visit Pages to be Rewritten It has been suggested that this page/section be rewritten.
Reason: "Article needs to be cleaned and reorganized, as well as Linux and MacOS specific details. FreeBSD needs updating as the Linux binary may work as is."

This page is intended to guide you through configuring and running your own Terraria multiplayer server for LAN or Internet play. As of 1.3, players also have the option to connect via Steam multiplayer. For more info, see the guide for Steam multiplayer.

For easy reference, All Linux varieties and MacOS will be referenced as Linux and MAC respectively.

There are two methods of server connections, both of which can be used simultaneously on a single server.

Opening a port accessible through your public IP:[edit | edit source]

  • To find your external IP, a simple website can display your public IP address without any unnecessary details, such as ipify (has a lot more features at ipify.org/).
  • You will have to port forward (port 7777 by default, note that this is the same port as Just Cause 2: Multiplayer mod and San Andreas Multiplayer) for Terraria. (port forward guide).

Local Area Network (LAN):[edit | edit source]

Windows[edit | edit source]

  • From the start button, go to Program Files>Accessories>Command Prompt. This will display a new window called Command Prompt.
  • Type the word “ipconfig” without the quotes. Some information will display similar to the screenshot you see here.
    Command prompt.jpg
  • Look for Ethernet Adapter Local Area Connection' or 'Wireless LAN adapter Wireless Network Connection 2', find 'IPv4 Address', which is your computer's IP address on your local network. This window also shows other information including the default gateway. You will need the default gateway to configure your router in a browser like Firefox or Chrome.

Linux & MacOS[edit | edit source]

  • On GNU/Linux, FreeBSD and MacOS type ip addr in terminal to view your local IP address. You should see something similar to the following:

2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP mode DEFAULT qlen 1000

    link/ether d8:cb:8a:32:06:7f brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.2/24 brd 192.168.1.255 scope global eth0
       valid_lft forever preferred_lft forever  

...

In this example your local IP address is 192.168.1.2 from inet 192.168.1.2/24 .

Alternatively you can run ifconfig as root for a similar output if your system does not have ip installed.

Setting up a server[edit | edit source]

First, decide whether you want to start a "Host & Play" multiplayer game, or a dedicated server game. See multiplayer for an explanation of the differences.

Setting up a "Host & Play" server[edit | edit source]

This is the simplest way of playing multiplayer, and works well for in-home LAN or short online co-op games. Start Terraria, and in the main menu, choose "Multiplayer" then "Host&Play". Select a world to play in (or create a new one) then enter a password (or leave blank if you would prefer no password).

First launch of your server[edit | edit source]

Guide setting up a server 01.png

To launch your server for the first time, we won't worry about a configuration file, as the Terraria server file has a nice multiple-step wizard to get it running quickly.

Windows[edit | edit source]

The dedicated server files are located in the folder where the Terraria files are.

  • GOG Galaxy example: C:\GOG Galaxy\Games\Terraria
  • Steam example: C:\Steam\steamapps\common\Terraria

First, try setting up a server without a configuration file. To do this, search for the folder where Terraria is installed, find TerrariaServer.exe and then run it. A window will open and show the server control interface. This is where you can enter commands or view information. When it starts, it should ask you to choose a world, listing the worlds currently available on your computer. The window also gives the option to create or delete worlds at startup. When making a new world, follow the instructions in the window to change certain aspects of the world generation.

Note: By default, Terraria saves all worlds into "C:\Users\UserName\Documents\MyGames\Terraria\Worlds".

Linux & MacOS[edit | edit source]

On Linux and MacOS, the binary is found in $STEAM_ROOTDIR/steam/steamapps/common/Terraria and is called TerrariaServer.bin_ARCH. Where ARCH is the architecture you are using. x86 is for 32 bit, or x86_64 for 64 bit (If you aren't sure which, x86_64 is probably what you need).


Setting up dedicated server with configuration file[edit | edit source]

To run a server with a pre-made configuration file you must search for your Terraria installation folder, then run "TerrariaServer.exe -config <serverconfigfile>", where <serverconfigfile> is the configuration file.

  1. Use cmd, go to Terraria folder and type in "TerrariaServer.exe -config <serverconfigfile>" without the quotation marks, then .
  2. Make a shortcut of "TerrariaServer.exe", right-click on it, click on "Properties", edit the field "Target:" (originally: "<...>\TerrariaServer.exe"), type at the end, after "TerrariaServer.exe" the following: " -config <serverconfigfile>" without the quotation marks (important, leave a SPACE between the ".exe" and the "-config"). It should look like this: ""<...>\TerrariaServer.exe" -config <serverconfigurationfile>" Then apply it. From now on this shortcut will start your server with the given configuration file.
  3. If you want to, you can make a batch file as well, in its function it's the same as a shortcut. First, you make a new text file (.txt), then edit it in any kind of simple editor (not Office, something like Notepad), then type in the commands like this:
    @echo off
    cls
    TerrariaServer.exe -config <serverconfigurationfile>

Then save the text file (.txt) as a batch file (.bat). You will have to place the batch file in the Terraria folder to make it work and the configuration file must be in the same folder as well. Otherwise, if you type in the full path for the "TerrariaServer.exe" and the <serverconfigurationfile> it will work anywhere and act as a shortcut. Example for full path:

"C:\Games\Terraria\TerrariaServer.exe -config D:\TerrariaCon\example.txt"

As you can see in this example, the configuration file doesn't need to be in the Terraria folder.

It is possible to run more than one server from one computer! But to do so there are three important things:

  1. Make sure each server uses different configuration files!
  2. Make sure each server uses different worlds!
  3. Make sure each server uses different port numbers!

NOTE: It is recommended you make each server a separate shortcut/batch file.

Making a configuration file[edit | edit source]

There is an example configuration file in the Terraria folder, it looks like this if you open it in a text editor like Notepad or Notepad++
#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 [email protected]

#the following is a list of available command line parameters:

#-config <config file>				Specifies the configuration file to use.
#-port <7777>				Specifies the port to listen on.
#-players <number> / -maxplayers <50>	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 <Ty>			Sets the name of the world when using -autocreate.
#-secure					Adds addition cheat protection to the server.

#Sets the max number of players allowed on a server.  Value must be between 1 and 255
#maxplayers=5

#Load a world and automatically start the server.
#world=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\world1.wld

#Set the port number
#port=7777

#Set the server password
#password=

#Set the message of the day
#motd=Please don’t cut the purple trees!

#Sets the folder where world files will be stored
#worldpath=C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\

#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
#Create


#Sets the name of the world when using autocreate
#worldname=Terraria

#The location of the banlist. Defaults to "banlist.txt" in the working directory.
#banlist=banlist.txt

#Adds addition cheat protection.
#secure=1

#Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
#priority=0
You can see that every line starts with a "#" sign. That sign removes the line and keeps the server from using it. This is useful for commenting in the file, like this:
#Set the message of the day
As it explains the following command. And it is also useful for turning off commands, like:
#motd=Please don’t cut the purple trees!
Here, the server won't have "MessageOfTheDay", because it has the # to remove it. So, if you want to use a command you just need to delete the "#" from the beginning of the line. You can edit this file to your liking as much as you want. Every command is explained in the file. If you are ready, you just have to save the file and use it as a configuration file.
It is highly recommended to leave the original configuration file, make a copy of it and edit the copy, or open the original and "Save As..." another file, with a different name.

The default location for your configuration and world files as generated by the client and the server varies by platform.

Configuration file and save game data location[edit | edit source]

Windows[edit | edit source]

The configuration file will be located in the directory where Terraria resides.

  • Steam example: C:\Steam\steamapps\common\Terraria
  • GOG Galaxy example: C:\GOG Galaxy\Games\Terraria
  • World location: C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\
OS X[edit | edit source]

~/Library/Application Support/Terraria/Worlds

Linux[edit | edit source]

~/.local/share/Terraria/Worlds

Connecting to a Server[edit | edit source]

From the Host Computer[edit | edit source]

In the Terraria game, go to Multiplayer->Join via IP->Select your character->Type in the IP for the server. This can be the internal IP the server uses, or the external IP.

Over the Local Network[edit | edit source]

For other computers on your network/router, type in the 'IPv4' address of the computer you're running the server on. You'll notice when you run IPconfig on each computer on your network, the only number that changes under 'IPv4' is the last one. Each device connected to your network has their own number assigned by your router. The last number of the IPv4 can change for each device from time to time if your router uses dynamic IP addressing. Dynamic means that the IP address can change.

Over the Internet[edit | edit source]

For friends connecting "over the internet", they'll need to enter your external IP (meaning your router's IP), but this won't work until you set up the aforementioned port forwarding on your router.

On FreeBSD[edit | edit source]

If you're reading this, you probably know what an IP is and how to setup your router/firewall/jail to have a dedicated space on your machine to put the server.

How to run a dedicated terraria server on Ubuntu.

Go to your jail, create a terraria user, install screen, mono and sqlite3. Run this command once to initialize everything properly: (see How to run a dedicated Terraria server on Ubuntu/cir0qna for details about the command)

mono --server --gc=sgen -O=all TerrariaServer.exe

Generate a world and quit (^C)

Once you generated your world, add the code found here: http://ix.io/iHD to /usr/local/etc/rc.d/terraria and edit it according to your liking.

Edit your jail's rc.conf, terraria_enable="YES", and restart the jail.

Server lists[edit | edit source]

Once your Internet server is running properly, consider posting it to one of the public server lists, so Internet users can find it and join:

Troubleshooting[edit | edit source]

There are a few reasons something wouldn't work. You can separate many issues into these major groups.

"The server is not starting"[edit | edit source]

This is common because of a typo. Check everything again (especially if you are using a configuration file(s)), and make sure that everything is typed correctly. If it's still not working properly, check the forums to see if anyone else has the same issue that you have. As a last resort, try reinstalling the game.

Others can't connect to the server[edit | edit source]

This is usually a network related problem.

  • Make sure they are connecting to the right IP address. This is the server computer's IP address (IPv4) for networked computers, or the router's Global IP address for over the internet players. See the first section for info on how to find these.
  • Make sure your firewall is not blocking the "TerrariaServer.exe" or the server's port ("7777" by default).
  • Make sure the others join with the correct port number (especially important if it's not the default "7777").
  • If you are using a router you have to make sure it opens the server's port for you. See first section for info on how to do this.
  • If your IP address is dynamic (not static or reserved) it is possible for it to change over time, so check your IP address again. Also, if you are using Dynamic DNS to get around this problem, tell the other players to always type in your Domain Name to join and don't use the saved list of connections which the game offers (the game only saves the IP address, not the domain name, so if your IP has changed it won't be aware of it).

World not saving/Items disappear from chests after closing server[edit | edit source]

The Terraria server only saves the world automatically at regular time intervals.

If you close the server without issuing a save/exit command via the console (or if you use host and play), there's a chance that the world may not have saved the last few minutes of changes. Moving gear between chests and immediately closing the server without explicitly specifying the save/exit command may actually cause those items to disappear.

To ensure this isn't an issue: Always use a dedicated server, and remember to enter the "save"/"exit" commands rather than simply closing the console window via the red X button.

Guides
 
Basics Walkthrough (Game progression • Progression graph) • Getting started • Practical Tips • Inventory management • Class setups • Mining techniques • Events • Jump Height Comparison
Farming Gardening • Money • Enemies • Chlorophyte • Souls • Biome Keys/Key Molds • Liquids • Renewable Resources
Pre-Hardmode Bosses Mobile only.png Lepus • Mobile only.pngTurkor the Ungrateful • King Slime • Eye of Cthulhu • Eater of Worlds • Brain of Cthulhu • Queen Bee • Skeletron • Wall of Flesh‎
Hardmode Getting Started with Hardmode • Containing the Hallow/Corruption • Lunar Event strategies • Frost Moon strategies • Old One's Army strategies
Hardmode Bosses The Twins • The Destroyer • Skeletron Prime • Plantera • Golem • Console VersionMobile only.pngOcram • Duke Fishron • Desktop Version Lunatic Cultist • Desktop Version Moon Lord
Advanced Dungeon Guardian • Skipping Stones
Building Bases • Base defense • Arena • Wiring (Logic Gates) • Travel • Artificial biomes • Minecarts
Surviving Corruption • Crimson • Ocean • Jungle • Dungeon • Underworld • Hallow • Jungle Temple • Expert Mode
Crafting Crafting 101 • Quick Reference • Cell Phone • Ankh Shield • Terra Blade
Multiplayer Setting up a Terraria server • Setting up Steam Multiplayer • Capture the Gem • PvP