Counter-Strike 1.6 Dedicated Server. Basic Setup.
Tags: tutorial, cstrike
Published: 2022-01-24 19:31:31

## Intro

Hey!
In this series of tutorials we will cover how to set up a dedicated Counter-Strike 1.6 server so can customize it as you want and play with your friends. For that purpose I would suggest to rent a [VPS](https://en.wikipedia.org/wiki/Virtual_private_server) running Ubuntu OS. We'll use [Linux Game Server Managers](https://linuxgsm.com/) utility to make server setting up process easier (I tried to use [SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD "SteamCMD") directly to create a dedicated server but it was a pain), it would also send us alerts to Email, Discord, Slack, Telegram etc.

The server I rent for this tutorial series has the following configuration:

* **1 CPU Core, 3.0 MHz**
* **2 GB RAM**
* **20 GB SSD**
* **Ubuntu 20.04 LTS**

Such VPS is quiet cheap and powerful enough to manage up to 24 simultaneous players for sure. I used VPS with the same config to play with my friends and CPU usage was about 7-10% for 6 players and only few tiny plugins.

My PC config is not important so let's just mention that it's running Windows.

## Let's get it started

Once you decided which VPS to rent and have it running, connect to it via `ssh` or in any other way that will let you access server's terminal. First of all, we have to install all the dependencies required for our Counter-Strike server.

Here is the command to install dependencies on Ubuntu 20.04 or older:

```
sudo dpkg --add-architecture i386; sudo apt update; sudo apt install curl wget file tar bzip2 gzip unzip bsdmainutils python3 util-linux ca-certificates binutils bc jq tmux netcat lib32gcc1 lib32stdc++6 libsdl2-2.0-0:i386 steamcmd
```

This will also install [SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD "SteamCMD") so you will be asked to agree with Steam License Agreement.

> If your server is running on Debian/CentOS or if your Ubuntu version is => 20.10 navigate to `Dependencies` tab on [this page](https://linuxgsm.com/servers/csserver/ "this page") to find appropriate dependencies instllation command.

For security reason it's not recommended to run game server on the root user so let's create a new one for that purpose and switch to it:

```
adduser csserver
```

```
su - csserver
```

Now we have to download `linuxgsm.sh` and run it to be able to install our game server:

```
wget -O linuxgsm.sh https://linuxgsm.sh && chmod +x linuxgsm.sh && bash linuxgsm.sh csserver
```

> If download link doesn't work for you, it might be changed. Look for the possibly updated one by navigating to `Install` tab on [this page](https://linuxgsm.com/servers/csserver/ "this page").

## Game server installation

To install game server type:

```
./csserver install
```

It might take some time to install, just wait for it to finish. Also You'll be asked multiple times to confirm some staff like server installation directory and to agree/disagree with anonymous statistics gathering. Read carefully what you're asked for!

> It's a common thing for SteamCMD to fail when downlading game server for the first time:</br>
```
Error! App '90' state is 0xE after update job.
Error! Installing csserver: SteamCMD: Unknown error occured
```
>Don't be so quick to throw your keyboard to the window, just wait for the next try, `linuxgsm.sh` script will manage it for you.

In logs under yellow *"Config File Locations"* title you'll find a useful information about configs files paths:
```
Game Server Config File: /home/csserver/serverfiles/cstrike/csserver.cfg
LinuxGSM Config: /home/csserver/lgsm/config-lgsm/csserver
```

## Server Configuration

We're done with installation at this point, but don't rush to start the game server. We have to set server ip and tweak some launch parameters.

LinuxGSM configs for our game server instllation are located in `/home/csserver/lgsm/config-lgsm/csserver` catalogue. Navigate to it via console or use any FTP/SFTP client your're comfortable to work with. You'll see a banch of files here:

```
_default.cfg
common.cfg
csserver.cfg
secrets-common.cfg
secrets-csserver.cfg
```

Descriptive information about these configs can be found on [this page(https://docs.linuxgsm.com/configuration/linuxgsm-config). **I highly recommend checking it out**. Btw, it is possible to run multiple game servers on the same machine. For that, different approaches can be used:

* multiple instances for the single game server installation
* multiple game server installations, each for separate user (i.e single instance per installation)

> For instruction regarding multiple game servers settings navigate [here](https://docs.linuxgsm.com/features/multiple-game-servers "here").

In this article we discuss only single server instance per installation. So here is the brief explanation of config files we're interested in.

`_default.cfg` - some sort of master config, all of its parameters will be applied to game servers related to the current installation. No sense to change cuz it will be reset after LinuxGSM update. So put all of your settings to the next two configs.
`common.cfg` - here you can set parameters that are common for all of game server instances related to the current installation. It will override `_default.cfg`.
`csserver.cfg` - parameters for the `csserver` instance of game server. This one will override `_default.cfg` and `common.cfg`.

What we gonna do is to copy parameters from the master (`_default.cfg`) config to our instance config `csserver.cfg`.

First one is `ip="0.0.0.0"` line. Put it to `csserver.cfg` and set `ip` parameter value to IP address of your server (**keep quotes**).

Most probably you'll want to change default map and max players count for you server, copy these parameters too, keep default values for now.

```
defaultmap="de_dust2"
maxplayers="16"
```

The last but not least parameter is `startparameters`. We'll keep its value but add few more start parameters to the end:

* `+pingboost 2` - *"Selects between optimized HLDS network code stack. Set this on 2 usually reduces latency toward 1ms without loss of activity input packets"* ([docs](https://developer.valvesoftware.com/wiki/Command_Line_Options "docs")).
* `+sys_ticrate 1000` - this is something like FPS on the server side. 1000 is default value and usually no need to change it to higher values.

So the resulting value of `startparameters` is:

```
startparameters="-game cstrike -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} +pingboost 2 +sys_ticrate 1000"
```

And the final look of our `csserver.cfg` should be like:

```
##################################
####### Instance Settings ########
##################################
# PLACE INSTANCE SETTINGS HERE
## These settings will apply to a specific instance.

## Predefined Parameters | https://docs.linuxgsm.com/configuration/start-parameters
ip="<YOUR SERVER IP>"
defaultmap="de_dust2"
maxplayers="16"

## Server Parameters | https://docs.linuxgsm.com/configuration/start-parameters#additional-parameters
startparameters="-game cstrike -strictportbind +ip ${ip} -port ${port} +clientport ${clientport} +map ${defaultmap} +servercfgfile ${servercfg} -maxplayers ${maxplayers} +pingboost 2 +sys_ticrate 1000"
```

## Testing the server

So our server is ready to be started. One more thing we're gonna add is change its display name (i.e. host name) in Servers window inside the game. For that navigate to the game server config file (we saw its path before, after game server was installed) - `/home/csserver/serverfiles/cstrike/csserver.cfg`

> This is the config file you'll have to change to set your game server variables, not `server.cfg`!

Here you'll find `hostname "LinuxGSM"` on the first two lines. Let's change it to `"DEV.TO Test Server"`.

> Note that there is no `=` character between variable name and its value (**in quotes for strings**).

Save your changes and go back to the terminal. Navigate to your server root directory `/home/csserver` and start the server:

```
./csserver start
```

You'll see something like:

```
[  OK  ] Starting csserver: Applying steamclient.so sdk64 hardlink fix: Counter-Strike 1.6
[  OK  ] Starting csserver: Applying steamclient.so sdk32 link fix: Counter-Strike 1.6
[  OK  ] Starting csserver: DEV.TO Test Server
```

Now open the game and add connect to it via Servers menu or use `connect <YOUR SERVER IP>` command in game console.

If you don't see your server there might be some error occurred, go back to your server terminal and open game server logs:

```
./csserver console
```
or
```
./csserver c
```

> **When in game server logging "mode", dont't press `Ctrl+C` to exit (this command will stop your server!). Use `Ctrl+B`, then `D` insted.**

So this is it. It takes almost no time to set up your own dedicated server for Counter-Strike 1.6. The most time consuming stuff is setting up AMXX and plugins (if you want any) which will be covered in the next tutorial ([Part 2](https://dev.to/flatmango/counter-strike-16-dedicated-server-part-2-modes-17p6)).
Thanks to everyone for reading. Have a good game!

___

## Bonus

### Details
Use the following command to see a nicely formatted details of your game server:

```
./csserver details
```

### Rates
Most probaly you'll want to tweak your server rates variables (add them to `csserver.cfg`) for more comfortable playing:

```
sv_maxrate
sv_minrate
sv_maxupdaterate
sv_minupdaterate
```

Hopefully these two articles ([[1]](https://novarex.org/threads/rates-guide-for-cs-1-6.682/ "[1]"), [[2]](https://steamcommunity.com/sharedfiles/filedetails/?id=126383209 "[2]")) will help you to find the best values for your server.

### More detailed logs

If you want to see players messages in server logs, add `mp_logmessages 1` to `csserver.cfg`.

If you want to see combat logs, add `mp_logdetail` variable to your config. Possible values:

* `0` - Turn attack logging off.
* `1` - Only enemy combat damage.
* `2` - Only friendly combat damage.
* `3` - All forms of combat damage (both friendly and enemy).

### Map cycle

To tweak map cycle on your game server, change `/home/csserver/serverfiles/cstrike/mapcycle.txt` file.