Pre-reqs
- 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)
- Ubuntu 17.10 Server 64-bit
- Used in my setup, but the 16.04 LTS would probably work too
- About 20GB of disk space per episode
- Appropriate iptables firewall rules to permit traffic (doced later)
- 512MB of memory is sufficient, 1 vCPU
Steps
Setup steam user and steamcmd
- Following assume you are root, but can prefix with sudo if you like
- useradd -m steam
- apt-get update; apt-get -y dist-upgrade; apt-get -y autoremove; apt-get -y autoclean; apt-get -y clean
- reboot
- apt-get install lib32gcc1
- su - steam
- mkdir ~/Steam && cd ~/Steam
- curl -O "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz"
- The apt-get install steamcmd is not recommended, use latest instead
- tar -xvf steamcmd_linux.tar.gz
- iptables -A INPUT -p udp --dport 27015 -j ACCEPT
- iptables -A INPUT -p tcp --dport 27015 -j ACCEPT
Download Half-life 2 and Synergy
- su - steam
- cd ~steam/Steam/
- 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)
- cd ~steam/Steam/steamapps/common/Synergy/synergy/
- 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.
- apt-get install python3-pip
- python3 --version
- su - steam
- pip3 install pysrcds
- 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
|