sshserverubuntu-server

How to install Terraria TShock Server on Ubuntu Server?


Recently I decided to install Terraria server on Ubuntu Linux, but didn't find any completed instructions, so I decided to make my own, to help pure Terraria fans like me. This arcticle is relevant on 15.02.2019.


Solution

    1. So first of all, you need a dedicated server. I used vps server from Heztner guys, but you can use any kind of tech you want (like raspberry pi or old pc with Ubuntu Server installed. Just make sure its minimal configuration fits Terraria Server).
    2. After you first powered up your device and created password, we'll install SSH to make our setting up process a little bit comfy. You will be able to access server with any other device, if you have ssh installed in cmd or terminal.

    Windows 10

    Has SSH preinstalled in cmd. So all you need to do is

    Ubuntu 18.04

    You may need to enable SSH in terminal. Use this instruction. Process is the same as in cmd on Windows 10.

    Also

    You can use SSH clients like Termius, you just need to create new Host with enabled SSH and put your server ip. Then choose user and enter password, and you're in.


    Finally we're done with SSH and begining to setup our working environment. To fully operate with our system, we need to install several programs, as

    Installation

    1. First we create different user, so we store Terraria files separately of root.

      • adduser terraria
    2. Then add it to sudo group, so you can launch several admin commands

      • adduser terraria sudo
    3. Then install programs

      • sudo apt-get install mono-complete screen unzip
    4. Enter as terraria user

      • su terraria
    5. Go to your home folder

      • cd
    6. Download latest TShock file, for me it's 4.3.25. If there is newer version, just go to their github page and copy zip file download link and paste it instead of mine.

      • sudo wget https://github.com/Pryaxis/TShock/releases/download/v4.3.25/tshock_4.3.25.zip
    7. Unzip it

      • unzip tshock_4.3.25.zip
    8. Delete zip-file

      • rm tshock_4.3.25.zip
    9. Execute server one time to create the map

      • mono-sgen TerrariaServer.exe (type it every time you want to launch the server)
    10. And now, when the map created and launched, you simply press ctrl+a to start screen, and then press d. Now your screen is detached and you can use your console regardless of server. Also this wont let your Terraria process shut down because of inactivity.

    Bonus level

    And this part will be for people who want to transfer their local map to server. I did it because first time I played Terraria with friends through Steam, and then I created server so map can run 24/7.

    All you need to do is create ssh connection from device you store your local map. If you did it previously, then go to your Steam folder, find Terraria worlds, right click, properties and copy the path. Then go to cmd and type

    It will copy your local world to home section, then go back to your ssh with terraria user and type

    That thing will move your world file to hidden .local folder, where all world files store. Aaaand that's all. Just go to number 8 and do it again. Hope this guide will help you:) If you find any mistakes or face with problems, just comment this section, so I can fix it.