<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wiki.armagetronad.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dkiller</id>
	<title>Armagetron Advanced - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.armagetronad.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Dkiller"/>
	<link rel="alternate" type="text/html" href="http://wiki.armagetronad.org/index.php?title=Special:Contributions/Dkiller"/>
	<updated>2026-10-16T05:07:12Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>http://wiki.armagetronad.org/index.php?title=Running_Multiple_Servers_on_a_single_Linux_computer&amp;diff=34917</id>
		<title>Running Multiple Servers on a single Linux computer</title>
		<link rel="alternate" type="text/html" href="http://wiki.armagetronad.org/index.php?title=Running_Multiple_Servers_on_a_single_Linux_computer&amp;diff=34917"/>
		<updated>2011-08-17T05:22:17Z</updated>

		<summary type="html">&lt;p&gt;Dkiller: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Introduction ==&lt;br /&gt;
&lt;br /&gt;
If you like to experiment new settings, it might be that you come with a set of interesting servers. A shame if you cannot run them all at the same time. Here is how you can achieve this on a Linux server. Please refer to the lag and bandwidth chapters in the wiki before to run multiple servers. If you run too many, you might end with a very bad gameplay.&lt;br /&gt;
&lt;br /&gt;
There is another webpage that looks similar to this but it has a few extra things: [http://wiki.armagetronad.net/index.php?title=Running_Multiple_Servers_In_a_Single_Ubuntu_Computer Running Multiple Servers In a Single Ubuntu Computer]&lt;br /&gt;
&lt;br /&gt;
This chapter will present you an easy way to run multiple servers on a single Linux computer, using GNU screen.&lt;br /&gt;
&lt;br /&gt;
== Server installation ==&lt;br /&gt;
&lt;br /&gt;
First of all, you have to install the Armagetron Advanced Dedicated Server from your specific operating system&#039;s packages.&lt;br /&gt;
&lt;br /&gt;
Linux source can be found at: https://launchpad.net/armagetronad/&lt;br /&gt;
&lt;br /&gt;
For this tutorial we will use the 0.2.8-armagetronad-ct+sty branch&lt;br /&gt;
CD into /home/&lt;br /&gt;
 cd /home/&lt;br /&gt;
&lt;br /&gt;
download the source files&lt;br /&gt;
 bzr branch lp:~armagetronad-ct/armagetronad/0.2.8-armagetronad-sty+ct&lt;br /&gt;
&lt;br /&gt;
once the source if finished downloading to the server CD to the branch&lt;br /&gt;
 cd /home/0.2.8-armagetronad-sty+ct&lt;br /&gt;
&lt;br /&gt;
Now you need this to run bootstrap.sh for Ubuntu and Debian&lt;br /&gt;
 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 protobuf-compiler&lt;br /&gt;
&lt;br /&gt;
For fixing the login you need to do this (This fixes the login menu from not delayinh)&lt;br /&gt;
 wget http://voxel.dl.sourceforge.net/sourceforge/zthread/ZThread-2.3.2.tar.gz&lt;br /&gt;
 tar -xzf ZThread-2.3.2.tar.gz&lt;br /&gt;
 cd ZThread-2.3.2&lt;br /&gt;
 ./configure CXXFLAGS=&amp;quot;-fpermissive&amp;quot; --prefix=/usr/&lt;br /&gt;
 make &amp;amp;&amp;amp; make install&lt;br /&gt;
&lt;br /&gt;
You may need this here if you dont have it&lt;br /&gt;
 sudo apt-get install libprotobuf-dev&lt;br /&gt;
&lt;br /&gt;
now run the bootstrap&lt;br /&gt;
 ./bootstrap.sh&lt;br /&gt;
&lt;br /&gt;
For CentOS users, you may need to install this for ./configure to work. &lt;br /&gt;
 yum -y install libxml2-devel&lt;br /&gt;
&lt;br /&gt;
Now configure the server. You can look up more options for configuration with ./configure --help. But we will configure the server to be, this way&lt;br /&gt;
 ./configure --disable-glout --enable-authentication --prefix=/home/armagetronad --exec_prefix=/home/armagetronad --with-zthread&lt;br /&gt;
&lt;br /&gt;
once that is configured execute the following command.&lt;br /&gt;
 sudo make install&lt;br /&gt;
&lt;br /&gt;
Now your server has been installed in /home/armagetronad/bin&lt;br /&gt;
&lt;br /&gt;
now continues through the rest of the steps&lt;br /&gt;
&lt;br /&gt;
== Preparing the servers ==&lt;br /&gt;
&lt;br /&gt;
=== The tree ===&lt;br /&gt;
&lt;br /&gt;
CD to /home/armagetronad/ &lt;br /&gt;
 cd /home/armagetronad/&lt;br /&gt;
&lt;br /&gt;
Create the following sub directories:&lt;br /&gt;
&lt;br /&gt;
 mkdir servers      &#039;This folder will be used to store server configurations&lt;br /&gt;
 mkdir logs         &#039;This one will be used to save the server logs&lt;br /&gt;
 mkdir scripts      &#039;And this one will be used to same the scripts we will see below&lt;br /&gt;
&lt;br /&gt;
We have now to create our servers. To do so, go to the servers directory you have created earlier, and for each server, create a sub folder with a one-word name for the server, and one sub folder: var. For example:&lt;br /&gt;
&lt;br /&gt;
 cd /home/armagetronad/servers&lt;br /&gt;
&lt;br /&gt;
To create a server called server1:&lt;br /&gt;
&lt;br /&gt;
 mkdir server1&lt;br /&gt;
 mkdir server1/var&lt;br /&gt;
&lt;br /&gt;
then copy your config files in the var sub folder.&lt;br /&gt;
&lt;br /&gt;
You can then create a second server, and many more...&lt;br /&gt;
&lt;br /&gt;
 mkdir server2&lt;br /&gt;
 mkdir server2/var&lt;br /&gt;
and so on...&lt;br /&gt;
&lt;br /&gt;
=== The setting files ===&lt;br /&gt;
&lt;br /&gt;
For each server, do not forget to create a &amp;quot;server_info.cfg&amp;quot; file (search the wiki about it), and to change the port number. Port can be from 4534 to 4540, meaning you can safely run up to 7 servers on the same computer, depending obviously on the settings of each servers, and the bandwidth they need.&lt;br /&gt;
&lt;br /&gt;
We assume that you know enough about Server Administration to understand the above explainations. This article is about Advanced Server Administration, isn&#039;t it ?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The scripts ==&lt;br /&gt;
&lt;br /&gt;
Now you have to create the scripts to launch and log all your servers. To allow managing each server separately, we will use GNU Screen. GNU screen is a terminal window manager. If it is not install on your server, you can get it with the usual installation tool (yum install screen, apt get screen, etc...). Again... advanced.... We assume you know how to install applications on linux and therefore, we assume GNU screen has been installed&lt;br /&gt;
&lt;br /&gt;
You have to create two scripts. The first one will run a server and start logging the window in which the server has started. The second one will execute the first one for each folder in the /home/armagetronad/servers folder. It will create a window for each of them. Therefore, if you don&#039;t want a server to run, you will have to temporarily move the server folder out from the /home/armagetronad/servers directory.&lt;br /&gt;
&lt;br /&gt;
Save the scripts in the /home/armagetronad/scripts directory. I use nano which is an easy text editor. &lt;br /&gt;
&lt;br /&gt;
=== The server script ===&lt;br /&gt;
&lt;br /&gt;
The first script will be called in this example: srv&lt;br /&gt;
&lt;br /&gt;
 nano /home/armagetronad/scripts/srv &lt;br /&gt;
That creates a text file called srv in the scripts directory. Write the following lines in the file:&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 &lt;br /&gt;
 loc=&amp;quot;/home/armagetronad&amp;quot;&lt;br /&gt;
 mkdir $loc/logs/$1&lt;br /&gt;
 screen -S $1 -X logtstamp on 					# print timestamps in log file&lt;br /&gt;
 screen -S $1 -X logfile $loc/logs/$1/$1_%m-%d-%Y-%c.log 	# create a logfile in the logs subf&lt;br /&gt;
 screen -S $1 -X log on 					# Turn on logging for the server window&lt;br /&gt;
 while true; do 						# start a loop to allow server restart if it crashes                         &lt;br /&gt;
            &lt;br /&gt;
 # runs the actual server. By default, the binary is called armagetronad-dedicated and is located in the prefix/bin directory. In this example, it is&lt;br /&gt;
 # in /home/armagetronad/bin directory.&lt;br /&gt;
 	$loc/bin/armagetronad-dedicated --vardir $loc/servers/$1/var                              &lt;br /&gt;
 # Shows the errors and indicates that the server has crashed, and then, waits 5 seconds before restarting the server, allowing you to quit with CTRL-C&lt;br /&gt;
        echo &amp;quot;Server has crashed. It will restart immediately..., press CTRL-C to cancel&amp;quot;&lt;br /&gt;
        sleep 5                                                                                                                                          &lt;br /&gt;
 done # end the loop&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To save the file, press CTRL-X and Y to confirm. You have now a file called srv in /home/armagetronad/scripts&lt;br /&gt;
&lt;br /&gt;
=== the global script ===&lt;br /&gt;
&lt;br /&gt;
Create the second script. I called it start: &amp;lt;code&amp;gt; nano /home/armagetronad/scripts/start&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
 #!/bin/bash                                                                                                                                               &lt;br /&gt;
 # If you run the script with a parameter (server name), only that server will be start. Otherwise, all servers in the /home/arma/servers directory &lt;br /&gt;
 # will be started&lt;br /&gt;
 if [ &amp;quot;$1&amp;quot; != &amp;quot;&amp;quot; ]; then&lt;br /&gt;
        screen -S $1 -X quit				# Kill the window if it exists already, avoiding to run the same server twice&lt;br /&gt;
        screen -dmS $1 /home/armagetronad/scripts/srv $1			 # start a GNU screen window with the specified server inside&lt;br /&gt;
 else&lt;br /&gt;
        for f in $(ls /home/armagetronad/scripts/servers/.)	 # start a loop running the following command for any existing folders in the&lt;br /&gt;
 # /home/armagetronad/servers folder&lt;br /&gt;
                 do&lt;br /&gt;
                        screen -S $f -X quit				# Kill the window if it exists already, avoiding to run the same server twice&lt;br /&gt;
                        screen -dmS $f /home/armagetronad/scripts/srv $f	# start a GNU screen window with the server inside for each server folder&lt;br /&gt;
                        done							# ends the loop&lt;br /&gt;
 fi&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
Save it and exit the same way as before.&lt;br /&gt;
&lt;br /&gt;
BEFORE YOU RUN THE SCRIPT:&lt;br /&gt;
&amp;lt;code&amp;gt;chmod +x srv start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Starting all servers ===&lt;br /&gt;
&lt;br /&gt;
To make your servers start at boot, edit the /etc/rc.local file and add the &amp;quot;start&amp;quot; script at the end of &amp;lt;code&amp;gt;/home/armagetronad/scripts/start&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to manually start all servers, just run the &amp;lt;code&amp;gt;./start&amp;lt;/code&amp;gt; script. &lt;br /&gt;
&lt;br /&gt;
=== Starting a single specific server ===&lt;br /&gt;
&lt;br /&gt;
CD to /home/armagetronad/scripts/&lt;br /&gt;
 cd /home/armagetronad/scripts/&lt;br /&gt;
&lt;br /&gt;
Now if you want to start (or restart) a single server, just run ./start servername, for example&lt;br /&gt;
 ./start server1&lt;br /&gt;
&lt;br /&gt;
== Server management ==&lt;br /&gt;
&lt;br /&gt;
=== GNU screen ===&lt;br /&gt;
&lt;br /&gt;
GNU screen is a great tool. As explained above, it allow a multi-windowed environement on the simple terminal. And even better, the windows stay alive, evening when you disconnect from the server. You can find everything about GNU screen by typing &amp;lt;code&amp;gt;man screen&amp;lt;/code&amp;gt; on a terminal.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Listing the running servers ===&lt;br /&gt;
&lt;br /&gt;
To see the existing windows, meaning here, the running servers, type &amp;lt;code&amp;gt;screen -ls&amp;lt;/code&amp;gt;. It will gives you a list of running windows.&lt;br /&gt;
&lt;br /&gt;
=== Accessing and leaving a server console ===&lt;br /&gt;
&lt;br /&gt;
To attach to a window, type &amp;lt;code&amp;gt;screen -r servername&amp;lt;/code&amp;gt;. You will be in the server console. You can then do all the command you would usually do there. Remote moderation, server adjustment, and so on.&lt;br /&gt;
&lt;br /&gt;
To detach, but keep the server running, press CTRL-a d (control key + low case A, then low case D to detach). You can find all GNU screen key combinations by reading &amp;lt;code&amp;gt;man screen&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== Killing a server ===&lt;br /&gt;
&lt;br /&gt;
To kill a server, attach to its window, and press CTRL-C. This will kill the script, and the window. Then press ESC to exit the dead window. An alternate way is to run &lt;br /&gt;
 screen -S servername -X quit&lt;br /&gt;
This will kill and end the window and the server inside.&lt;br /&gt;
&lt;br /&gt;
=== Log files ===&lt;br /&gt;
&lt;br /&gt;
Everytime the &amp;lt;code&amp;gt;srv&amp;lt;/code&amp;gt; script is run, a new logfile will be created in the /opt/armagetronad/logs folder. Keep an eye on log sizes. You don&#039;t want to run out of disk space because of Armagetron Advanced, do you ?&lt;br /&gt;
&lt;br /&gt;
=== Test the server autorestart ===&lt;br /&gt;
&lt;br /&gt;
If you want to try if the server restarts when it crash, do not press CTRL-C into the window. CTRL-C kill the script, therefore it will not be able to restart. Instead, run the &amp;lt;code&amp;gt;quit&amp;lt;/code&amp;gt; command inside the server console. It will close the server, and you will be able to see the message, and the server restarting.&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
&lt;br /&gt;
This article has been written by Superkikim. These scripts and setup details are used to run the &amp;quot;FAST TRACK&amp;quot;, &amp;quot;Most Wanted&amp;quot; and &amp;quot;Club Dutch&amp;quot; servers.&lt;br /&gt;
&lt;br /&gt;
== VPS packs to install ==&lt;br /&gt;
&lt;br /&gt;
On Centos based systems (Fedora Core, Redhat):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;yum groupinstall &amp;quot;Development Tools&amp;quot;&amp;lt;br&amp;gt;&lt;br /&gt;
yum install libxml2-devel&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Install BZR&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;su -c &#039;rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm&#039;&amp;lt;br \&amp;gt;&lt;br /&gt;
su -c &#039;yum install bzr&#039;&amp;lt;/code&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
Compiling Zthreads&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;&lt;br /&gt;
CXXFLAGS=-fpermissive ./configure --prefix=/usr&amp;lt;br&amp;gt;&lt;br /&gt;
make&amp;lt;br&amp;gt;&lt;br /&gt;
make install&amp;lt;br&amp;gt;&lt;br /&gt;
ldconfig&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Server/config]]&lt;/div&gt;</summary>
		<author><name>Dkiller</name></author>
	</entry>
</feed>