Hosting Project Zomboid on Ubuntu Server
Sources
Adapted from this source: https://pzwiki.net/wiki/Dedicated_server
Server Root Basics
Get the latest list of packages, and upgrade.
Set your timezone.
Create a non-root user.
Add them to the sudo group.
Logout, and log in as them.
apt update
apt upgrade
timedatectl set-timezone America/Toronto
adduser
usermod -aG sudo user_name
exit
Setup the Software
Install steamcmd.
Official directions: https://developer.valvesoftware.com/wiki/SteamCMD#Ubuntu
sudo apt update; sudo apt install software-properties-common; sudo apt-add-repository non-free; sudo dpkg --add-architecture i386; sudo apt update
sudo apt install steamcmd
Install screen.
sudo apt install screen
Make the server directory.
mkdir pzserver
Create a steamcmd configuration file.
nano update_zomboid.txt
Paste this into into the file, modify user_name, and save.
Steamcmd will not recognize the shorthand ~/ in this file.
@ShutdownOnFailedCommand 1 //set to 0 if updating multiple servers at once
@NoPromptForPassword 1
force_install_dir home/user_name/pzserver/
//for servers which don't need a login
login anonymous
app_update 380870 validate
quit
EOL
Install/Update the game application
export PATH=$PATH:/usr/games
steamcmd +runscript ~/update_zomboid.txt
Running the Server
Start a screen session.
screen -S pz-server
Navigate to the install directory specified the steamcmd configuration file.
cd pzserver
Launch the game.
Using -servername and specifying a name will create/use a new directory for the save.
bash start-server.sh -servername SERVERNAME
Port forwarding
- 16261 UDP
- 16262 UDP
Administration
Server commands: https://pzwiki.net/wiki/Admin_commands