Changes between Initial Version and Version 1 of SmokinGuns/Server/Dedicated


Ignore:
Timestamp:
Dec 24, 2013, 11:09:01 PM (11 years ago)
Author:
barto
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • SmokinGuns/Server/Dedicated

    v1 v1  
     1== Introduction ==
     2This wiki page will explain how to create a server on a dedicated machine with only a SSH access. It is highly inspired from this [http://forum.smokin-guns.org/viewtopic.php?f=27&t=3207#p24715 post].
     3The server for this tutorial will be a Linux machine and we will only use a SSH access to the machine.
     4
     5= Content =
     6* Creating a new user
     7* Installing the game
     8* Starting the server
     9    * with screen
     10    * with an init.d daemon (if you have root)
     11
     12= Creating a new user =
     13It is always better to run things in a separated account, so we will create one.
     14{{{
     15adduser <user>
     16}}}
     17and then log back with SSH as {{{user}}} or just do a {{{su user}}} and {{{cd /home/user/}}}
     18
     19== Installing the game ==
     20So we will use wget for that, if you don't have it, {{{apt-get install wget}}} as root will install it on most deb-based distributions.
     21Then, download the game and unpack it with those commands:
     22{{{
     23wget -c http://www.smokin-guns.org/downloads/Smokin_Guns_1.1.zip
     24unzip Smokin_Guns_1.1.zip
     25rm Smokin_Guns_1.1.zip
     26mv "Smokin' Guns" sgserver
     27}}}
     28also, you can do:
     29{{{
     30cd sgserver
     31mv smokinguns_dedicated.i386 smokinguns_dedicated
     32chmod +x smokinguns_dedicated
     33}}}
     34As you see, we will run the 32bits binaries. If a problem occurs and you need the 64bits binaries, you may compile them yourself or ask them on the forum. Then you should replace the binaries to the 64bits you got.
     35
     36Finally, just have a look into the .cfg files into {{{~/sgserver/smokinguns}}} in particuliar read {{{server.cfg}}}.
     37== Starting the server ==
     38=== With screen ===
     39Screen is a terminal emulator where you can have some program running even if you aren't logged. It is a really quick solution to start a server. If you don't have it, install screen.
     40To start a server via screen just do type those commands:
     41{{{
     42screen
     43cd ~/sgserver/
     44./smokinguns_dedicated +exec server.cfg +set dedicated "2"
     45}}}
     46To quit from screen the right way, just do a CTRL-A + D and you can now logout safely.
     47If you want to see it back, just do either:
     48{{{
     49screen -r
     50}}}
     51or:
     52{{{
     53screen -ls
     54screen -r <id>
     55}}}
     56The {{{id}}} is the number that identifies the screen session when you displayed them all in the first command.
     57
     58=== With an init.d daemon ===
     59With this method, the server can now be used like any other daemon, but you need to do some root work for that matter.
     60So, create a daemon file into {{{/etc/init.d/sgserver.sh}}} with the following content:
     61{{{
     62#!/bin/bash
     63
     64### BEGIN INIT INFO
     65# Provides:          sgserver
     66# Required-Start:   
     67# Required-Stop:     
     68# Default-Start:     2 3 4 5
     69# Default-Stop:      0 1 6
     70# Short-Description: Start/stop Smokin'Guns server
     71### END INIT INFO
     72
     73RULE="su - user -c"
     74BIN="/home/user/sgserver/smokinguns_dedicated +set dedicated 2 +set net_port 27960 +set com_hunkmegs 128 +exec server.cfg >/dev/null 2>&1 &"
     75PROC="smokinguns_dedicated"
     76
     77case "$1" in
     78
     79'start')
     80 $RULE "$BIN"
     81 echo "Smokin' Guns server is running..."
     82;;
     83'stop')
     84 killall $PROC
     85 echo "Smokin' Guns server is stopped..."
     86;;
     87*)
     88 echo "Usage: $0 start|stop"
     89;;
     90esac
     91exit 0
     92}}}
     93
     94You need then to do:
     95{{{
     96chmod +x /etc/init.d/sgserver.sh
     97ln -s /etc/init.d/sgserver.sh /usr/local/bin/sgserver
     98}}}
     99
     100You can now use your server as a daemon like this:
     101
     102start:
     103{{{
     104sgserver start
     105}}}
     106stop:
     107{{{
     108sgserver stop
     109}}}