Egg Repository

Pterodactyl Community Egg Repository

DayZ

How long can you survive a post-apocalyptic world? A land overrun with an infected "zombie" population, where you compete with other survivors for limited resources. Will you team up with strangers and stay strong together? Or play as a lone wolf to avoid betrayal? This is DayZ – this is your story.

Read Me

DayZ

[!NOTE] This Egg is for the standalone version of DayZ only. It is not for the DayZ mod on Arma 2 or Arma 3.


Authors / Contributors


Game Description

From Bohemia Interactive's Website:

How long can you survive a post-apocalyptic world? A land overrun with an infected "zombie" population, where you compete with other survivors for limited resources. Will you team up with strangers and stay strong together? Or play as a lone wolf to avoid betrayal? This is DayZ – this is your story.


Egg Capabilities

  • Able to download server updates on startup
  • Able to download, update, and load Steam Workshop mods on startup (*see Installation/System Requirements: Game Ownership)
    • Also accepts server-side only mods.
    • Checks for mod updates against their Steam Workshop page's last update for quick and efficient update checks.
    • Automatically moves mod .bikey's to the /keys/ directory.
    • Note: These features only work with mods in the @workshopID# format. Manually uploaded mods are not automatically updated.
  • Multiple basic settings found within the serverDZ.cfg file can be easily set from the server's Startup tab
    • Server name, passwords, disable third person, persistent time, and more...
  • Max Players is configurable and able to be host enforced (*see Recommended Egg Modifications)
  • Additional DayZ startup parameters can be added to fine-tune performance
  • WHMCS compatible (*see Recommended Egg Modifications)

Server Ports

Default server ports are listed below, but all ports can be changed freely.

Port Default Protocol Required Notes
Game 2302 UDP Yes Primary port in Panel
Steam Query 27016 UDP Partially Required for server listing
RCON 2305 UDP No Required to be defined, but not required to be assigned to the server

Installation/System Requirements

[!IMPORTANT] A real, valid Steam account is required to install this game server.

[!WARNING] Steam Guard must be completely turned off for the server and mods to download efficiently. See Running With Steam Guard Enabled for an unofficial workaround.

Bare Minimum Recommended
Processor Recent x86/64 (AMD/Intel) processor. No 32-bit or ARM support. Avoid CPU Pinning; may cause issues.
RAM 4096-5120 MiB 8192 MiB
Storage 3072 MiB 7168+ MiB (depends on how many mods are installed)
Network 0.512 Mbit/s/player 1-5 Mbit/s/player
Host OS Most stable Linux OS branches should work Using the latest kernel version for your installed OS can prevent some edge-case installation/boot issues.

Game Ownership:

While not required, it is highly recommended that the Steam account used to install this server owns the DayZ game for the following reasons:

  • Vanilla mission files will only update automatically with the server if the game is owned.
    • They can still be manually updated by deleting the mpmissions/ directory and reinstalling the server (this will not erase other files).
  • Automatic Steam Workshop mod downloading requires ownership.
    • This is optional functionality, and mods can be manually uploaded to the server if desired.
    • Hosts may feel free to change the "[Host] Disable Mod Downloads/Updates" variable to 1 if they would not like to offer this functionality to clients.

Recommended Egg Modifications

The following are highly recommended variable modifications you can make to the egg after importing it to your panel. While viewing this egg, simply go to the "Variables" tab of the egg editor to make these changes.

Default Steam Username & Password

  • To make deploying servers easy (or if you are using WHMCS), it is recommended to edit the default values of "Steam Username" and "Steam Password" to your Steam account dedicated for hosting. This will make all newly installed servers use these credentials. DO NOT make these fields visible to the end user so that they can use their own Steam accounts; the panel will save their Steam credentials in plain text, which is a BIG NO NO for security and privacy.

Restrict Max Players

  • If you would like to restrict the maximum number of players that can join your client's server, you can change the permissions of the "Max Players" variable so that clients can only view this value (and not edit it). It's default value can also be changed, or the value can be changed on a server-by-server basis as desired.

Running With Steam Guard Enabled

[!CAUTION] The following is highly discouraged for production environments or even private use. It should only be used if you really don't want to disable Steam Guard and don't plan on updating your server/mods often. Support will not be given to those with Steam Guard enabled. Additionally, using this method, you are at risk of rate limiting your account if something goes wrong.

  1. When creating your server, set the variables "[Host] Skip Game Server Install" and "[Repair] Validate Server Files" to 1.
  2. Proceed with installation as normal.
  3. If the server has not automatically started after installation, start it.
  4. The console will eventually appear to freeze on the line: Loading Steam API...OK. You will likely receive a Steam Guard request for login at this time. Approve this request just to be safe, but this will not log you in. Next, obtain a valid Steam Guard code, enter it into the console, and press Enter to submit it. This should log you in. It is successful if you see: Two-factor code:OK. The server will then download for the first time. Note: It may glitch and not display installation progress; be patient while it downloads and verifies.
    • If you have mods to install, you will have to repeat this process of obtaining and entering in a new Steam Guard code for every mod.
  5. The server should properly start at this time.
  6. Go to the Startup tab and disable "[Repair] Validate Server Files". Also, it is recommended you disable the "Automatic Updates" Startup Variable until you need to update again. Otherwise, you will have to go through the process of entering in Steam Guard codes again every boot.
Yolks
NameTag
ghcr.io/ptero-eggs/games:dayzghcr.io/ptero-eggs/games:dayz
Variables
NameDescriptionEnvironment VariableDefault ValueUser ViewableUser Editable
[Host] Steam Query PortUDP port for Steam server list features. Helps the server be visible in the client server browser.QUERY_PORT27016YesNo
[Host] Steam UsernameUsed for installation and updates. Account does not need to own DayZ, but MUST BE a VALID Steam account (anonymous login cannot be used). For security reasons it is recommended that you create a new Steam account just for your dedicated servers. *This info is not visible to the server owner.*STEAM_USERNoNo
[Host] Steam PasswordUsed for installation and updates. Steam Guard MUST be completely TURNED OFF for the server and mods to download efficiently. *This info is not visible to the server owner, BUT IS stored in PLAIN TEXT. It is NOT advised to use a personal account; best to use a dummy account.*STEAM_PASSNoNo
[Host] Disable Mod Downloads/UpdatesIf the Steam account does not own the base DayZ game, Steam Workshop mod downloads/updates will not work. If so, this setting allows disabling of this feature to avoid errors. (1 ON | 0 OFF)DISABLE_MOD_UPDATES0NoNo
[Host] Number of SteamCMD Retry AttemptsHow many times SteamCMD should retry downloading a server or mod after a recoverable error. (ie. A particularly large mod download times out)STEAMCMD_ATTEMPTS3NoNo
[Host] Skip Game Server InstallSkips the installation of game server files via SteamCMD during the installation script. Should only be enabled if you are trying to install the server with a Steam account that has Steam Guard enabled (not recommended).SKIP_INSTALL0NoNo
Automatic UpdatesQuickly checks for any server or mod updates on startup, and updates if necessary.UPDATE_SERVER1YesYes
Server NameName of the server that will appear in the server list.SERVER_HOSTNAMEDayZ ServerYesYes
Max PlayersMaximum number of players allowed to join the server.MAX_PLAYERS64YesYes
Server PasswordPassword required to join the server. Leave blank to have no password.SERVER_PASSWORDYesYes
Admin PasswordPassword to log in as an admin on the server.ADMIN_PASSWORDYesYes
RCON PortUsed by Tools or Battlemetrics to manage servers from outside. RCON Port is recommended to be at Game Port +3. For example, If the Game Port is 2302, then RCON Port should be 2305.RCON_PORT2305YesNo
RCON PasswordThis password is used to authenticate third parties to access server controls via RCON.RCON_PASSWORDYesYes
Modlist File (Exported from DayZ Launcher)Filename for an exported modlist. This file will be parsed for mod installation and loading. Upload your HTML file to the root directory (eg. /home/container/modlist.html). Leave blank to disable loading mods from a modlist.MOD_FILEmodlist.htmlYesYes
Additional ModsA semicolon-separated list of mod folders to load from the root directory. Useful for loading manually uploaded mods. Any mods in this list that are in "@workshopID" form will also be included in Automatic Updates (if enabled). NO capital letters, spaces, or folders starting with a number! (ex. myMod;@123456789;@987654321;etc;)MODIFICATIONSYesYes
Verify SignaturesEnsures all clients have exactly the same version of mods or addons that the server is running. Otherwise, they will be kicked upon connection. (2 ON | 0 OFF)VERIFY_SIGNATURES2YesYes
Enforce Game VersionWhen ON, the server will allow the connection only to clients with same the version as the server.ENFORCE_BUILD1YesYes
Disable VoNWhen ON, will disable Voice over Network (voice chat) in the server.DISABLE_VON0YesYes
VoN QualityVoice over Network codec quality; the higher the better. (Values 0-30)VON_QUALITY20YesYes
Disable Third PersonWhen ON, will disable third person view while on the server.DISABLE_THIRD0YesYes
Disable CrosshairWhen ON, will disable the crosshair from being visible while on the server.DISABLE_CROSSHAIR0YesYes
Disable Personal LightWhen ON, will disable a personal light positioned above all clients during the night time while on the server.DISABLE_PERSONAL_LIGHT1YesYes
Darker NightsWhen ON, will make nights darker (more accurate nights, but hard to see without a light).LIGHTING_CONFIG0YesYes
Persistent TimeThe actual server time is saved to storage, so when ON, the next server start will use the saved time value.PERSISTENT_TIME0YesYes
Time MultiplierThis is a time multiplier for in-game time (ie. 12 would move a full 24-hour day in-game 12 times faster, making it last 2 hours "in real life"). (Values: 0-24)TIME_MULT12YesYes
Night MultiplierThis is an additional multiplier to either speed up or slow down nights in-game. It is multiplied with the "Time Multiplier" variable to get it's final multiplier for night time speed. (Values: 0.1-64.0)NIGHT_MULT1YesYes
[Repair] Make Mod Files LowercaseEvery mod that is set to be loaded will have its folder and files changed to lowercase (to prevent errors). It is recommended to enable this for one server boot after copying a mod from a Windows machine to the server, or if mods seem to not be loading.MODS_LOWERCASE0YesYes
[Repair] Validate Server FilesValidates all server files when Automatic Updates is ON. Note: This will significantly increase server startup times, so it is recommended to only enable this when needed.VALIDATE_SERVER0YesYes
[Advanced] Server-Side Only ModsMod folders to be used with the "-serverMods" startup option. They only run server-side and are not required by clients if "Verify Signatures" is ON. Any mods in this list that are in "@workshopID" form will also be included in Automatic Updates (if enabled). NO capital letters, spaces, or folders starting with a number! Each folder must be followed with a semicolon (ex. @123456789;@987654321;etc;)SERVERMODSYesYes
[Advanced] Extra Startup ParametersSee https://community.bistudio.com/wiki/DayZ:Server_Configuration#Launch_Parameters for more info on valid flags for this field.STARTUP_PARAMS-dologs -adminlog -netlog -freezecheckYesYes
[Advanced] Server BinaryCannot currently be changed. Left in case other branches with different executable names are introduced at a later date.SERVER_BINARYDayZServerYesNo
[Advanced] DayZ Dedicated Server App IDUsed for installation and updates. Rarely needs to be changed. 223350 is for Stable branch and 1042420 is for experimental branch. Changing branches may require deleting all server files and reinstalling.STEAMCMD_APPID223350YesNo
Install Script
#!/bin/bash

## File: Pterodactyl DayZ Egg - egg-pterodactyl-day-z.json
## Author: David Wolfe (Red-Thirten)
## Date: 2024/07/04
## License: MIT License
## Image to install with is 'ghcr.io/ptero-eggs/installers:debian'

export HOME=/mnt/server
CONFIG_URL="https://raw.githubusercontent.com/ptero-eggs/game-eggs/main/dayz/config/serverDZ.cfg"
MISSIONS_GITHUB_PACKAGE="BohemiaInteractive/DayZ-Central-Economy"

## Download and install SteamCMD
cd /tmp
mkdir -p $HOME/steamcmd $HOME/steamapps
curl -sSL -o steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzvf steamcmd.tar.gz -C $HOME/steamcmd
cd $HOME/steamcmd

# SteamCMD fails otherwise for some reason, even running as root.
# This is changed at the end of the install process anyways.
chown -R root:root /mnt

if [ "$SKIP_INSTALL" -eq 1 ]; then
    # This is for the minority of hosts who want to install this server with Steam Guard enabled.
    # Please read the README for instructions on how to do this properly!
    echo -e '"Skip Game Server Install" variable is set to enabled!'
    echo -e "\tOnly SteamCMD will be installed..."
    ./steamcmd.sh +quit
else
    # Install/Verify game server using SteamCMD
    ./steamcmd.sh +force_install_dir $HOME "+login \"${STEAM_USER}\" \"${STEAM_PASS}\"" +app_update ${STEAMCMD_APPID} $( [[ -z ${STEAMCMD_BETAID} ]] || printf %s "-beta ${STEAMCMD_BETAID}" ) $( [[ -z ${STEAMCMD_BETAPASS} ]] || printf %s "-betapassword ${STEAMCMD_BETAPASS}" ) ${INSTALL_FLAGS} validate +quit
fi
echo -e ""

# Set up 32 and 64 bit libraries
mkdir -p $HOME/.steam/sdk{32,64}
cp -v linux32/steamclient.so $HOME/.steam/sdk32/steamclient.so
cp -v linux64/steamclient.so $HOME/.steam/sdk64/steamclient.so

## DayZ Setup
cd $HOME

# Check for successful server binary installation
if [ ! -f DayZServer ] && [ "$SKIP_INSTALL" -ne 1 ]; then
    echo -e "\n\n[ERROR] SteamCMD failed to install the DayZ Dedicated Server!"
    echo -e "\tTry reinstalling the server again.\n"
    exit 1
fi

# Download default serverDZ.cfg if it is missing or empty (occurs when Steam account *owns* the DayZ game)
if [ ! -f serverDZ.cfg ] || [ ! -s serverDZ.cfg ]; then
    echo -e "'serverDZ.cfg' is missing or empty. Downloading default config file..."
    curl -LO ${CONFIG_URL}
    if [ ! -f serverDZ.cfg ]; then
        echo -e "\n\n[ERROR] Failed to download default server config file!"
        exit 1
    fi
    chmod 644 serverDZ.cfg
fi

# Add required 'steamQueryPort' parameter to the end of serverDZ.cfg (if it's missing)
if ! grep -q "steamQueryPort" serverDZ.cfg; then
    echo -e "Adding additional required parameters to the end of 'serverDZ.cfg'..."
    cat >> serverDZ.cfg << EOL


steamQueryPort = ${QUERY_PORT};
EOL
fi

# Download vanilla mission files if they are missing (occurs when Steam account *does not own* the DayZ game)
if { [ ! -d "mpmissions" ] || [ -z "$(ls -A mpmissions 2>/dev/null)" ]; } && [ "$SKIP_INSTALL" -ne 1 ]; then
    echo -e "[WARNING] The Steam account used to install this server does not own the DayZ game!"
    echo -e "\tVanilla mission files will have to be MANUALLY updated in the future if they update! (See Egg's README for instructions)"
    echo -e "\tDownloading and installing vanilla mission files..."
    mkdir -p $HOME/mpmissions
    cd $HOME/mpmissions
    LATEST_JSON=$(curl --silent "https://api.github.com/repos/${MISSIONS_GITHUB_PACKAGE}/releases/latest")
    DOWNLOAD_URL=$(echo ${LATEST_JSON} | jq -r .tarball_url)
    curl -Lo mpmissions.tar.gz ${DOWNLOAD_URL}
    if [ ! -f mpmissions.tar.gz ]; then
        echo -e "\n\n[ERROR] Failed to download vanilla mission files!"
        exit 1
    fi
    tar -xzvf mpmissions.tar.gz --strip-components=1 --wildcards '*/dayzOffline.chernarusplus/*' '*/dayzOffline.enoch/*'
    rm -f mpmissions.tar.gz
fi

# Check for BattlEye RCon configuration
mkdir -p $HOME/battleye
cd $HOME/battleye
if [ ! -f beserver_x64.cfg ]; then
    echo -e "Creating BattlEye RCon Configuration..."
    cat > beserver_x64.cfg << EOF
RConPort ${RCON_PORT}
RConPassword ${RCON_PASSWORD}
RestrictRCon 0
EOF
fi

echo -e "\nDayZ Dedicated Server successfully installed!\n"