Infernales/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 84: Line 84:
ExecReload=/bin/kill -s HUP $MAINPID
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s INT $MAINPID
ExecStop=/bin/kill -s INT $MAINPID
User=demon
User=your_username
Group=users
Group=users
Restart=on-failure
Restart=on-failure

Revision as of 12:04, 8 February 2024

DO NOT RUN THE SERVER AS ROOT! ALL ACTIONS IN THIS GUIDE WERE PERFORMED AS A NORMAL USER, OR UNDER SUDO!

Downloading SteamCMD.

Debian:

sudo apt-get install lib32gcc-s1

RHEL:

sudo yum install glibc.i686 libstdc++.i686

Arch Linux:

sudo pacman -Syy glibc lib32-glibc nano

After installing these packages, do the following:

mkdir -p ~/servers/steamcmd && cd ~/servers/steamcmd
curl -sqL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar zxvf -

Downloading DayZ server.

Instead of your_login, you must indicate your Steam login.
Updating the server is performed using the same commands as installation.

Downloading DayZ server without mods.

Public branch:

~/servers/steamcmd/steamcmd.sh +force_install_dir ~/servers/dayz-server/ +login your_login +app_update 223350 +quit

Experimental branch:

~/servers/steamcmd/steamcmd.sh +force_install_dir ~/servers/dayz-server/ +login your_login +app_update 1042420 +quit

Downloading DayZ server with mods.

For example, let's install two mods on a public branch: Community Framework and Community Online Tools:

~/servers/steamcmd/steamcmd.sh +force_install_dir ~/servers/dayz-server/ +login yout_login +app_update 223350 +workshop_download_item 221100 1559212036 +workshop_download_item 221100 1564026768 +quit

Run DayZ server.

Don't forget to configure the server before running!

Run DayZ server without mods:

сd ~/servers/dayz-server/
./DayZServer -config=serverDZ.cfg -port=2301 -BEpath=battleye -profiles=profiles -dologs -adminlog -netlog -freezecheck

Run DayZ server with mods:

In this example, there will still be two mods: Community Framework and Community Online Tools.

cd ~/servers/dayz-server/
ln -s ~/servers/dayz-server/steamapps/workshop/content/221100/1559212036 ~/servers/dayz-server/1559212036
ln -s ~/servers/dayz-server/steamapps/workshop/content/221100/1564026768 ~/servers/dayz-server/1564026768
find ~/servers/dayz-server/steamapps/workshop/content/221100/ -depth -exec perl-rename -v 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
ln -s ~/servers/dayz-server/steamapps/workshop/content/221100/1559212036/keys/* ~/servers/dayz-server/keys/
./DayZServer -config=serverDZ.cfg -port=2301 "-mod=1559212036;1564026768;" -BEpath=battleye -profiles=profiles -dologs -adminlog -netlog -freezecheck

Ctrl+C - Close the server.

Run DayZ server as daemon with restart after crash and auto-update.

Instead of your_login, you must indicate your Steam login.
Instead of your_username should be your username in the OS.

Let's create the initial scripts:

  1. Without mods: nano ~/servers/dayz-server/update.sh
    ~/servers/steamcmd/steamcmd.sh +force_install_dir ~/servers/dayz-server/ +login your_login +app_update 223350 +quit
    With mods: nano ~/servers/dayz-server/update.sh
    ~/servers/steamcmd/steamcmd.sh +force_install_dir ~/servers/dayz-server/ +login your_login +app_update 223350 +workshop_download_item 221100 1559212036 +workshop_download_item 221100 1564026768 +quit
    rm ~/servers/dayz-server/1559212036 ~/servers/dayz-server/1564026768 ~/servers/dayz-server/keys/jacob_mango_v3.bikey
    ln -s ~/servers/dayz-server/steamapps/workshop/content/221100/1559212036 ~/servers/dayz-server/1559212036
    ln -s ~/servers/dayz-server/steamapps/workshop/content/221100/1564026768 ~/servers/dayz-server/1564026768
    find ~/servers/dayz-server/steamapps/workshop/content/221100/ -depth -exec perl-rename -v 's/(.*)\/([^\/]*)/$1\/\L$2/' {} \;
    ln -s ~/servers/dayz-server/steamapps/workshop/content/221100/1559212036/keys/* ~/servers/dayz-server/keys/
  2. Ctrl+O
  3. Ctrl+X
  4. sudo chmod +x ~/servers/dayz-server/update.sh
  5. sudo nano /etc/systemd/system/dayz-server.service
    [Unit]
    Description=DayZ server
    Wants=network-online.target
    After=syslog.target network.target nss-lookup.target network-online.target
    
    [Service]
    ExecStartPre=/home/your_username/servers/dayz-server/update.sh
    ExecStart=/home/your_username/servers/dayz-server/DayZServer -config=serverDZ.cfg -port=2301 "-mod=1559212036;1564026768;" -BEpath=battleye -profiles=profiles -dologs -adminlog -netlog -freezecheck
    WorkingDirectory=/home/your_username/servers/dayz-server/
    LimitNOFILE=100000
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s INT $MAINPID
    User=your_username
    Group=users
    Restart=on-failure
    RestartSec=5s
    
    [Install]
    WantedBy=multi-user.target
  6. sudo systemctl daemon-reload

Commands to control the daemon:

sudo systemctl enable dayz-server - Enables server autostart when the OS starts.

sudo systemctl disable dayz-server - Disables server autostart when the OS starts.

sudo systemctl start dayz-server - Starting the server.

sudo systemctl restart dayz-server - Restarting the server.

sudo systemctl stop dayz-server - Stopping the server.

sudo systemctl status dayz-server - Checking the server status.