Skip to content

Instantly share code, notes, and snippets.

@jamiemtdwyer
Last active December 7, 2023 12:53
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamiemtdwyer/35c8f2aab8e4724d9d7720caefdbf96d to your computer and use it in GitHub Desktop.
Save jamiemtdwyer/35c8f2aab8e4724d9d7720caefdbf96d to your computer and use it in GitHub Desktop.

Project Zomboid Dedicated Server Guide

Ubuntu Server 20.04 LTS (64-bit)

1. Install steamcmd

 sudo add-apt-repository multiverse
 sudo dpkg --add-architecture i386
 sudo apt update
 sudo apt install lib32gcc1 steamcmd 

2. Install Project Zomboid via steamcmd

mkdir -p ~/.steam/steamapps/common/zomboid
steamcmd +force_install_dir ~/.steam/steamapps/common/zomboid +login anonymous +app_update 380870 validate +quit

Set the maximum heap size available to the Java VM by editing ProjectZomboid64.json

nano ~/.steam/steamapps/common/zomboid/ProjectZomboid64.json

Modify the -Xmx argument in the vmArgs section of the configuration file, and set the heap size based on how much memory you want to allocate to the server, e.g. -Xmx30g


3. Download the collection of bash scripts, extract them to a folder, and re-name the folder pz_scripts:

wget https://github.com/jamiemtdwyer/pz_scripts/archive/refs/tags/v0.0.1.tar.gz
tar -xvf v0.0.1.tar.gz
mv pz_scripts-v0.0.1/ pz_scripts/

This repository contains a number of scripts that can be helpful for administering your Project Zomboid server. Only the update-start-server.sh script is within the scope of this guide, and usage is described in the next step.


4. Run the server by executing ~/pz_scripts/update-start-server.sh

This script downloads the latest server update from Steam (if necessary), validates the integrity of the server files, and then starts the server in the current shell.

chmod +x ~/pz_scripts/update-start-server.sh
bash ~/pz_scripts/update-start-server.sh

NOTE: chmod only needs to be executed once before the script is executed for the first time.

Optional steps

Modifying or transferring server configuration files

After the server runs for the first time, it will create the ~/Zomboid/ directory in the user's home directory.

The server configuration files are in ~/Zomboid/Server/. The main server configuration files are servertest.ini and servertest_SandboxVars.lua.

These server configuration files can be edited directly with a text editor, or you can transfer them via SFTP.

NOTE: If transferring the files, make sure the main configuration file is called servertest.ini exactly, and the other files are prefixed with servertest_. You can use a different server configuration file by adding the -servername launch option when launching the Project Zomboid server.

Install screen

sudo apt install screen

Use screen to start the server in the background:

screen -dmS zomboid ~/pz_scripts/update-start-server.sh

To list the screen sessions currently running:

screen -ls

To attach to a screen session by name:

screen -r zomboid

To detach from the current screen session, press CTRL+A and then d. For more advanced usage, see the screen manual

Alternatively, you can use tmux or another terminal multiplexer of your choice to manage sessions.

Install the RCON client

See here

Install the crontabs

These crontabs will automatically start the server and the RCON console when the server reboots.

crontab -e

Choose your preferred editor (nano is suggested) and add the following crontab entries:

@reboot screen -dmS zomboid ~/pz_scripts/update-start-server.sh
@reboot screen -dmS rcon ~/pz_scripts/connect-rcon.sh

Configure firewall rules

By default, Ubuntu Server 20.04 ships with ufw configured as the software firewall.

You must allow traffic on the following ports: 16261 (UDP), 8766 (UDP), 8767 (UDP) You must allow traffic on 27015 (TCP) to execute RCON commands over the internet.

You can add the necessary rules to ufw by executing the following commands:

sudo ufw allow 16261/udp
sudo ufw allow 8766:8767/udp
sudo ufw allow 27015/tcp

Run sudo ufw status verbose to confirm that ufw is running and your configurations have been set correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment