Results 1 to 2 of 2

Thread: Webmin Game Control Panel Guide

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    g0d! Contributing Member siosios's Avatar
    Join Date
    Oct 2006
    Location
    In a cardboard box
    Age
    51
    HlStats

    HLStatsX Ranking for STEAM_0:1:13488560
    Posts
    13.569
    Blog Entries
    12
    Rep Power
    10

    Default Webmin Game Control Panel Guide

    Introduction
    So you need a handy web based control panel to manage your games but you don't agree with the ridiculous prices of some of the existing game control panels, this guide will help you to create your own game control panel using a few shell scripts and the free webmin software.

    This guide assumes that you already have webmin installed and that you have a basic knowledge of linux and game servers. If you already have your game(s) installed, the first step may not apply to you.

    This guide uses Counter-Strike 1.6 as an example of the game we are setting up, but this guide can be used for all steam games by simply changing things such as the -game parameter or using srcds instead of hlds for source games.

    I hope to hear feedback from you guys that use this guide, either on the steam powered forums or by email. However, I do not want to hear any complaints about my spelling/grammar or knowledge of linux - I have written this guide in my spare time as a request from the steam powered forums and I understand that there are many ways of doing things with linux / game servers and this is the way that I chose, if you do not like it then write your own guide.

    If anyone has any bugs/errors to report then please use the contact information at the top left of the page.

    Good luck with you game control panel

    funkdoC'

    Setting up your game server
    To start we will setup a new user for the game server. It is not advisable to run your game process using the root account. Gain root access using su - and type your root password.

    su -
    Password:

    Now that you are logged in as root create a new user.

    useradd -d /home/mygame01 -p mypass mygame01

    Replace mygame01 with a username that you choose and replace mypass with a password of your choice.
    Now su into the user that you have created and move into their home directory that you have just created.

    su mygame01
    cd ~

    We will now download steam for linux and extract the binary and mark it as executable

    wget http://www.dphost.info/wcp/steam.tar.gz
    tar -xzvf steam.tar.gz
    chmod +x steam
    rm steam.tar.gz

    Sometimes it is necessary to update steam before creating a new account. We will do this now by running the steam executable.

    ./steam

    Once steam has updated we will need to create a new steam account. Replace the settings such as username, email etc with your own.
    Note: this account is not the same account that you use to play steam games, this is an account for running steam dedicated servers.

    ./steam -command create -username <myusername> -email <myemail> -password <mypassword> -question "<my question>" -answer -"<myanswer>"

    We will now create a script to update the game server and download required files. Use the settings from your steam account that you just created in this update script. Create a new file using nano or pico called update.sh or choose your own name. Insert this into the new file.

    #!/bin/sh
    ./steam -command update -game cstrike -dir /home/mygame01 -username <myusername> -password <mypassword> -remember_password

    Make sure that the steam command is all contained on the same line and has not wrapped onto a new line. Save the file and chmod it so its executable. The game is of your choice I am using cstrike (Counter-Strike 1.6) here as an example.

    chmod +x update.sh

    We will now run the update script. This will download the necessary files that we need to run our game. This process will take a long time depending on which content server steams selects and the speed of your internet connection.

    ./update

    Once all the files have downloaded and you are back at the command line we will launch a simple test server to make sure everything is working. This command will setup a simple test server.

    ./hlds_run -game cstrike +map de_dust2

    This will start a basic cs.16 server, join the server or add the server to HLSW so that you can see if the server is working. You may need to open some ports on your firewall, the default port for cs1.6 is 27015. When you have tested your server you may close it using control + c to return to the command line.

    Next we will create a script to start/restart the server. Create a new file called start.sh using nano or pico, we will again use the settings from the steam account that you have created. Insert this into the new file.

    #!/bin/sh
    screen -r mygame01 -X quit
    screen -dmS mygame01 ./hlds_run -game cstrike +ip <yourip> +port <yourport> +maxplayers 12 +exec server.cfg +map de_dust2
    echo Your server has been restarted.

    Make sure that the screen command is all on the same line. Save the file and chmod it so that it is executable. Again this is an example for a cs1.6 server.

    chmod +x start.sh

    We will also need a script to stop the server incase it needs updating. Create a new file called stop.sh using pico or nano. Insert this into the new file.

    #!/bin/sh
    screen -r mygame01 -X quit
    echo server has been stopped

    Save the file and chmod the file that so its executable.

    Now that all the scripts are in place its time to setup webmin, if webmin is not already started then start it now then you can exit the shell.

    Setting up webmin
    Open up your webmin using your web browser, usually http://xxx.xxx.xxx.xxx:10000 - replace xxx with your ip/domain. Login to webmin as the admin with your root password.

    We will now create custom commands for webmin that will allow users to control their server. The commands we will be creating will let users start/restart/stop/update their server, they will be able to edit certain files such as server.cfg/motd.txt/mapcycle.txt .

    To start we will create the commands to control the server.

    Inside webmin click the tab 'Others', then click on the icon titled 'Custom Commands'.

    This command will start/restart the server.
    Click on Create a new custom command and enter these settings.
    Description: Start/Restart your server.
    Command: ./start.sh
    Run in directory: /home/mygame01 (select the radio button next to the place to insert directory)
    Run as user: mygame01 (select the radio button next to the place to insert username)
    Tick use user's environment
    Command outputs HTML: Yes
    Hide commands while executing: Yes
    Then you may click Save.

    This command will stop the server.
    Click on Create a new custom command and enter these settings.
    Description: Stop your server.
    Command: ./stop.sh
    Run in directory: /home/mygame01 (select the radio button next to the place to insert directory)
    Run as user: mygame01 (select the radio button next to the place to insert username)
    Tick use user's environment
    Command outputs HTML: Yes
    Hide commands while executing: Yes
    Then you may click Save.

    This command will update the server.
    Click on Create a new custom command and enter these settings.
    Description: Stop your server.
    Command: ./update.sh
    Run in directory: /home/mygame01 (select the radio button next to the place to insert directory)
    Run as user: mygame01 (select the radio button next to the place to insert username)
    Tick use user's environment
    Command outputs HTML: Yes
    Hide commands while executing: Yes
    Then you may click Save.

    Now we will create commands to handle editing of some text files.

    This command will edit the server.cfg.
    Click on Create a new file editor and enter these settings.
    Description: Edit your server.cfg.
    File to edit: /home/mygame01/cstrike/server.cfg
    Then you may click Save.

    This command will edit the motd.txt.
    Click on Create a new file editor and enter these settings.
    Description: Edit your motd.txt.
    File to edit: /home/mygame01/cstrike/motd.txt
    Then you may click Save.

    This command will edit the mapcycle.txt.
    Click on Create a new file editor and enter these settings.
    Description: Edit your mapcycle.txt.
    File to edit: /home/mygame01/cstrike/mapcycle.txt
    Then you may click Save.

    Now we will create a webmin module based on the commands that we just created.

    Click on the webmin tab, then click on the 'webmin configuration' icon, then click on 'edit categories'. Create a new category by typing in an ID and a description such as
    ID: gameservers
    Description: Game Servers
    Then click on save categories.

    Return to webmin configuration and then click on 'Webmin Modules'. In the section called 'Clone Modules' select 'Custom Commands' as the module to clone, enter a module name such as My CS1.6 Game Server and assign the cloned module to the Game Servers category that you have just created. Then click on the Clone Module button.

    Now we will create a new webmin user and assign the module to them (webmin users are not the same as shell users).

    Click on the webmin tab, then click on 'Webmin Users' then click on 'Create a new webmin user'. Enter a username and assign a password then scroll down through the modules and tick the module that we have just created/cloned, then press save.
    Back at the webmin users page next to the user you have just created click on the game server module that you have just assigned them and change these options.

    Can edit module configuration?: No
    Can create and edit commands?: No

    Then press save.

    Now you may login as the user that you have created and start your server!

    If anyone has any troubles with this guide or has any errors/bugs to report please use the contact information at the top of the page.

    Frequently Asked Questions
    Why did you write this guide?
    Some members of the steam powered forums were asking about game control panels which were not $200+ in licensing fees, someone recommended webmin but has yet to inform everyone else how they have set theirs up, therefore i offered to write a guide in doing so.

    But why? I mean no one does anything for free these days!
    Kinda true, but I hope that some of you guys that have used this guide will show some appreciation by donating a few dollars/pounds into my paypal account.

    Why has it taken you so long! You said it would be ready X days ago?
    Well I do have a life outside of installing game servers, I have been adding little bits to this guide over a couple of weeks and aint had much chance to sit down and write it all at once.

    Can I mirror this guide on my site?
    Sure, but please keep it intact with my contact and donation information.

    Will this work for windows?
    I don't know, nor do I care if it does this is a guide for setting up webmin as a game control panel on linux.

    Can I use this control panel in my game server company?
    Feel free, BUT I would not recommend it as there are many security issues that would need to be taken care of first. I only this webmin control panel to manage the game servers that my clan uses.

    Your command X is wrong and only noobs use linux like that!
    Don't care, I am a noob and have taught myself most of this stuff by trial and error. Please remember that this is a guide, not a personalized tutorial for your exact system/distribution - there are many ways of creating a control panel like this and im sure you have your own methods of doing things in linux.

    Are you going to add anymore to this tutorial?
    Well, that depends on the feedback that I receive. The webmin game control panel that im using for my clan currently has modules for game servers, ventrilo, teamspeak, ftp users and a file manager for uploading custom content. If I receive some positive feedback and maybe a donation or two, I will write guide for those also.

    Can I use this control panel for X game?
    I have used my control panel for cs1.6, cs: source, hl2dm, jedi knight 2/3, soldier of fortune 2 and quake 3 - so im sure that if you create scripts for your game webmin will be able to access them.
    ------------------------------------------------

    |W0rd|SexualTurtletara420ת/ύ: Hey there daddy..

    ------------------------------------------------
    \\\ ///
    ( @ @ )
    .....o00o.(_).o00o.....


    ------------------------------------------

  2. #2
    g0d! Contributing Member siosios's Avatar
    Join Date
    Oct 2006
    Location
    In a cardboard box
    Age
    51
    HlStats

    HLStatsX Ranking for STEAM_0:1:13488560
    Posts
    13.569
    Blog Entries
    12
    Rep Power
    10

    Default

    Webmin Modular HLDS/SRCDS/TS Server Control Tutorial

    This tutorial walks you through how to use webmin to control most aspects of a HLDS, SRCDS or TS server running on that box.
    First login to webmin.
    - Go to “Webmin Configuration”
    - Go to “Edit Categories”
    - Down the table there is a section to add your own custom Webmin Section, in the ID box put something like “Game_Servers”
    - In the “Displayed Description” box, put something (what you put in there is what will be displayed below the icon in webmin) Ex. “Control Game/VoiP servers”
    - Save
    Next you want to go to:
    - Other Section
    - Custom Commands Module
    Creation of custom command/file edits now:
    - Click on “Create a new custom command”
    - In the “description” box, put something like “Start Server”
    - The box below is optional, but its good to put something in there for some type of explination. Ex.
    Hit this button to start the Server
    - In the “command” box, put “sh start.sh”, this is what command is executed when you hit the button
    - In the “Run in Directory” put the location of the server, like /home/*user*/
    - “Run as User”, you HAVE TO put the shell account user name in that box, or else it will exec the server as root and mess everything up.
    - Leave everything else alone except the “Maximum time to wait for command?”, click the dot next to the box and put “30″ in there, for 30 seconds. Almost all commands you want to do this, this will cut off a command if it takes longer than 30 sec, instead of hanging up your browser and causing the process to crash and not finish.
    - Hit Save
    Repeat for, start/stop,restart commands
    Stop
    Hit this button to shutdown the server. You must hit the “Start Server” button to start server back up
    Restart
    Hit this button to restart the server. This kills the screen and execs the start script
    Next is to setup a screen command. Do the same thing as the above examples except now:
    - In the “command” line, put “screen -wipe” exactly
    - Make sure the user and directory is correct, then save
    Clear any dead screens and view if a server is running. If there is multiple screens “detached”, then you must kill all screens via the “system”, “running processes” section. Then hit “Start” button for this server
    Next is to create a new file editor:
    - Hit “Create a new file editor”
    - Now you want to create file edits for configs, first the start/stop/restart scripts
    - In the “Description” box put:
    Edit StartServer Script (server.sh)
    - In the box below put something like:
    If you wish to edit the startup parameters such as slot size and tickrate
    - Then type out the location of the file, ex. /home/*user*/server.sh
    Example Start.sh code:
    echo �Starting Server�
    echo �cd ..�
    echo �cd ..�
    echo �cd /home/*user*/�
    echo �sh start.sh�
    screen -A -m -d -S servername /home/*user*/srcds_run -console -cstrike +map de_dust2 +maxplayers 26 -autoupdate -IP xxx.xxx.xxx.xxx -port 27015 +fps_max 200 -tickrate 66
    echo �Server Starting��
    echo �Parameters srcds_run -console -cstrike +map de_dust2 +maxplayers 26 -autoupdate -IP xxx.xxx.xxx.xxx -port 27015 +fps_max 200 -tickrate 66 ?
    echo ��Server Started�
    - Save and repeat for Stop:
    echo �Stopping Server��
    screen -dr servername -X quit
    echo � �
    echo ��Server Stopped�
    - Restart:
    echo �Restarting Server��
    echo �screen -dr servername -X quit�
    screen -dr servername -X quit
    echo �Server Stop successful��
    echo �cd ..�
    echo �cd ..�
    echo �cd ..�
    echo �cd /home/*user*/�
    cd ..
    cd ..
    cd ..
    cd ./home/*user*/
    sh server.sh
    echo �sh server.sh�
    echo ��Server Restart Successful�
    Next is to do your update server command:
    - Create a custom command
    - Same settings but, in the 2nd description box put something like
    Server Must be stopped to continue…
    Hit this button to update the server, it may take several minutes, do not leave or refresh the page until it is complete.
    - Then put your install argument, ex.
    ./steam -command update -game “counter-strike source” -dir /home/*user*/
    - This time, the “maximum time to wait for command?”, leave it at infinte.
    Continue on for any config files you have, creating text editors for each, either cfg’s or txt’s or cfg.old it will edit the file. Thats how I keep track of 10 game servers and 3 TS servers, is through Webmin Custom Modules.
    Once you finish your “master” custom module, of which you can duplicate many times for multiple servers go to:
    - Webmin section
    - “Webmin Configuration” module
    - “Webmin Modules” module
    - You want to “clone module”
    - Select “custom commands” as the “module to clone”
    - Type in the module name you want (ex. awp server) under “cloned module name”
    - In the “assign to category”, select your custom category you made, then “Game/VioP server Control”
    - Hit “Clone Module”
    Once that is done, you can create a webmin user account, then add that custom module you just created and your ready to go. If you want to give someone almost complete control of a server without FTP or SSH access, you can.
    Via the “File manager” in “read only mode” to the specific game directory
    Via the “Running Processes” and able to only see and kill thier own processes
    Via the “Upload and Download” and only able to see and upload/download files to their own server directory.
    This can give someone the same control as FTP or SSH (just a bit slower if you want to upload a lot of files). But this is the way to do it without FTP or SSH access.
    ------------------------------------------------

    |W0rd|SexualTurtletara420ת/ύ: Hey there daddy..

    ------------------------------------------------
    \\\ ///
    ( @ @ )
    .....o00o.(_).o00o.....


    ------------------------------------------

Thread Information

Users Browsing this Thread

There are currently 2 users browsing this thread. (0 members and 2 guests)

Similar Threads

  1. L4D Dedicated server guide
    By siosios in forum Server Tech Talk
    Replies: 0
    Last Post: 03-15-2009, 07:51 PM
  2. A beginners guide to mapping: Part 1
    By siosios in forum FPS Tutorials
    Replies: 0
    Last Post: 03-14-2009, 06:32 PM
  3. FPS Guide (New Stuff)
    By siosios in forum Server Tech Talk
    Replies: 0
    Last Post: 12-08-2008, 06:25 PM
  4. Due to issues beyond our control.....
    By siosios in forum N00B Unlimited General Chat
    Replies: 57
    Last Post: 08-21-2008, 05:10 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •