Tutorial on setting up a Project Zomboid online game server
مقدمه‌ای بر راه اندازی سرور بازی Project Zomboid با تمرکز بر نصب، پیکربندی، و بهینه‌سازی برای گیمرها و مدیران سرور.

Tutorial on setting up a Project Zomboid online game server

This article provides a complete tutorial for setting up a Project Zomboid online game server. By learning how to install, configure, and optimize performance, you can create a stable and secure server for gamers.
0 Shares
0
0
0
0

Prerequisites and server selection

In this section, basic requirements and hardware recommendations for setting up a server are provided. Project Zomboid We review the proposed distributions. Ubuntu 20.04/22.04 Or Debian 11/12 Which are known for tested and stable game servers.

Recommended hardware resources:

  • Up to 10 players: 2-4 vCPUs, 4-8 GB RAM, SSD disk
  • 10-50 players or multiple modes: 4+ vCPUs, 8+ GB RAM
  • Note: Mods and server rendering require more memory and CPU; use compute servers or graphics servers for heavy applications.

An up-to-date operating system, root or sudo access, and open ports are required for player access.

Example of installing basic packages (Ubuntu/Debian)

sudo apt update && sudo apt install -y openjdk-11-jre-headless steamcmd screen unzip htop fail2ban rsync

Explanation: Choose the Java version based on the game version (OpenJDK 11 is usually compatible). Use OpenJDK 17 if needed.

Create a dedicated user and directory structure

It is recommended to run the game server under a non-root user to Security isolation And make permissions management easier.

sudo useradd -m -s /bin/bash pzserver
sudo passwd pzserver
sudo mkdir -p /home/pzserver
sudo chown -R pzserver:pzserver /home/pzserver

Download and install Dedicated Server with SteamCMD

To download server files from SteamCMD Project Zomboid supports Steam Workshop for mods.

sudo -u pzserver steamcmd +login anonymous +force_install_dir /home/pzserver +app_update 380870 validate +quit

Explanation: If you encounter a different appid, check the SteamCMD log or the official game documentation.

Creating and editing the server configuration file

The main configuration files are usually located in the installation folder. The file names may include servertest.ini, server.ini, or serverconfig.lua.

Example of basic settings in servertest.ini

# servertest.ini (sample)
Public=true
ServerName=MyPZServer
ServerPort=16261
MaxPlayers=32
Password=MySecretPass
RCONPort=16262

Select the ports based on your needs and open them in the firewall. Test any changes and restart the service.

Opening ports and configuring firewall (UFW and iptables)

Before starting, open the ports specified in the configuration file in the firewall. Example with UFW:

sudo ufw allow OpenSSH
sudo ufw allow 16261/udp
sudo ufw allow 16262/udp
sudo ufw enable
sudo ufw status

Some installations may require TCP ports; check the server logs. If the server is behind NAT, set up port forwarding on the router.

Installing mods (Steam Workshop)

There are two common ways to install mods: downloading directly with SteamCMD or subscribing to the Workshop via the client and copying the mod folder to the server.

Method 1: Download mods with SteamCMD

sudo -u pzserver steamcmd +login anonymous +workshop_download_item 108600 <ITEMID> +quit

After installing the mods, fill in the server/mods or server/WorkshopItems.txt files according to the mods' documentation and restart the server.

Running the server (screen/systemd)

For quick execution, you can use screen Use or create a systemd service to run the server automatically.

Example with screen

sudo -u pzserver screen -S pzserver
cd /home/pzserver
./start-server.sh

To exit the screen: Ctrl+A then D. To return: sudo -u pzserver screen -r pzserver.

Example systemd service

sudo tee /etc/systemd/system/pzserver.service > /dev/null <<'EOF'
[Unit]
Description=Project Zomboid Server
After=network.target

[Service]
Type=simple
User=pzserver
WorkingDirectory=/home/pzserver
ExecStart=/bin/bash -lc './start-server.sh'
Restart=on-failure
LimitNOFILE=4096

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now pzserver.service
sudo systemctl status pzserver.service

Java Optimization and Memory Allocation

For better performance, run the JVM with appropriate parameters. A generic example that should be set based on RAM and performance testing:

java -Xms4G -Xmx6G -server -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+UseStringDeduplication -jar ProjectZomboidServer.jar

Note: Set the Xmx value based on the server RAM and number of players. Usually for each player 150-400 MB Consider; mods increase consumption.

Backups

Back up your player and world saves regularly and send the backups to a separate location (remote backup or cloud storage).

Example cron for daily backup

sudo crontab -u pzserver -e
# Example using rsync
0 3 * * * /usr/bin/rsync -a --delete /home/pzserver/Saves /backups/pzserver/$(date +\%F)/

# Or using tar
0 2 * * * /bin/tar -czf /backups/pzserver/saves_$(date +\%F).tar.gz -C /home/pzserver Saves

Security and DDoS protection

Security recommendations include setting a server password, using fail2ban It is for SSH protection and regular system updates.

  • Use anti-DDoS services or layered firewalls to protect against attacks.
  • Restrict access to RCON or management tools to specific IPs.

Companies that 85+ locations and the BGP/Anti-DDoS infrastructure they provide can provide significant protection.

Monitoring and logging

Logs are usually located in /home/pzserver/logs or a similar folder; to view them live, use the tail -f command:

tail -f /home/pzserver/console.txt

To check sources, use tools such as htop, iotop and netstat. In professional environments, use Prometheus + Grafana or cloud monitoring services.

Testing connectivity and troubleshooting common problems

Players usually through IP:Port Or the Steam server list will connect. If the connection fails:

  • Check the ports (e.g. ufw status Or sudo ss -ulnp | grep 16261).
  • Check NAT and forwarding.
  • Check the server log for Java mode or version errors.
  • The version of the mods on the server and client must match.

Location selection and practical suggestions

For the lowest ping, choose a server close to the majority of players:

  • Central Europe for European players
  • East or West America for American players
  • Asia (Singapore/Japan) for Asian players

Services provided with 85+ global locationsGaming VPS and anti-DDoS servers allow you to deploy the server closer to the players to reduce ping and lag.

Additional tips and best configurations

  • Automatic updates: Write scripts that take backups before updates.
  • Use snapshots for quick rollback on a cloud server.
  • Check server behavior with load testing (user or bot testing).
  • Maintain documentation of mode and configuration changes.

Conclusion: By following the steps above, you can set up a stable, secure, and scalable server for Project Zomboid. We've covered everything from installing SteamCMD and configuring files to managing mods and taking backups.

Frequently Asked Questions

You May Also Like