Setup and run a Terraria game server in Photon OS on ESXi.
First, install a base installation of Photon OS with the following changes:
Photon-Terraria
Setup minimal installed profile of PhotonOS
OVA with virtual hardware v13
from https://github.com/vmware/photon/wiki/Downloading-Photon-OSCreate/Register VM
:Deploy a virtual machine from an OVF or OVA file
Target Datastore
Power on automatically
Finish
Host
> Manage
> System
> Autostart
:Enable
Start earlier
and Start later
to set the desired orderVirtual Machines
on the sidebar and click on the current VMActions
> Edit Settings
:CPU
> Enable Expose hardware assisted virtualization to the guest OS
Add other device
> NVMe controller
Hard Disk 1
> Controller location
> NVMe controller 0
Edit Settings
SCSI controller 0
Secure Boot
because of an issue after updating, see Issue #974Hardware Configuration
> Network adapter 1
) and desired hostname# Login with root details from the VM note # Follow instructions to set new password # Update packages: tdnf upgrade # Disable password expiry: chage -M -1 root # Set new hostname: hostnamectl set-hostname <hostname-as-set-in-router> # Set the timezone to Perth ln -sf /usr/share/zoneinfo/Australia/Perth /etc/localtime # Change the SSH port to 50001: sed -i "s/#Port 22/Port 50001/" /etc/ssh/sshd_config sed -i "s/-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT/-A INPUT -p tcp -m tcp --dport 50001 -m state --state NEW -j ACCEPT/" /etc/systemd/scripts/ip4save exit
Minimal installed profile of PhotonOS User: root Ports: 50001/tcp SSH
Base Install
# 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/ ## <esc> :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"
<Ctrl+b> d
to detach the tmux client, or use the -d
flag in the tmux command to start it disconnected.tmux a -t terraria
, and type exit
, or run tmux send-keys -t terraria "exit" Enter
to shutdown the server.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: <Ctrl+b> d
tdnf upgrade
tdnf clean all
reboot # If desired/needed
# 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