[CURRENT VERSIONS] Linux Dedicated Server Setup Guide

edited October 2013 in Servers
Foreword
PVKII got released on Steam with version 2.3, but the existing server tutorial is still referring to the old version, where you had to install the PVKII files manually. So here's an updated instruction on how to install a PVKII Linux Dedicated Server. This tutorial will guide you through the whole installation process, which starts right after you bought your root/virtual server. You don't need any linux knowledge to get your server up and running. I'll mostly use text to explain, but insert links with images on certain parts - in case you get confused.

Requirements
In this tutorial we'll use PuTTY and WinSCP. I'd highly recommend to download both programms.

Getting Started
After you bought a server, you should receive your server's IP (e.g. 69.45.67.201) and the "root" login details (e.g. login: root; password: example) from your provider.
  • Start "PuTTY", type in your server's IP adress and click on "Open" to connect to your server. (Image)
  • Login as "root" and press Enter. (Image)
  • The server will ask you for a passwort. Type in the passwort your provider sent you and confirm with Enter again. Don't worry, you can't see what you typed, not even "*****". Linux doesn't show anything! (Image)
  • If you did everything correctly, you're logged in as "root". You should see some general information and a command line for your user. (Image)

Adding a user in Linux
Since it's highly unsecure to run your server as the "root" user, we should now move on and add a new user on your server. The user will be named "pvkii" in this tutorial, but you can choose any username you desire. If you choose a different username, please edit the commands in the quotes to fit your username (e.g. the "pvkii" part). Furthermore, I'll use the the beginner-friendly "adduser" command to add a user. This command may not be available in your Linux distribution. If your server doesn't recognize the command, jump to Method 2: "useradd" .


Method 1: "adduser" (Recommended)

adduser pvkii


Press "Enter", choose a password for your user and follow the automatic creation process. You don't have to fill in all the details it'll ask you for. Use "Enter" to skip them.


Method 2: "useradd"

useradd -d /home/pvkii/ pvkii


Press "Enter" and it'll add the user.

passwd pvkii


Press "Enter", choose a password for your new user and you're done.

Logging in as your new user
That's easy now. You already know how to login as "root".
  • Leave the current PuTTy window open, start another "PuTTY", put in your server's IP and connect.
  • Login as "pvkii" and enter the password you set for your new user.
  • You should now be logged in as "pvkii" and able to enter commands.

Installing the PVKII server

Note: This part is outdated. hldsupdatetool was replaced by SteamCMD in a recent update. See https://developer.valvesoftware.com/wiki/SteamCMD for SteamCMD installation and usage details.


Make sure you're in the new user's home directoy.

cd /home/pvkii/


Download the "hldsupdatetool" into your current directory.

wget http://www.steampowered.com/download/hldsupdatetool.bin


Make the "hldsupdatetool" executable.

chmod +x hldsupdatetool.bin


Run "hldsupdatetool" and follow the instructions.

./hldsupdatetool.bin


Run "steam".

./steam


Note: The "./steam" command could take a while. As soon as it's finished, you'll be presented with the command line to insert commands again. Press "Arrow Up" on your keyboard and then hit "Enter" to run the "./steam" command again. You need to repeat this step two or three times to make sure Steam is fully updated.

As soon as Steam has updated itself, let it download the PVKII files into the current directory.

./steam -command update -game "pvkii" -dir .


Note: Steam will now start to download the necessary serverfiles. This should usually take a while - ofcourse depending on your server's connection speed. Don't close the PuTTY window!

Comments

  • edited January 2012
    Installing "Screen" for Linux
    In Linux, I'd recommend you to run your server in a so called "screen". You can start a screen, then start your server in it and detach it afterwards, so it'll run in the background. If you don't run it in a screen or don't detach that screen, your server will simply go offline as soon as you close the PuTTY window.

    Go back to your first PuTTY window, where you should still be logged in as "root". If the sessions got closed (e.g. "connection timeout"), start a new "PuTTY" and login as "root" again.

    Update your Linux package list.

    apt-get update
    


    Update your Linux packages.


    apt-get upgrade
    


    Install "Screen" by typing the command and following the instructions.


    apt-get install screen
    


    Starting your PVKII server
    Go back to the other PuTTY window with the user "pvkii", since we don't want to start the server with the "root" user. We only used the "root" user to install our "screen" package. You should still be in the home directory of your "pvkii" user - we need to change that.

    Move to the directory that contains the "srcds_run".



    cd /home/pvkii/orangebox/
    


    Make "srcds_run" executable.


    chmod +x srcds_run
    


    Start a screen session, name it, execute "srcds_run" with the parameters you like and detach it in one single command. Our example would start a PVKII server in a screen named "pvkiiserver" with the map "bt_island" and 24 slots. For more parameters you can add, click here.


    screen -dmS pvkiiserver ./srcds_run -game pvkii -autoupdate +maxplayers 24 +map bt_island
    


    You can always attach this screen to see the gameserver console.


    screen -x pvkiiserver
    


    Don't forget to always detach it afterwards or your server will go offline after you close the PuTTY window!


    Ctrl+A+D
    


    To close your server, I'd recommend you to kill the whole screen. To do so, you need to attach it as I explained above and then kill it.


    Ctrl+A+K
    


    Configuring your PVKII server
    You could edit all the config files via PuTTY, but I wouldn't recommend it. It's pretty nasty. Instead, start "WinSCP", which I mentioned earlier.
    • Start "WinSCP", type in your server's IP, choose your new user ("pvkii") as username and enter his password. Choose "SFTP" for the file protocol - else you'll receive an error - and click on "Login". (Image)
    • You should now be in the home directory of your user. Click on "orangebox" to move to that folder and you'll see the "pvkii" folder. Click on it and inside search for a folder named "cfg". This folder contains the file "server.cfg".
    • Click "Right mouse" and then "Edit" to open the "server.cfg". Customize it to fit your needs, save by clicking on the floppy disk icon or simply by pressing "Ctrl +S" and close it.
    • You're done. You can now start your server or restart it to apply your changes, if you already started it. See Starting your PVKII server for that.

    Installing "SourceMod" for server administration (optional)

    • First install "Metamod:Source by following the instructions mentioned here.
    • Then install "SourceMod" itself by following it's install instructions.

    If you don't manage to install it properly or don't want to deal with it, go with this package. I pre-installed Metamod:Source 1.8.7 together with SourceMod 1.4.1. Simply download the package, extract it and then upload the folders "addons" and "cfg" via SFTP to "/home/pvkii/ (You always start here) -> /orangebox/pvkii/". How to get there? I explained it in the Configuring your PVKII server passage. It's the same folder that also contained the "cfg" folder.

    Adding yourself as an admin to "SourceMod" (optional)
    You should always refer to the Configuring your PVKII server passage for help on how to edit files with "WinSCP" via FTP/SFTP.

    To add yourself as an admin, simply connect via SFTP as mentioned before and go to "/home/pvkii/orangebox/pvkii/addons/sourcemod/configs/" and open the file "admins_simple.ini".


    //
    // READ THIS CAREFULLY! SEE BOTTOM FOR EXAMPLES
    //
    // For each admin, you need three settings:
    //  "identity"		"permissions"		"password"
    //
    // For the Identity, you can use a SteamID or Name.  To use an IP address, prepend a ! character.
    // For the Permissions, you can use a flag string and an optional password.
    //
    // PERMISSIONS:
    //  Flag definitions are in "admin_levels.cfg"
    //  You can combine flags into a string like this:
    //  "abcdefgh"
    //
    //  If you want to specify a group instead of a flag, use an @ symbol.  Example:
    //  "@Full Admins"
    //
    //	You can also specify immunity values.  Two examples:
    //	"83:abcdefgh"			//Immunity is 83, flags are abcdefgh
    //	"6:@Full Admins"		//Immunity is 6, group is "Full Admins"
    //
    //	Immunity values can be any number.  An admin cannot target an admin with
    //	a higher access value (see sm_immunity_mode to tweak the rules).  Default
    //  immunity value is 0 (no immunity).
    //
    // PASSWORDS:
    //  Passwords are generally not needed unless you have name-based authentication.
    //  In this case, admins must type this in their console:
    //
    //   setinfo "KEY" "PASSWORD"
    //
    //  Where KEY is the "PassInfoVar" setting in your core.cfg file, and "PASSWORD"
    //  is their password.  With name based authentication, this must be done before
    //  changing names or connecting.  Otherwise, SourceMod will automatically detect
    //  the password being set.
    //
    ////////////////////////////////
    // Examples: (do not put // in front of real lines, as // means 'comment')
    //
    //   "STEAM_0:1:16"		"bce"						//generic, kick, unban for this steam ID, no immunity
    //   "!127.0.0.1"		"99:z"				//all permissions for this ip, immunity value is 99
    //   "BAILOPAN"			"abc"	"Gab3n"		//name BAILOPAN, password "Gab3n": gets reservation, generic, kick
    //
    ////////////////////////////////
    
    "YOURSTEAMID" "z"
    


    All you need to modify and copy/paste into that file is marked green. For yourself, I'd suggest to keep "z" as the flag, since it will grant you all admin rights. After you made the changes, save the file. Now you have to restart your server. If you don't know how to do that, read Starting your PVKII server again.



    - Enzo
  • gheedgheed Banned
    edited December 2011
    How could anybody dislike you? This deserves a sticky.
    Good day to you partner! I'm Gheed and I can already tell that I'll be your best friend in this forsaken camp. A spare weapon, some gold, a small gem is all I want in exchange for the equipment you'll need on whatever quests you might undertake. Now, now, now... Don't be shy, all of my items are guaranteed for life and come with a two-day warranty!

    10975376-cupid420-banner.jpg

    {R} | 24/7 Arena/Cathedral [HLStatsX|Chicago]: 69.28.220.10:27015 * Gentlemen's Club [Island|24/7|Mature|HLStatsX|NYC]: 69.90.34.171:27015 * Slammin Butt Pirates CUSTOM|FASTDL: 216.6.224.138:27015 * iG | Trinket Wars [EU]: 84.246.125.35:27900
  • edited December 2011
    The old one was horribly outdated and some people would actually download old files and manually install them. This new one is up-to-date and covers everything: Configuring linux, installing the gameserver and adding a basic mod for administration (sourcemod).

    (And the old one had a "http://www.afterbuy.co.uk/" link at the end - dislike, me boyo. icon_yarrpirate.gif )
  • TheKloownerTheKloowner Senior
    edited 4:11PM
    Nice
    Steam: ҳ̸ҳ נσкer ̸Ҳ̸ҳ
Sign In or Register to comment.