找回密码
 注-册

QQ登录

只需一步,快速开始

查看: 1648|回复: 6

Creating a Counter-Strike Server

[复制链接]
Leya 发表于 2008-4-29 21:35:39 | 显示全部楼层 |阅读模式
Introduction  by Sebastian · May 9th, 2005 ·

So.. you've been playing Counter-Strike and now you're wondering how to set up a server? This is one of the top most asked question we receive on our forums. For some, setting up a server can be a daunting task, but in reality, it is not that difficult.

After taking the 'Do not crash server course' I started running several Counter-Strike servers for broadbandreports and have been for the last couple of years. I've ran and tested just about every type of Half-Life mod out there. For some, running game servers can be a hobby during free time, and others run them as a business - You learn many other things in the process too. Hopefully, after reading this guide you will have no trouble creating a Counter-Strike server. On this page we'll talk mostly about things required to run a server.

Bandwidth Requirements
Some people think you need massive amounts of bandwidth to host a Counter-Strike server, while that is not entirely true, in most cases you can run a small server with as little as 256-384kbps. Yes, even from your home DSL or cable internet broadband. We do not recommend you run a production server off your home DSL or cable connection, but you certainly can host a small server just for fun or for a couple of friends. How much bandwidth you need? Well, that depends on the size of the server you want to run. In general, a good rule-of-thumb is roughly 6KB (Kilo-Bytes) upstream (upload) per player slot, but this will vary depending how you adjust and optimize the cvars in HL/CS which I will get into later in the guide. Below is a graph we've created to illustrate and give you general an idea of how much upstream bandwidth you will need. The text on the far left of the graph is line speed in kbps (kilobits per second) and the numbers below the bars indicates the amount of player slots.



Bandwidth estimate graph


I recommend any server above 14-16 player slots having at least 1mbit upstream, anything less and you might run into lag especially when you start adding custom maps to the server which clients will have to download. I also recommend using the sv_downloadurl cvar if you have a lot of custom maps and have a spare webserver. I won't get into detail about sv_downloadurl in this guide; that will be part of another guide but in short, it will allow you to use bandwidth from another server (ie: a mirror) to serve the maps and custom files without bogging down the game server.

Hardware Requirements
Insufficient hardware is just as bad as not having enough bandwidth to run the server, System requirements are much greater now with the release of Steam and the Source Engine than previous versions of Counter-Strike. The hardware you need will depend on the size of the server you want to run and whether it is going to be a dedicated server or a listen server (a server you host and play from at the same time - not recommended).

Memory. There is no such thing as "overkill". After having the proper hard-disks; lots of memory is the next most dominate factor in how well the server performs under heavy loads. Things like changing levels are very dependent on how much memory is available, along with fast drives, more memory will yield faster response time., having too little and you will run into long delays and occasional pauses.

Using the same concept we did earlier with bandwidth, we've created a chart to illustrate a rough estimate on how much memory you will need, based on the player count.


Memory estimate graph


Again, these are rough estimates. The red bars would be the least amount of memory you should consider and the green bars is the recommended amount of memory. No one is to say you cannot less or more than what is listed in the chart, but it is advice you should highly consider.

CPU Speed and Processor
I won't go into great detail on which is better (Intel vs. AMD) but no matter which setup you choose, Dual CPUs would be the best solution for a dedicated server environment. If you do not have the budget for a dual CPU setup, consider at least a single 2.4Ghz CPU, which should be more than capable to host a 28 player server, bearing you have the bandwidth and memory available.

Hard disk - 5400, 7200, or 10,000 RPM?
If the budget is right go for the 10,000 RPM disk, you don't have to run out and purchase expensive SCSI drives as 10K SATA drives are also on the market these days. Even a 7200 SATA with a large cache size (8MB+) would perform quite well. If you plan on running multiple game servers off one system certainly consider the 10k RPM disk. Stay away from the older slow IDE 5400RPM disks, you will have very high disk I/O levels, they are slow and will create a huge bottleneck on your server. Today's games don't stand a chance on them., having faster drives will dramatically decrease the loading time it takes for the server to switch maps.
回复

使用道具 举报

 楼主| Leya 发表于 2008-4-29 21:39:10 | 显示全部楼层

Page 2. Getting Started

Getting Started (Page 2 of 7) by Sebastian · May 9th, 2005 · 1579907 views
Before creating a server, it is a good idea to familiarize yourself with the cvars you will need to properly configure your server to your likings. We are going to cover the basic cvars, more advanced can be found on our cvarlist page. Starting with the basic: // hostname - Set the name of your server
hostname "My Counter-Strike Server"

// rcon_password - This allows you to control your server remotely, things like changing maps, kick/ban clients, etc.
rcon_password "specialpassword"

// mp_buytime <seconds> - The amount of time to allow purchasing weapons/equipment on round start
mp_buytime 0.45

// mp_startmoney <money> - Specify how much money players start off with
mp_startmoney 800

// mp_c4timer <seconds> - How long before the c4 explodes
mp_c4timer 45

// mp_timelimit <minutes> - How long each map should be played before switching levels
mp_timelimit 25

// mp_freezetime <seconds> - How long players are unable to move during round starts
mp_freezetime 5

// sv_cheats <0/1> - Whether to allow game cheat commands to be used by clients. 0 = off | 1 = on
sv_cheats 0

// sv_maxrate <1000-25000> - The maximum bandwidth rate the server is allowed to transmit to clients
sv_maxrate 10000

// sv_pausable <0/1> - Whether to allow clients to pause the server. 0 = off | 1 = on
sv_pausable 0

// sv_contact <email/web address> Contact email for server admin
sv_contact "admin@domain.com"

// sv_region <1-7> - The region of the world to report the server in.
// region codes can be found on this page.
sv_region 0

You may download this basic server.cfg here. For Counter-Strike, the server.cfg goes in the cstrike directory and for Counter-Strike: Source extract to the cstrike/cfg directory.
回复

使用道具 举报

 楼主| Leya 发表于 2008-4-29 21:39:55 | 显示全部楼层

Page 3. Windows: Install CS Source

Windows: Install CS Source (Page 3 of 7) by Sebastian · May 9th, 2005 ·
On this page we will cover the installtion process of Counter-Strike: Source on the Windows XP operating system. First, you will need to download and install the windows hldsupdatetool (local download). The default install path is C:\Program Files\Valve\HLServer which is fine in most cases. Your drive letter may differ than above. Be sure you run the hldsupdatetool installer with administrator privileges. Once you've installed the hldsupdatetool, continue reading.

Installing Counter-Strike: Source (SRCDS)
On Windows, click start, then select run and type cmd then, in the DOS window type: Code:
cd C:\Program Files\Valve\HLServer


Now, lets update and install Counter-Strike: Source, run the following command: Code:
HldsUpdateTool.exe -command update -game "Counter-Strike Source" -dir .


Note the period after -dir - Make sure not to leave it out.

Installation will take around 30-60 minutes (~800MB). After the "HLDS installation up to date" message, setup is now complete and you are ready to start the server.

Starting the server
There are two ways to start the server, either by using the fancy Steam GUI or the Console:


Console on left, Steam GUI on right

Which method you choose to start the server depend on the type of server. If it will be a temporary server then use the GUI for easy setup, otherwise, stick with the console, it uses less resources. Select one of the two options:

1. Starting CS Source Server via GUI
If you want to use the Steam GUI browse to C:\Program Files\Valve\HLServer find and double click srcds.exe, a menu will open and everything else should be self explanatory. If you choose the Steam GUI there is no need to read any further, you have successfully installed Steam, simply select your server start-up options using the GUI tabs. To start the server using the console method, continue reading.

2. Starting CS Source Server via Console
Browse to C:\Program Files\Valve\HLServer find and right click srcds.exe and select Create Shortcut. Now you should have a shortcut icon of srcds.exe. Right click that newly created shortcut and select Properties

By now, You should be in the shortcut properties window.


Shortcut properties


Counter-Strike command line options
Below are a list of commands you can enter in the target field to start the server.

-console
Initializes console mode

-autoupdate
Automatically update the server when Steam updates are released

-game <game name>
The HLDS mod you want to run

+maxplayers <number of players>
Amount of players to allow

+map <map name>
The map to start the server with

+port <port number>
The port number the server should run on. Can be left out if you plan on using the default port (27015).

Under the shortcut target field is where you will need to enter some options. See above for current -flags you can use, we want to start our server with a limit of 20 players and on cs_italy so our shortcut target field will look like this:

Code:
"C:\Program Files\Valve\HLServer\srcds.exe" -console -game cstrike -autoupdate +maxplayers 20 +map cs_italy


Note the quotes around the path, they are required if the path contains a space.

Now we click OK on the Shortcut window. To start the server we simply double click the shortcut we created and the server will start up with the options we added to the target area. Our server is now running:


Source Dedicated Server running


You can also start the server without creating a shortcut: Click on Start, Run, then type cmd now in the DOS prompt window, type: Code:
cd C:\Program Files\Valve\HLServer


then type: Code:
srcds.exe -console -game cstrike -autoupdate +maxplayers 20 +map cs_italy


However, we recommend creating the shortcut so you do not have to type the commands each and every time you want start the server.

Eventually, you will want to alter the server hostname, and other cvars for the server. To do this, use our SRCDS cfgmaker, It can generate a configuration file, even if you have very little knowledge.
回复

使用道具 举报

 楼主| Leya 发表于 2008-4-29 21:41:35 | 显示全部楼层

Page 4. Windows: Install CS 1.6

Windows: Install CS 1.6 (Page 4 of 7) by Sebastian · May 9th, 2005 ·
Ok, so you want to install Counter-Strike 1.6 instead of CS Source. The process is similar to installing CS Source, First, you will need to download and install the windows hldsupdatetool (local download). The default install path is C:\Program Files\Valve\HLServer which is fine in most cases. Your drive letter may differ than above. Be sure you run the hldsupdatetool installer with administrator privileges. Once you've installed the hldsupdatetool, continue reading.

Installing Counter-Strike 1.6 (HLDS)
Now that you have installed the hldsupdatetool, On Windows, click on start then select run and type cmd in the run box. The Windows DOS prompt should now be on your screen, now type:
Code:
cd C:\Program Files\Valve\HLServer


The DOS prompt should appear like so:


Changing to the HLServer install directory


Now we're ready to install Counter-Strike, type: Code:
HldsUpdateTool.exe -command update -game cstrike -dir .


Note the period after -dir - Make sure not to leave it out.


If all goes well, the install process will begin and you should now see a bunch of lines scroll on the DOS cmd prompt window.


hldsupdatetool has started to install and update CS

The installer will recognize it is a new install and proceed to download and update Counter-Strike. Leave the window alone! Be patient this may take a while, so go grab something to munch on while you wait, the installer takes roughly 20-30 minutes to download all files (~300MB) on a 6Mbit connection. After it is finished, you will see a "HLDS installation up to date" message.


CS install is now complete


Starting the server
There are two ways to start the server, either by using the fancy Steam GUI or the Console.



Console on left, Steam GUI on right


Which method you choose depend on the type of server. If it will be a temporary server then use the GUI for easy setup, otherwise, stick with the console, it uses less resources. Select one of the two options:

1. Starting via Steam GUI
Browse to C:\Program Files\Valve\HLServer and double click the hlds.exe icon. A menu will open and everything else should be self explanatory. If you choose the Steam GUI there is no need to read any further, you have successfully installed Steam, simply select your server start-up options using the GUI tabs. To start the server using the console method, continue reading.


Server startup GUI


2. Starting via Console
Browse to C:\Program Files\Valve\HLServer and right click hlds.exe then select Create Shortcut now right click that new Shortcut you just created and select Properties


New shortcut properties


Counter-Strike command line options
Below are a list of commands you can enter in the target field to start the server.

-console
Initializes console mode

-autoupdate
Automatically update the server when Steam updates are released

-game <game name>
The HLDS mod you want to run

+maxplayers <number of players>
Amount of players to allow

+map <map name>
The map to start the server with

-port <port number>
The port number the server should run on. Can be left out if you plan on using the default port (27015).

-ip <ipaddress>
Useful if you have multiple IPs and want to assign a particular IP to the server.

Example, you want to start the server with 12 players and the map de_aztec your target field should look like this:
Code:
"C:\Program Files\Valve\HLServer\hlds.exe" -console -game cstrike -autoupdate +maxplayers 12 +map de_aztec


Note the quotes around the path, they are required if the path contains a space.

After you've entered that in the target field, click OK then double click the shortcut icon and the server should now be starting up:


Adding cmds in target field and starting the server


Each time you want to start the server, all you do now is double click the Shortcut icon with the saved Target parameter.

You can also start the server without creating a shortcut: Click on Start, Run, then type cmd now in the DOS prompt window, type: Code:
cd C:\Program Files\Valve\HLServer


then type: Code:
hlds.exe -console -game cstrike -autoupdate +maxplayers 12 +map de_aztec


However, we recommend creating the shortcut so you do not have to type the commands each and every time you want start the server.
回复

使用道具 举报

 楼主| Leya 发表于 2008-4-29 21:46:57 | 显示全部楼层

Page 5. Linux: Install CS Source

Linux: Install CS Source (Page 5 of 7) by Sebastian · May 9th, 2005 ·
On this page we will explain how to install Counter-Strike and Counter-Strike: Source. We assume you have some Linux knowledge. We will start with Counter-Strike: Source first, If you want to install Counter-Strike 1.6 skip to Page 6 'Linux: Install CS 1.6'

Installing Counter-Strike: Source (SRCDS)
First, lets create a directory where we will run the hldsupdatetool, run the following command: Code:
mkdir srcds


Now we switch to the srcds we just created and download the hldsupdatetool.bin Code:


If all goes well you should now have the hldsupdatetool.bin in the srcds directory. Now we change the permission of hldsupdatetool.bin so we can execute it and extract the contents from hldsupdatetool.bin Code:
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin


Note: after you run ./hldsupdatetool.bin you will get a prompt to agree with the terms and conditions, simply type yes and hit enter.

If all goes well, you should now have two files in the srcds directory, the hldsupdatetool.bin which we downloaded earlier, and a steam file the hldsupdatetool generated, this is the file we will use to install Counter-Strike: Source.

Note: if you receive a 'uncompress: command not found' message it means your server does not have uncompress installed. You have two options to easily work around this, try the following while logged-in as root:
Code:
ln -s /bin/gunzip /bin/uncompress


Then try to run ./hldsupdatetool.bin again. If that does not work, or you do not have root privileges you can download the binary file we have available:
Code:



Now that you have the steam binary file, Type the following command to begin installing CS Source
Code:
chmod +x steam
./steam -command update -game "Counter-Strike Source" -dir .


Note the period after -dir

By now, the Counter-Strike Source install should have started:


SRCDS now installing

Install times will vary anywhere between 30-60 minutes depending on your server connection speed and how congested the Steam network is. Once setup has finished it will display a "HLDS installation up to date" message. Now we are ready to start the server.

Counter-Strike command line options
Below is a list of options you can use when starting up the server.

-console
Initializes console mode

-autoupdate
Automatically update the server when Steam updates are released

-game <game name>
The HLDS mod you want to run

+maxplayers <number of players>
Amount of players to allow

+map <map name>
The map to start the server with

-port <port number>
The port number the server should run on. Can be left out if you plan on using the default port (27015).

-ip <ipaddress>
Useful if you have multiple IPs and want to assign a particular IP to the server.

There are a couple of ways to start the server; for simplicity we will go the easy way. We want the server to run in the background, so we issue the following command:
Code:
./srcds_run -game cstrike -autoupdate +maxplayers 20 +map de_aztec > /dev/null 2>&1 &


If you are wondering what > /dev/null is; this will send no output, and the ending '&' will run the server in the background. This would be the most common way to start the server. Sometimes we like to see what is happening while the server is running, mostly for debugging purposes: Code:
./srcds_run -game cstrike -autoupdate +maxplayers 20 +map de_aztec > srcds.log 2>&1 &


The above will start the server, send all output (logging) to a file called srcds.log and run in the background. Everything the server generates will be sent to srcds.log, very useful if you want to see any errors that are happening while the server is running.

Note: if you choose to send output to a file, remember to periodically delete the file, it can grow quite large on an active server. Keep in mind this should be used mostly for debugging and not for a production server.
回复

使用道具 举报

 楼主| Leya 发表于 2008-4-29 21:48:29 | 显示全部楼层

Page 6. Linux: Install CS 1.6

Linux: Install CS 1.6 (Page 6 of 7) by Sebastian · May 9th, 2005 ·
On this page we will explain how to install Counter-Strike on Linux. We assume you have some Linux knowledge.

Installing Counter-Strike 1.6 (HLDS)
First, lets create a directory where we will run the hldsupdatetool, run the following command: Code:

mkdir hlds


Now we switch to the hlds we just created and download the hldsupdatetool.bin Code:


If all goes well you should now have the hldsupdatetool.bin in the srcds directory. Now we change the permission of hldsupdatetool.bin so we can execute it and extract the contents from hldsupdatetool.bin Code:
chmod +x hldsupdatetool.bin
./hldsupdatetool.bin


Note: after you run ./hldsupdatetool.bin you will get a prompt to agree with the terms and conditions, simply type yes and hit enter.

If all goes well, you should not have two files in the srcds directory, the hldsupdatetool.bin which we downloaded earlier, and a steam file the updatetool generated, this is the file we will use to install Counter-Strike: Source.

Note: if you receive a 'uncompress: command not found' message it means your server does not have uncompress installed. You have two options to easily work around this, try the following while logged-in as root:
Code:
ln -s /bin/gunzip /bin/uncompress


Then try to run ./hldsupdatetool.bin again. If that does not work, or you do not have root privileges you can download the binary file we have available:
Code:



Now that you have the steam binary file, Type the following command to begin installing CS 1.6
Code:
chmod +x steam
./steam -command update -game cstrike -dir .


Note the period after -dir

By now, the Counter-Strike 1.6 install should have started:


HLDS Install has started

Install times will vary anywhere between 15-30 minutes (~300MB) depending on your server connection speed and how congested the Steam network is. Once setup has finished it will display a "HLDS installation up to date" message. Now we are ready to start the server.

Counter-Strike command line options
Below is a list of options you can use when starting up the server.

-console
Initializes console mode

-autoupdate
Automatically update the server when Steam updates are released

-game <game name>
The HLDS mod you want to run

+maxplayers <number of players>
Amount of players to allow

+map <map name>
The map to start the server with

-port <port number>
The port number the server should run on. Can be left out if you plan on using the default port (27015).

-ip <ipaddress>
Useful if you have multiple IPs and want to assign a particular IP to the server.

There are a couple of ways to start the server; for simplicity we will start the server the easy way. We want the server to run in the background, so we issue the following command:
Code:
./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_aztec > /dev/null 2>&1 &


If you are wondering what > /dev/null is; this will send no output, and the ending '&' will run the server in the background. This would be the most common way to start the server. Sometimes we like to see what is happening while the server is running, mostly for debugging purposes: Code:
./hlds_run -game cstrike -autoupdate +maxplayers 20 +map de_aztec > hlds.log 2>&1 &


The above will start the server, send all output (logging) to a file called hlds.log and run in the background. Everything the server generates will be sent to hlds.log, very useful if you want to see any errors that are happening while the server is running.

Note: if you choose to send output to a file, remember to periodically delete the file, it can grow quite large on an active server. Keep in mind this should be used mostly for debugging and not for a production server.
回复

使用道具 举报

 楼主| Leya 发表于 2008-4-29 21:49:43 | 显示全部楼层

Page 7. Conclusion

Conclusion (Page 7 of 7) by Sebastian · May 9th, 2005 ·
We hope you've found this guide helpful and have learned how to create a Counter-Strike server with little effort. Starting up a server is just the beginning as there is many more things you can do to make your server an enjoyable gaming experience for you and those playing on it.

There are literally hundreds of addons, scripts and tools to customize your server to the next level. Have a look at our download section for all types of tools and addons for your server.

If you have any questions or need further help with your server, post in the forums where many are willing to give you a hand.

Remember, a server is only as good as you make it. Have fun!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注-册

本版积分规则

Archiver|手机版|小黑屋|DoDVip ( 桂ICP备14000730号 )

GMT+8, 2024-5-8 07:36 , Processed in 0.058107 second(s), 20 queries .

Powered by Discuz! X3.5

Copyright © 2001-2024 Tencent Cloud.

快速回复 返回顶部 返回列表