Setting up a Terraria server is very simple and can be done very quickly. First, we need to complete a few steps.
Prerequisites:
You will need an IP address to play with other players. Follow this guide to purchase one for your Shell.
IP Address Guide
Update and install tools:
sudo apt update
sudo apt install -y wget tmux unzip
Server files Download
Download the latest version of the Terraria server software at the following link:
TIP - you will likely need to right click on the version of Terraria that you want, copy link location and then type the command 'wget' followed by pasting the link to the download. This will download that version of Terraria to your current location on the linux server.
Example:
If you were to want Terraria 1.4.3 version, your command would look like the following:
wget https://terraria.org/api/download/pc-dedicated-server/terraria-server-143.zip
Downloads (link to Terraria Server Downloads)
Once downloaded, within the downloads folder, run the following command
Unzip <Name of the downloaded server file>
Example:
If following the wget example above, and downloading the terraria-server-143.zip file...your command would look like this.
Unzip terraria-server-143.zip
Navigate to the directory:
cd 1412
cd Linux
Add executable permissions
sudo chmod +x TerrariaServer.bin.x86*
Launch the server
./TerrariaServer.bin.x86_64
Finally,
~/.local/share/Terraria/Worlds/
The screenshot above lists the new world I created "Hworld". To create your own type "n" and it will prompt you for a name and difficulty level.
Set the maximum number of players: I set mine to the max of 16
Set the port: Hit enter to use the default, 7777.
Enable port forwarding: type "y"
Set your password: I entered none since I prefer no passwords for my server.
To connect to the server, simply Launch Terraria and select multiplayer > join via IP. Then select a player and when asked for an IP type "localhost"