Setting Up A Trepidation Server On Linux

From Trepidation
Jump to: navigation, search

This tutorial assumes that you have some blend of Linux already installed, and you can access the command line. These two things are beyond the scope of this tutorial and If you haven't gotten this far yet you likely will not have much luck with this tutorial. I’m also going under the assumption you know how to mount a cd, use ftp, and already have an ftp server setup, again these are beyond the scope of this tutorial. Although if you choose server installation on most linux distros during the install process you’ll have a ftp server installed by default.

There are a couple different situations that someone hosting a game server will be in. The first is they are hosting it from home, on a linux box they have setup from scratch. The other two scenarios involve renting space on a shared server at a datacenter, or leasing a whole dedicated server or cloud server from a datacenter.

If you have ‘root’ access you will want to create a new user for the game server. If your renting space on a shared server you can just skip creating a new user and install the game server under your existing account. If you don't know if you have root, then you probably don't.

If you don't have root access, skip down to ‘installing the archive’ To add a user, you simply use the ‘adduser’ command. The syntax is:

adduser newusername

Some blends of linux will ask you some additional questions which you can leave blank (except for the password!).

Depending on your Linux distribution, you may need to add (or change) the password with a separate command. Use the passwd command. The syntax is:

passwd username

You will be prompted for your new password.

Su to the user you have created for the server (i.e. su username)

For this tutorial we will assume that the username is simply ‘username’.


installing the archive

Lets be sure we are in the user’s directory by simpy typing:

cd /home/username

The first thing you will want to do is get the dedicated server binaries. Grab those from the Trepidation Site using the following command:

wget http://trepidation.n5net.com/dls/trepidation0.0.20.run

The archive is a self extracting archive. It will automatically create a directory called 'trepidation' off of the directory you run it from. To extract use the following

chmod 0777 *.run
./trepidation0.0.20.run

The archive will extract into a new folder called trepidation. We need to give the binaries permission to actually run. To do this use:

cd trepidation
chmod -R 0777 *

Now you have installed the Linux dedicated server. Now what?

Creating the startup scripts.

The server is pretty much non-functional without a startup script and a server configuration there is one startup script included that you can use as a template called dedicated_server.sh. You can taylor this to your own needs or create a new one below.

Creating New Scripts:

There are two scripts we’ll create to run the server. One script will actually start the server, the other script will run via a cron job to check to see if the server is running and restart it if it goes down.

The first script is the startup script. so create a new file in your favorite text editor called start.sh

here is what we are going to put in this one: start.sh

32 Bit

cd /home/username/trepidation
./trepded.i386 +set net_ip 99.99.99.999 +set dedicated 2 +exec trep-server.cfg > /dev/null 2>&1 & 
echo “Starting Trepidation”

64 bit

cd /home/username/trepidation
./trepded.x86_64 +set net_ip 99.99.99.999 +set dedicated 2 +exec trep-server.cfg > /dev/null 2>&1 & 
echo “Starting Trepidation”


You will want to replace the items to reflect your username, ip address, and server configuration file.

The next script is optional, this script will check to see that the server is running and restart it if it isnt. We’ll call this script serverup.sh So again, open up your favorite text editor and copy the following.

serverup.sh:

process=ps wx | grep trepded.i386 | grep -v grep | wc | gawk ‘{print }’``
if [ “X$process” = “X0” ] then echo “Could not find Game Server Running. Restarting it” 
/home/username/start.sh 
else 
echo “Game Server is running. No Action Needed.” 
fi

Again, replace the ‘username’ with the username you have created for the server. You will also want to setup a cron job to run this script every 15 minutes or so.

You’ll want these files to be placed in the /home/username directory. You’ll also want to set the permissions so that you can actually run the scripts.

chmod 0777 /home/username/*.sh

Now all that is left is to create a server configuration. The start.sh script we created earlier tells the server to startup with a server configuration called trep-server.cfg which one is included in the archive.

There are several server configurations included for various game types which can be found in the "base" folder, you can run any of these that you would like by changing the filename in your start.sh file. You will also want to edit these configuration files to your liking.

Now you are ready to startup your server. to start your server use the following commands:

cd /home/username/trepidation 
./start.sh

To be sure the server is running you can type ps x. You should see a process with trepded in the name. Now try to connect to the server through the game.

On a side note, if your running this out of your home you’ll want to forward all of the appropriate UDP and TCP ports.

Hope that helps.. if you run into problems you may want to check here: http://www.google.com

And remember Trepidation and Quake 3 are extremely similar as far as running a linux server.

Also See