Downloading and installing a game server with SteamCMD on an Ubuntu based linux server. This is following on from this post about installing and setting up SteamCMD on Ubuntu 18.
Switch to your Steam user and navigate to your SteamCMD directory
su - steam
cd /home/steam/steamcmd
run:
./steamcmd.sh
And login either anonymously or with a Steam account:
login anonymous
Note certain games need to be account logged in to download and run.
Set the server installation directory:
force_install_dir /home/steam/rust
Then download using the app id with:
app_update APPID validate
For Rust it will be:
app_update 252490 validate
A good place to find the game app id is SteamDB.
All this can be automated into one line:
./steamcmd.sh +login USERNAME PASSWORD +force_install_dir /home/steam/rust +app_update 252490 +quit
You can then run the server with your chosen parameters which are different for each game.
For this Rust example:
./RustDedicated
-batchmode +server.ip 0.0.0.0 +server.port 28015 +server.tickrate 10 +server.hostname "Your Server Name" +server.identity "your_server_identity" +server.seed 793197 +server.maxplayers 50 +server.worldsize 3000 +server.saveinterval 600 +rcon.ip 0.0.0.0 +rcon.port 28016 +rcon.password "Your_Rcon_Password" -logfile "logfilename.log"