Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: preg_match(): Unknown modifier '-' in /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php on line 783

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794

Warning: Cannot modify header information - headers already sent by (output started at /home/akl1986/public_html/support/wp-content/plugins/redux-framework/redux-core/inc/extensions/metaboxes/class-redux-extension-metaboxes.php:783) in /home/akl1986/public_html/support/wp-includes/rest-api/class-wp-rest-server.php on line 1794
{"id":2325,"date":"2019-11-26T07:56:14","date_gmt":"2019-11-26T07:56:14","guid":{"rendered":"https:\/\/support.aklwebhost.com\/?post_type=manual_kb&p=2325"},"modified":"2019-12-06T00:09:21","modified_gmt":"2019-12-06T00:09:21","slug":"setup-a-counter-strike-global-offensive-csgo-server-on-arch-linux","status":"publish","type":"manual_kb","link":"https:\/\/support.aklwebhost.com\/knowledgebase\/setup-a-counter-strike-global-offensive-csgo-server-on-arch-linux\/","title":{"rendered":"Setup a Counter-Strike: Global Offensive (CSGO) Server on Arch Linux"},"content":{"rendered":"

This tutorial explains how to setup a\u00a0Counter-Strike: Global Offensive server<\/strong>\u00a0on Arch Linux.<\/p>\n

This tutorial assumes that you logged in with a standard user account and have sudo privileges. We will be using a normal user account because building packages with AUR should not be done from the root account.<\/p>\n

Before You Begin<\/strong><\/h3>\n

If you are using a 64-bit version of Arch Linux, it is very important that you have the\u00a0multilib<\/code>\u00a0repository enabled. If it is not enabled, SteamCMD cannot download or run the game server files. To enable multilib, simply uncomment the following lines in\u00a0\/etc\/pacman.conf<\/code>.<\/p>\n

[multilib]\r\nInclude = \/etc\/pacman.d\/mirrorlist\r\n<\/code><\/pre>\n

This does not apply to 32-bit Arch Linux systems.<\/p>\n

Install SteamCMD<\/strong><\/h3>\n

There is an AUR package for SteamCMD. It is possibly the easiest way to install SteamCMD on Arch. There are a few things to note about it though:<\/p>\n

    \n
  • All relative paths are relative to\u00a0\/usr\/share\/steamcmd<\/code>.<\/li>\n
  • To upgrade SteamCMD itself, you must be on the root account.<\/li>\n<\/ul>\n

    If you are on a 64-bit server, you must install the package\u00a0lib32-gcc-libs<\/code>.<\/p>\n

    sudo pacman -Sy lib32-gcc-libs\r\n<\/code><\/pre>\n

    Now we must build the package. Using curl, download the tarball for the package.<\/p>\n

    curl -O https:\/\/aur.archlinux.org\/packages\/st\/steamcmd\/steamcmd.tar.gz\r\n<\/code><\/pre>\n

    Once the download finishes, extract and change to the directory created.<\/p>\n

    tar -xvzf steamcmd.tar.gz\r\ncd steamcmd\r\n<\/code><\/pre>\n

    Now, using makepkg, build the package.<\/p>\n

    makepkg -ci\r\n<\/code><\/pre>\n

    If you didn’t pass the\u00a0-i<\/code>\u00a0flag to the makepkg command, then use the following command to install it.<\/p>\n

    sudo pacman -U *.pkg.tar.xz\r\n<\/code><\/pre>\n

    You now have SteamCMD installed and ready to download Counter-Strike: Global Offensive server.<\/p>\n

    Install The Counter-Strike: Global Offensive Server<\/strong><\/h3>\n

    This guide uses a separate user to run the server, so we will create a new csgo user and group with it’s own home folder in\u00a0\/var\/lib<\/code>.<\/p>\n

    sudo groupadd csgo\r\nsudo mkdir \/var\/lib\/csgo\r\nsudo useradd -d \/var\/lib\/csgo -g csgo -s \/bin\/bash csgo\r\nsudo chown csgo.csgo -R \/var\/lib\/csgo\r\n<\/code><\/pre>\n

    Now to install the server.<\/p>\n

    sudo -u csgo steamcmd +login anonymous +force_install_dir ~csgo\/server +app_update 740 validate +quit\r\n<\/code><\/pre>\n

    Once that finishes downloading, you have the server installed.<\/p>\n

    Configuring<\/strong><\/h3>\n

    Although you can run the server, some configuration should be done so that the server isn’t too generic. The main file that we put settings in is the\u00a0server.cfg<\/code>\u00a0file. Below is a very basic\u00a0server.cfg<\/code>\u00a0file.<\/p>\n

    To open\/create the file, use your favorite editor. I use vim in this example.<\/p>\n

    sudo -u csgo vim ~csgo\/server\/csgo\/cfg\/server.cfg\r\n<\/code><\/pre>\n

    Add the following. More settings can be found on the Valve Developer Wiki. Be sure to change some of the settings to suit your needs.<\/p>\n

    hostname \"Server Name\"\r\nrcon_password \"password\"\r\nsv_password \"\"\r\nsv_contact \"email@example.com\"\r\nsv_tags \"\"\r\nsv_region \"255\"\r\nsv_lan \"0\"\r\n\r\nexec banned_user.cfg\r\nexec banned_ip.cfg\r\nwriteid\r\nwriteip\r\n<\/code><\/pre>\n

    Running Your Server<\/strong><\/h3>\n

    To run your server unattended, you will need a multiplexer like\u00a0GNU Screen<\/em>\u00a0or\u00a0tmux<\/em>. In this article, I am going to use\u00a0tmux<\/em>\u00a0to run the server, but if you prefer and know how to use screen, feel free to use it.<\/p>\n

    Install tmux by using pacman.<\/p>\n

    sudo pacman -Sy tmux\r\n<\/code><\/pre>\n

    You can start the server with the following command. You can change the map if desired. Please read the “Final Notes” for more information on the\u00a0game_type<\/code>\u00a0and\u00a0game_mode<\/code>\u00a0values. This example is for a classic casual server.<\/p>\n

    sudo -u csgo tmux new-session -d -s csgo-console -d 'cd \/var\/lib\/csgo\/server\/; .\/srcds_run -console -game csgo -usercon +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2'\r\n<\/code><\/pre>\n

    If you ever need to attach to the console, run the following.<\/p>\n

    sudo -u csgo tmux attach -t csgo-console\r\n<\/code><\/pre>\n

    You can leave the server console by typing\u00a0CTRL + B<\/strong>\u00a0then releasing those keys and then pressing\u00a0D<\/strong>.<\/p>\n

    Running With systemd<\/strong><\/h3>\n

    Running the server with systemd is convenient for many reasons. The main one is that you can have it start when the VPS starts. This requires a script and a systemd unit to be written. Even though this is a good idea,\u00a0it is optional<\/em>.<\/p>\n

    The first thing to write is the start script. To create the script, use your favorite editor. Here vim is used, but you can use any text editor like nano.<\/p>\n

    sudo -u csgo vim ~csgo\/server\/csgo.sh\r\n<\/code><\/pre>\n

    Add the following and be sure to look at the line with the start command as it has the game mode and type.<\/p>\n

    #!\/bin\/sh\r\n\r\nUSER=$2\r\n\r\nif [ -z $2 ]; then\r\n  USER=\"csgo\"\r\nfi\r\n\r\ncase \"$1\" in\r\n  start)\r\n    sudo -u $ tmux new-session -d -s csgo-console -d 'cd \/var\/lib\/csgo\/server\/; \/var\/lib\/csgo\/server\/srcds_run -console -game csgo -usercon +game_type 0 +game_mode 0 +mapgroup mg_active +map de_dust2'\r\n    ;;\r\n\r\n  stop)\r\n    sudo -u $ tmux send-keys -t csgo-console 'say Server shutting down in 10 seconds!' C-m\r\n    sleep 10\r\n    sudo -u $ tmux send-keys -t csgo-console 'quit' C-m\r\n    sleep 5\r\n    ;;\r\n\r\n  *)\r\n    echo \"Usage: $0  user\"\r\nesac\r\n\r\nexit 0\r\n<\/code><\/pre>\n

    Now you need to make the systemd unit.<\/p>\n

    sudo vim \/usr\/lib\/systemd\/system\/csgo.service\r\n<\/code><\/pre>\n

    Add the following.<\/p>\n

    [Unit]\r\nDescription=Counter-Strike: Global Offensive Server (SRCDS)\r\nAfter=local-fs.target network.target\r\n\r\n[Service]\r\nExecStart=\/var\/lib\/csgo\/server\/csgo.sh start\r\nExecStop=\/var\/lib\/csgo\/server\/csgo.sh stop\r\nType=forking\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n<\/code><\/pre>\n

    Now make sure the\u00a0csgo.sh<\/code>\u00a0file is executable.<\/p>\n

    sudo chmod +x ~csgo\/server\/csgo.sh\r\n<\/code><\/pre>\n

    After all that, you can use\u00a0systemctl<\/code>\u00a0to start and stop the server. Also you can use it to make it start on boot.<\/p>\n

    To start:<\/p>\n

    sudo systemctl start csgo.service\r\n<\/code><\/pre>\n

    To stop:<\/p>\n

    sudo systemctl stop csgo.service\r\n<\/code><\/pre>\n

    To restart:<\/p>\n

    sudo systemctl restart csgo.service\r\n<\/code><\/pre>\n

    To enable at boot:<\/p>\n

    sudo systemctl enable csgo.service\r\n<\/code><\/pre>\n

    To disable at boot:<\/p>\n

    sudo systemctl disable csgo.service\r\n<\/code><\/pre>\n

    Even though systemd handles starting and stopping the server, you can access the console with the following command.<\/p>\n

    sudo -u csgo tmux attach -t csgo-console\r\n<\/code><\/pre>\n

    Final Notes<\/strong><\/h3>\n

    SteamCMD is installed in an area where only root can change files (see note in the “Install SteamCMD” section). If you ever need to upgrade SteamCMD itself, just run it as root.<\/p>\n

    sudo steamcmd +quit\r\n<\/code><\/pre>\n

    If you need to update the server. First stop the server and then use SteamCMD to update (using the same command to install).<\/p>\n

    sudo systemctl stop csgo.service\r\nsudo -u csgo steamcmd +login anonymous +force_install_dir ~csgo\/server +app_update 740 validate +quit\r\nsudo systemctl start csgo.service\r\n<\/code><\/pre>\n

    The game mode and game type in the starting command are important depending on what kind of server you want. Here’s a quick table of the possible values.<\/p>\n

          Game Mode      | game_type | game_mode\r\nClassic Casual       | 0         | 0\r\nClassic Competitive  | 0         | 1\r\nArms Race            | 1         | 0\r\nDemolition           | 1         | 1\r\nDeathmatch           | 1         | 2\r\n<\/code><\/pre>\n

    There are a lot more configuration topics not covered in this tutorial. If you need more information, please refer to the Valve Developer Wiki.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","format":"standard","manualknowledgebasecat":[105,242],"manual_kb_tag":[217],"_links":{"self":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2325"}],"collection":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/comments?post=2325"}],"version-history":[{"count":1,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2325\/revisions"}],"predecessor-version":[{"id":2326,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb\/2325\/revisions\/2326"}],"wp:attachment":[{"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/media?parent=2325"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manualknowledgebasecat?post=2325"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/support.aklwebhost.com\/wp-json\/wp\/v2\/manual_kb_tag?post=2325"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}