Go Back   Steam Users' Forums > Dedicated Server Discussions > Half-Life DS (Linux)

Reply
 
Thread Tools Display Modes
Old 05-08-2006, 11:31 PM   #1
t-smokeclan.com
 
Guest
Posts: n/a
Webmin Control Panel

This was posted here yrs ago.. cant find thread so I decided to repost instructions on how to make a control panel for your game server on your dedicated box.

_______________________________

Code:
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.
 
Reply With Quote
Old 05-10-2006, 01:00 PM   #2
warlocky
 
Guest
Posts: n/a
Can you perhaps add any example files?
Or link to webmin, and the addons for it?
  Reply With Quote
Old 05-12-2006, 09:18 PM   #3
t-smokeclan.com
 
Guest
Posts: n/a
www.webmin.com

also some info here such as updating servers is out of date, but most people know the new commands .
  Reply With Quote
Old 05-21-2006, 05:16 PM   #4
warlocky
 
Guest
Posts: n/a
where do i put the .sh files?
  Reply With Quote
Reply

Go Back   Steam Users' Forums > Dedicated Server Discussions > Half-Life DS (Linux)


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -7. The time now is 02:57 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site Content Copyright Valve Corporation 1998-2012, All Rights Reserved.