Set up and join a Terraria dedicated server
Download the Terraria server, write serverconfig.txt, open TCP port 7777, run it from the console, join via IP and move your world onto it.
A Terraria dedicated server keeps your world online when the host logs off. Re-Logic publishes it free on terraria.org for Windows, Linux and macOS. For mods, tModLoader has its own server: see running a tModLoader server.
1. Download the server
terraria.org lists the current server download; for 1.4.5.8 it is terraria-server-1458.zip. Unzip it; the Linux server is 1458/Linux/TerrariaServer.bin.x86_64 (make it executable), and runs on the Mono it ships with.
2. Write serverconfig.txt
Start the server with -config serverconfig.txt and put the settings in that file, one key=value per line:
world=/srv/terraria/Worlds/MyWorld.wld
autocreate=2
worldname=My World
difficulty=0
maxplayers=8
port=7777
password=change-me
motd=Welcome!
secure=1worldandautocreate: the world file, and the size to make it when it doesn't exist yet: 1 small, 2 medium, 3 large.difficulty: 0 Classic, 1 Expert, 2 Master, 3 Journey, for a new world.seedsets its seed.password: what players type to join; leave it out for an open server.motdis the message they see.
3. Start it
./TerrariaServer.bin.x86_64 -config serverconfig.txt A new world is generated first. The server prints Listening on port 7777 and then Server started; a new small world took about 30 seconds in our tests.
4. Open the port
Players connect over TCP on the port in port, 7777 by default. Forward it on your router and allow it in your firewall.
5. Run it from the console
The server takes commands where it runs: playing lists who is on, say sends a message, kick and ban take a player's name, and save saves the world. Bans are kept in banlist.txt. Terraria has no admin password in the game.
6. Stop it without losing progress
Type exit: the server says Saving before exit..., saves and stops, in about 2 seconds on a small world. Killing the process loses what changed since the last save. exit-nosave stops it without saving.
Join a Terraria server
In Terraria, choose Multiplayer › Join via IP, pick or create a character, and enter the server's address, then its port, then the password if it has one. Players need the same game version as the server.
Move your world to a dedicated server
Your worlds are in Documents/My Games/Terraria/Worlds on Windows. Stop the server, copy the world's .wld file to the path in world, and start it again. The .bak files beside it are the game's backups.
Skip the setup
HostForge runs the server for you: pick vanilla or tModLoader, a region, and the size and difficulty of the new world. It writes serverconfig.txt, opens the port, saves the world before every stop and backs it up daily. To bring a world, stop the server, open Save and upload a ZIP of its .wld. The Console tab runs server commands, and banlist.txt is under Configuration files.