www.rodneybeede.com "I would love to change the world, but they won't give me the source code" - unknown
 Navigation

Howto setup Synergy Half-life 2 dedicated server on Linux - Last Modified 2018-05-15 17:40 UTC - Created 2018-02-27 02:52 UTC

Pre-reqs

  1. You need a Steam account with a purchased copy of Half-life 2 (ep0, 1, or 2)
    • Only needed once during install, not required for running server afterwards (server will run anonymously)
  2. Ubuntu 17.10 Server 64-bit
    • Used in my setup, but the 16.04 LTS would probably work too
  3. About 20GB of disk space per episode
  4. Appropriate iptables firewall rules to permit traffic (doced later)
  5. 512MB of memory is sufficient, 1 vCPU

Steps

Setup steam user and steamcmd

  1. Following assume you are root, but can prefix with sudo if you like
  2. useradd -m steam
  3. apt-get update; apt-get -y dist-upgrade; apt-get -y autoremove; apt-get -y autoclean; apt-get -y clean
  4. reboot
  5. apt-get install lib32gcc1
  6. su - steam
  7. mkdir ~/Steam && cd ~/Steam
  8. curl -O "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz"
    • The apt-get install steamcmd is not recommended, use latest instead
  9. tar -xvf steamcmd_linux.tar.gz
  10. iptables -A INPUT -p udp --dport 27015 -j ACCEPT
  11. iptables -A INPUT -p tcp --dport 27015 -j ACCEPT

Download Half-life 2 and Synergy

  1. su - steam
    • If not already
  2. cd ~steam/Steam/
  3. bash ./steamcmd.sh login YOUR_USERNAME app_update 17520 app_update 220
    • Enter your password when prompted. Also 2FA code if asked
    • Add more add_update ### if you want the other episodes too (hl2=220, ep1=380, ep2=420, lostCoast=340, ep3=*all*_the_decimals_in_pi)
  4. cd ~steam/Steam/steamapps/common/Synergy/synergy/
  5. vi mount.cache
    • Add which game to mount as needed (hl2, ep1, ep2)
    • Create file if necessary
    • hl2,ep1,ep2
  • vi motd.txt
  • vi cfg/server.cfg
    hostname "NotOSNameButNameYouWantToShowInSynergy"
    rcon_password "betterMakeThisGoodOrYouGetPwned_also-not-encrypted-over-network"
    sv_password "you-can-leave-this-as-empty-quotes-for-public-server"

    sv_tags "mario,luigi"

    sv_cheats 1
    developer 1
  • Run Server

    cd ~steam/
    nohup sudo -i -u steam /home/steam/Steam/steamapps/common/Synergy/srcds_run -console -game synergy -port 27015 +map d1_trainstation_01 -nocrashdialog -insecure -nohltv &
    

    rcon (Remote Console to admin server from client)

    This tends to not work as the TCP port binds itself to the second network adapter instead of INET_ANY (0.0.0.0) or your primary IP. Seems to be a bug, and I don't know of any config option or workaround.

    I just ssh onto the server box and run a local rcon program in python to edit variables live. Or you can place any settings you need in your server.cfg.

    1. apt-get install python3-pip
      • python 3 is important
    2. python3 --version
    3. su - steam
    4. pip3 install pysrcds
    5. python3 rcon.py status

    rcon.py

    from srcds.rcon import RconConnection
    import sys
    
    conn = RconConnection('YOUR_SECOND_NIC_INTERFACE_IP_HERE', '27015', 'betterMakeThisGoodOrYouGetPwned_also-not-encrypted-over-network', single_packet_mode=True)
    response = conn.exec_command(sys.argv[1])
    
    print( response )
    

    References