How to Host a Counter-Strike: Source Server on Linux (Ubuntu)

In this tutorial, I’m using a dedicated server running Ubuntu to host a Counter-Strike: Source server.

Install the necessary packages.

sudo apt-get update
sudo apt-get install lib32gcc1 screen wget

Create a directory for the CSS server.

mkdir ~/css ; cd ~/css

Retrieve and extract SteamCMD.

tar -xvzf steamcmd_linux.tar.gz

Run SteamCMD.


The program will update itself and you’ll be brought to a Steam prompt. For CSS, you can just login anonymously.

login anonymous

Next, set the installation directory and let SteamCMD start downloading all of the necessary files. (Make sure you specify an absolute path)

force_install_dir /home/<user>/css/game/
app_update 232330 validate

That part will take a while. After it’s complete, you’re ready to run your server.


But there are a few things you should do first.

1. Create a server.cfg file

vi ~/css/game/cstrike/cfg/server.cfg

I only bother configuring a few settings, and leave all other cvars at their default values.

hostname "sample hostname"
rcon_password "samplepassword"

2. Decide what kind of variables you want to pass to srcds_run.

For example:

~/css/game/srcds_run -game cstrike +ip -port 27015 +map cs_militia -secure

I just put that code above into a script and then execute it inside of a screen session, disconnect from the screen, and start playing.

screen -S css ~/

Ctrl + A, D to disconnect from screen.

Connecting to your server

You can open the developer console and connect to your server via IP address with this command:

connect x.x.x.x

Remember to forward port 27015 on your router.

Installing SourceMod and Metamod:Source

Head over to and to get the latest versions of SourceMod and Metamod:Source and choose a mirror.

cd ~/css/game/cstrike
tar xvf sourcemod-1.5.2-linux.tar.gz
tar xvf mmsource-1.10.0-linux.tar.gz