=====Terraria Server===== Setup and run a Terraria game server in Photon OS on ESXi. ====Setup==== First, install a base installation of Photon OS with the following changes: * Hostname: ''Photon-Terraria'' * CPU: * CPU: 2 * Cores per Socket: 2 * Memory: 2GB {{page>esxi:photon_os#Setup&noheader}} ===Install Terraria Server:=== * Add a port forwarding rule in your router for tcp and udp port 7777 to the IP of the VM * Using an SSH client, connect to :50001 then run: # Allow port 7777 through iptables sed -i "s/COMMIT/-A INPUT -p tcp -m tcp --dport 7777 -j ACCEPT\n-A INPUT -p udp -m udp --dport 7777 -j ACCEPT\nCOMMIT/" /etc/systemd/scripts/ip4save reboot # And then reconnect the SSH client tdnf install unzip tmux less # Download and place the server in /terraria (Check the PC Dedicated Server link at the bottom of https://terraria.org for the latest server file and change all the "1402" references to the correct version) cd /tmp curl --output terraria-server.zip https://terraria.org/system/dedicated_servers/archives/000/000/036/original/terraria-server-1402.zip?1589675482 unzip terraria-server.zip mv 1402/Linux /terraria/server # Remove temp files rm terraria-server.zip rm -r 1402 # Allow the server to be executed and set the config chmod u+x /terraria/server/TerrariaServer* vim /terraria/serverconfig.txt # Press i, then paste the following into the window (replacing the password): autocreate=2 worldname=World difficulty=2 maxplayers=16 port=7777 password=password1234 worldpath=/terraria/worlds/ ## :wq # Start the server tmux new -s terraria "/terraria/server/TerrariaServer.bin.x86_64 -config /terraria/serverconfig.txt" \; pipe-pane -o -t terraria "cat >>/terraria/server.log" * Either use '' d'' to detach the tmux client, or use the ''-d'' flag in the tmux command to start it disconnected. * Either re-attach to the session with ''tmux a -t terraria'', and type ''exit'', or run ''tmux send-keys -t terraria "exit" Enter'' to shutdown the server. * Edit the VM note and append the following: 7777/both Terraria (Port Forwarded) Run with: tmux new -d -s terraria "/terraria/server/TerrariaServer.bin.x86_64 -config /terraria/serverconfig.txt" \; pipe-pane -o -t terraria "cat >>/terraria/server.log" Stop with: tmux send-keys -t terraria "exit" Enter Attach tmux client: tmux a -t terraria Detach tmux client: d ====Update==== {{page>esxi:photon_os#Update&noheader}} * Check the PC Dedicated Server link at the bottom of https://terraria.org for the latest server file and change all the 1402 references to the correct version and link # Download cd /tmp curl --output terraria-server.zip https://terraria.org/system/dedicated_servers/archives/000/000/036/original/terraria-server-1402.zip?1589675482 unzip terraria-server.zip # Stop the server tmux send-keys -t terraria "exit" Enter # Replace server files FIXME rm -r /terraria/server mv 1402/Linux /terraria/server chmod u+x /terraria/server/TerrariaServer* # Remove temp files rm terraria-server.zip rm -r 1402 # Start the server tmux new -d -s terraria "/terraria/server/TerrariaServer.bin.x86_64 -config /terraria/serverconfig.txt" \; pipe-pane -o -t terraria "cat >>/terraria/server.log" exit