Terraria Wiki

  • Discussions are now available on the Terraria Wiki.
  • Miss the old Hydra Skin? Try out our Hydralize gadget! Visit the preferences page while logged in and turn on the gadget.

READ MORE

Terraria Wiki
Register
Advertisement
This is a Guide page.
This is a Guide page.
This means the page will walk you through a specific task, strategy, or enemy/boss fight.
Status: Subject to revision (This Guide does not meet certain quality standards and may be heavily outdated.)

This page is intended to guide you through configuring and running your own Terraria multiplayer Server for LAN or Internet play.

From 1.3.0.1, players also have the option to connect via Steam multiplayer. For more info, see the Guide:Setting up Steam Multiplayer. Please note that the requirements for running your own Terraria server include needing 512 MB RAM for a small game world with a few players and no mods. For larger worlds, 1 or 2 GB RAM (10 players or more) is required. If more than 50 players are expected, then 4 GB or more RAM is recommended[1].

For easy reference, the guide is broken down by operating system: Windows and Linux / macOS

Preparing your Network[]

Before you begin setting up the server, consider these network changes that may be necessary if your server is in your home network.

  • Assign the computer running the server a static IP address. It is unlikely, but if you don't do this then your router may reassign the computer's IP address while you are using the server which will interfere with your connection to it. To learn how to do this with your router, refer to your router's manual or search "how to set up static IP on <make and model of your router>".
  • If anyone is connecting to the server from outside your local area network (aka "over the internet"), you will need to forward the port for the server. Additionally, make sure you have assigned the server computer a static IP on your router. See below on how to forward ports.

Opening a port accessible through your public IP:[]

  • To find your external IP, a simple website can display your public IP address without any unnecessary details, such as whatsmyip.com or 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 Ark: Survival Evolved, Mordhau, Just Cause 2: Multiplayer mod, and San Andreas Multiplayer) for Terraria. (port forward guide).

Windows[]

Local Area Network (LAN):[]

  • 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 and hit enter. Some information will display similar to the screenshot you see here.
    Command prompt
  • 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.

Setting up a server[]

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[]

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 dedicated server[]

Guide setting up a server 01

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.

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:\Program Files (x86)\Steam\steamapps\common\Terraria

You can also download the dedicated server files directly from terraria.org by clicking the "Dedicated Server" link at the bottom of the page.

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".

Setting up dedicated server with configuration file[]

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 ↵ Enter.
  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"

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.

Configuration file and save game data location[]

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

  • Steam example: C:\Program Files (x86)\Steam\steamapps\common\Terraria
  • GOG Galaxy example: C:\GOG Galaxy\Games\Terraria
  • World location: C:\Users\Defaults\My Documents\My Games\Terraria\Worlds\

Linux / macOS[]

Almost all of the setup on Linux and macOS is done in the terminal. If you are inexperienced with the command line, you may be understandably intimidated or worried you will break something. Just take it slow and type in commands exactly as they are written here. You are encouraged to research each command so you know exactly what it will do (eg man ip or chmod --help). If you need help learning basic terminal commands, consider this guide by HowToGeek.

Local Area Network (LAN):[]

Ipaddr

Example output of ip addr with important info highlighted

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

Look for BROADCAST and state UP. In this example your local IP address is 192.168.1.44 from inet 192.168.1.44/24 .

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

Setting up a server[]

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[]

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 dedicated server[]

Terrariaworld

Running the server with no configuration will take you to the world select screen

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.

On Linux and macOS, the binary is found in $STEAM_ROOTDIR/steam/steamapps/common/Terraria. You can also download the dedicated server files directly from terraria.org by clicking the "Dedicated Server" link at the bottom of the page.

Running the script TerrariaServer will start the correct version of the server for your system. Make sure the script and program files have execute permissions by using the command chmod u+x TerrariaServer*. If you do not see this script then double check that you are using the latest version of the server.

Since the server will stop if the terminal session is ended, you can use a program like tmux or screen to keep the session running while you are logged out.

Like with other game servers, it is generally recommended that you create a user (with home directory) dedicated to running game servers. This ensures that servers don't have permissions to alter files they shouldn't be.

The server will fail to start if $TERM is not set to xterm. If this is the problem the server will generate a file called "client-crashlog.txt" which will contain the error "System.Exception: Magic number is wrong: 542" If this is the case, simply run the command "export TERM=xterm" and start the server again.

Note: By default, Terraria saves all worlds into "~/.local/share/Terraria" on Linux and "~/Library/Application Support/Terraria/Worlds" on macOS

Setting up dedicated server with configuration file[]

To run a server with a pre-made configuration file you must search for your Terraria installation folder, then run "TerrariaServer -config <serverconfigfile>", where <serverconfigfile> is the configuration file. Follow these steps to create a shell script to automatically run the server with a configuration file.

  1. Using a text editor, create a file in the same directory as the Terraria server file called startserver.sh
  2. Copy the following lines of text into the file:
    #!/bin/sh
    ./TerrariaServer -config <serverconfigfile>
  3. Save the file, make sure it has execution privileges by running chmod +x startserver.sh, and run it.

You can also use the full path for "TerrariaServer" and the <serverconfigurationfile> it will work anywhere and act as a shortcut. Example for full path:

"~/TerrariaServer/TerrariaServer -config ~/.config/TerrariaServer/serverconfig.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 shell script.

Save game data location[]

macOS[]

~/Library/Application Support/Terraria/Worlds

Linux[]

~/.local/share/Terraria/Worlds

NOTE: If the default installation directory was changed during installation a folder called "~" will be created in which the save data can be found, this is NOT the same thing as the users home directory.

Making a configuration file[]

The configuration file options and syntax is the same regardless of OS. 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++. If you don't see it, you can copy this text into a new file.

#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 support@terraria.org
#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.
#world=C:\Users\YOUR_USERNAME_HERE\My Documents\My Games\Terraria\Worlds\world1.wld
#Creates a new world if none is found. World size is specified by: 1(small), 2(medium), and 3(large).
#autocreate=1
#Sets the world seed when using autocreate
#seed=AwesomeSeed
#Sets the name of the world when using autocreate
#worldname=Terraria
#Sets the difficulty of the world when using autocreate 0(classic), 1(expert), 2(master), 3(journey)
#difficulty=0
#Sets the max number of players allowed on a server.  Value must be between 1 and 255
#maxplayers=8
#Set the port number
#port=7777
#Set the server password
#password=p@55w0rd
#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\
#The location of the banlist. Defaults to "banlist.txt" in the working directory.
#banlist=banlist.txt
#Adds addition cheat protection.
#secure=1
#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,
#language=en-US
#Automatically forward ports with uPNP
#upnp=1
#Reduces enemy skipping but increases bandwidth usage. The lower the number the less skipping will happen, but more data is sent. 0 is off.
#npcstream=60
#Default system priority 0:Realtime, 1:High, 2:AboveNormal, 3:Normal, 4:BelowNormal, 5:Idle
priority=1
#Journey mode power permissions for every individual power. 0: Locked for everyone, 1: Can only be changed by host, 2: Can be changed by everyone
#journeypermission_time_setfrozen=2
#journeypermission_time_setdawn=2
#journeypermission_time_setnoon=2
#journeypermission_time_setdusk=2
#journeypermission_time_setmidnight=2
#journeypermission_godmode=2
#journeypermission_wind_setstrength=2
#journeypermission_rain_setstrength=2
#journeypermission_time_setspeed=2
#journeypermission_rain_setfrozen=2
#journeypermission_wind_setfrozen=2
#journeypermission_increaseplacementrange=2
#journeypermission_setdifficulty=2
#journeypermission_biomespread_setfrozen=2
#journeypermission_setspawnrate=2
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.


Connecting to a Server[]

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.

From the Host Computer[]

You can use localhost as the IP, or use the host IP.

Over the Local Network[]

For other computers on your local network (connected directly to your router), type in the 'IPv4' address of the computer you're running the server on (see LAN). Each device connected to your network has their own IP address assigned by your router. The IPv4 address can change for each device from time to time if your router uses dynamic IP addressing (most routers us dynamic IP addressing by default). Dynamic means that the IP address can change.

Over the Internet[]

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 (See Port Forwarding).

On FreeBSD[]

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[]

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[]

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

"The server is not starting"[]

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[]

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[]

The Terraria server only saves the world automatically every dawn (every 24 minutes).

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.

Advertisement