Go Home | Install sty+ct+ap instead |
Tutorial is all about using 0.4+ap.
This tutorial is simply a re-make of the currently existing [tutorial] written by me (LOVER$BOY). This too is written by me a.k.a Vertrex but with a few differences here and there. I hope it will all make sense in due time. Once I finish writing this one, I will link that old tutorial to this and it'll be settled then :)
This tutorial only applies to Ubuntu or Debian based Linux OS but if you are a Linux Mint user, this tutorial will also work for you :)
Below I will be using {username} to indicate for you to replace {username} with your own username. I will indicate but you should keep that in mind, just in case I slip up.
Open up your Terminal and let's get started!
These following are the software that need to be installed beforehand.
Make sure you do
sudo apt-get update
before going onto next line.
You can install them, all-in-one, through the following code
sudo apt-get install bzr build-essential automake libboost-dev libxml2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev ftgl-dev libglew-dev bison pkg-config autoconf autotools-dev libprotobuf-dev screen nano libxml2 php5
What to install? Well, for this tutorial I will be using Alpha Project's but you have the choices and they are all here: Armagetron Advanced: a Tron Clone in 3d.
Let's use a location that won't restrict us for the security reasons or any other the computer could think of. Example, let's try out /home/{username}/
directory. Replace the {username}
with your username.
cd /home/{username}/
Now download the source into the folder
bzr branch lp:~armagetronad-ap/armagetronad/0.4+ap
After downloading, do
cd 0.4+ap
Then do
./bootstrap.sh
Next minimize the terminal and in your /home/{username}/
folder, make a directory to install the server in. For this tutorial's case, I'll do
mkdir armagetronad
Check the list for the full details configuration extensions: Configuration Extensions
REMINDER: DO NOT FORGET TO REPLACE {username}
with your username!
Next configuring the server itself and again, remember to replace {username}
with your username.
./configure --disable-glout --enable-authentication --prefix=/home/{username}/armagetronad --exec_prefix=/home/{username}/armagetronad --with-zthread
If you wish to be more picky with the MAX_CLIENTS, then I suggest you do
--with-maxclients=X
by replacing X
with the number you want and it should look like this:
./configure --disable-glout --enable-authentication --prefix=/home/{username}/armagetronad --exec_prefix=/home/{username}/armagetronad --with-zthread --with-maxclients=X
REMINDER: DO NOT FORGET TO REPLACE {username}
with your username!
CXXFLAGS="-pipe" ./configure --enable-dedicated --enable-armathentication --disable-automakedefaults --disable-sysinstall --disable-useradd --disable-etc --disable-desktop --disable-initscripts --disable-uninstall --disable-games --prefix=/home/{username}/armagetronad/var
Two commands and 30 minutes of your time is required for this part.
make make install
The first command's execution will cause the server to prepare to be installed for over 20 minutes. Then run the second command and your server should be installed. Go into your /home/{username}/armagetronad/
folder and you should be able to see three folders
bin etc share
Go into bin
folder and check to make sure you have
armagetronad-dedicated armagetronad-dedicated-uninstall
If you have it, that means your server has been installed successfully!
This is where we will be describing on how to have multiple servers, the folders required and stuff like that.
Ok, first enter into your the folder you installed your server in. For this tutorial, that is /home/{username}/armagetronad
Next create the following folder
mkdir servers
It doesn't have to be servers
. Have the folder name set to whatever you prefer but I always set it with that name so I know that's where servers go.
Now go into that folder. servers
is the folder for this tutorial.
mkdir {server_name}
Replace {server_name}
with the name of the server or whichever. The choice is again down to you. Next enter into that newly created directory and start creating the folders we need.
Doing it and their explanations are also given below:
mkdir scripts # the folder for scripts to run that particular server, also for script.php mkdir settings # the folder for holding our custom settings and config files & folders mkdir var # the folder for the files the server writes to, like ladderlog.txt, players.txt, etc... mkdir logs # the folder for logs of your server, especially its console or any errors it detected. No need to create if not needed.
As an example, this tutorial will have following directories
mkdir Test cd Test mkidr scripts mkdir settings mkdir var mkdir logs
After creating the directories, go and place the files required in each of them. If you don't get it, read the descriptions above for clarifications. Even after reading them and your confused... read the bit below...
Read this if your folder lost!
Folder: scripts
Description: This is the folder for all of your scripts, such as the start-up script and any other configuration scripts you want to use go. Getting Files: Continue to read tutorial and you'll know soon.
Folder: settings
Description: Settings folder which holds your configs and the regular settings to make the server run properly.
Getting Files:
cd /home/{username}/armagetronad/etc/ cp armagetronad-dedicated /home/{username}/armagetronad/servers/settings/
Check to make sure files did really copy. Might need to do it manually (if you are running a GUI Linux OS instead of a console server).
This is where you will be creating files you would definitely need if hackers tend to jump in servers and take over. Do
touch command.txt touch console.txt
I'm not certain touch
command works but it should create those two files in your /home/{username}/armagetronad/servers/Test/
directory.
The command.txt
is the file used to send commands to the server using your terminal.
The console.txt
is the file that stores the console as the server does it's job. Useful to going back and checking to ensure nothing terrible happened. Also useful to check for errors.
Time to create the script you need to start your test server. At-least, that's what is happening in this tutorial.
These scripts are straightforward I hope. Replace {username} and any other file or folder names that your and mine differ from.
After preparing the server up, cd into scripts
and do
nano start.sh
I prefer to use server
as the standard file name but you can choose what you want it named but I generally prefer to name it like this so I know it's to actually run the server, not the start-up script. However, have the extension as .sh
Now a new screen will appear in your terminal. In there, type the following or, if you are lazy, simply copy and paste and then alter it.
#!/bin/bash loc="/home/{username}/armagetronad/" tron=$loc"bin/armagetronad-dedicated" server=$loc"/servers/Test/" var=$server"var" settings=$server"settings" command=$server"command.txt" console=$server"console.txt" while true; do $tron --vardir $var --userconfigdir $settings --input $command >> $console echo "============== SERVER RESTARTING ==============" >> $console sleep 5 done
The while true; go
is a loop system that ensures, when the server quits or crashes. As it automatically restarts after crash or whatever it was that caused it to shut down, the script will write ============== SERVER RESTARTING ==============
to console.txt
Finally, to wrap things up here, in terminal window we do
chmod +x server.sh
I always name start script start.sh
which I find easy to handle and understand.
#!/bin/bash loc="/home/{username}/armagetronad/servers/Test/" command=$loc"command.txt" case $1 in start) echo "Starting Server" screen -dmS {server_name} ./server.sh ;; stop) echo "Stopping Server" screen -S {server_name} -X quit ;; esac
Don't forget to replace {server_name}
with the name you want to give the server to be stored in the screen under as.
So, replace the things that yours and mine differ from and finish of by doing:
chmod +x start.sh
Now that you've created the Server Script and Start Script, we can move onto actually causing the servers to start.
So just open up your terminal again if you had it closed and cd to your scripts folder
cd /home/{username}/armagetronad/servers/Test/scripts
Once in, execute the following:
./start.sh start
After execution, a message show appear in the terminal saying "Server Starting". You can check to make sure its up by typing the following
screen -r {server_name}
Instead of {server_name}
, type in the name you gave the server and it should be listed in the list of screen running.
To dtach yourself from the screen without causing it to quit, simply press together the keys: CTRL + A + D
screen -ls # lists all screens running currently
Not really a special content here, simply have to go back into your scripts folder and do:
./start.sh stop
and a message saying "Server Stopping" should appear. To ensure the server has stopped, do
screen -ls
Here you will learn to do more high ordered scripting to make your server fascinating and cool!
Obviously this section will inform you on how to run Script.php.
The easist way:
Put Script.php in your scripts folder, then run
chmod +x Script.php
to make it executable. After that, put the following line in your settings file:
SPAWN_SCRIPT Script.php
*NOTICE* The server is very picky, so make sure its all the way the computer wants it to be.
The correct folder usally would be:
/home/{username}/armagetronad/bin/armagetronad-dedicated/scripts/
.
The other way:
First you create the file, either manually through editor or nano. After making your code, save it in your server's scripts folder. Then run
chmod +x Script.php
to make it executable. The next is the script to allow script.php be a part of the server script without major changes.
#!/bin/bash loc="/home/{username}/armagetronad/" tron=$loc"bin/armagetronad-dedicated" server=$loc"/servers/Test/" var=$server"var" ladderlog=$var"/ladderlog.txt" settings=$server"settings" command=$server"command.txt" console=$server"console.txt" while true; do tail -n0 -f -s 0.01 $ladderlog | php ./script.php | $tron --vardir $var --userconfigdir $settings --input $command | tee -a $console echo "============== SERVER RESTARTING ==============" >> $console sleep 5 done
Changes the things you need here so the script works for you just like it works for me. One of the problems you might have with this is that you might not be able to type anything in the terminal
These are snippets of stuff that I found useful when I had problems with things when running my server.
Firstly go into your user folder:
cd /home/<your_username>
Downloading ZThread Compressed File
wget http://vertrex.tk/sources/ZThread/ZThread-2.3.2.tar
Extracting File
tar -xvf ZThread-2.3.2.tar
Entering into the extracted folder
cd ZThread-2.3.2
Configuring the source files
./configure CXXFLAGS="-fpermissive" --prefix=/usr/
Perform the installation of the source files
make && make install
IF ERROR COMES BACK AS
cannot create regular file '/usr/lib/libZThread-2.3.so.2.0.0': Permission Denied
That only means that you do not have ROOT privileges. This is the most common case for any regular user who has Linux and Windows installed. To get around this, you simply do
sudo su
which should put you in root. Mind that it might not work but for me, it did! Once it works, do the same process as above and it will complete!
You simply enter the following into the terminal and it will automatically should install it for you:
sudo apt-get install libtool
Well if you don't want to compile anything, just do
apt-get install python-protobuf
It will fix the problem
<P>Otherwise, you can do it like thisFirstly go into your user folder: cd /home/<your_username> Downloading the compressed File wget http://protobuf.googlecode.com/files/protobuf-2.0.3.tar.bz2 Extracting File tar -jxvf ./protobuf-2.0.3.tar.bz2 Entering into the extracted folder cd protobuf-2.0.3 Configuring the source files ./configure --prefix=/usr Perform the installation of the source files sudo make install
This will automatically install the screen command which you need for these scripts
sudo apt-get install screen
This will automatically install the screen command which you need for these scripts
sudo apt-get install php5
This will automatically start the installation of the bzr which you will need in order to download the armagetronad source files.
sudo apt-get install bzr
This will automatically start to install libxml2. This is needed if the ./configure is to work properly.
sudo apt-get install libxml2-dev
This should be done first as most virtual servers won't be usable before being updated.
sudo apt-get update
Thank you for taking the time to read through this tutorial and hopefully you picked up useful things to help you through setting up your server and maybe in future you will be able to start using the advanced things I have mentioned here.
Oops... I did it again :P
I have a tendency of making extremely long sentences because I am too lazy to make it simple and easy to read. Hope I didn't scare you there :P