Jump to content
Dwarfer

[WIP][HOWTO] Linux - Centos 7.0 Epoch Server

Recommended Posts

Hi Guys,
 
I have just got a Centos 7.0 server up and running on Linux.. I am planning to write a how to shortly. with ASM !
 
If you want to give it a test try 37.152.48.109:2302
 
-------------------------
** The epochserver.so at present requires GLIBCXX_3.4.20 and GLIBC_2.4 that is not in the repo by default so we just have to fudge 2 of the 32bit libraries for this to work with centos, Have asked if the dev's can compile with and less bleeding edge glibc to be inline with arma3 linux.
 
Requirements
 
Linux Knowledge - Would Help.
CPU - Some
RAM -Yes
DISK - I have gone with 24GB for the moment for my testing but with Arma3+Epoch it only is using about 5GB.. 
 
 
Centos Install
 
WIP TBD
 
1) Download the Minimal ISO from http://www.centos.org/download/
2) 
 
Packages needed

yum install epel-release
yum update
yum install wget lynx nano glibc.i686 libgcc.i686 watchdog libstdc++.i686 net-tools screen psmisc redis glib2.i686 zip unzip

Extra Packages

 
These need to be forced installed for now, I have tested this on multiple boxes however I would be careful doing this on a box that is doing lots of other things, glibc can screw lots of things up.. 
 

glibc-2.20-8.fc21.i686.rpm
libstdc++-4.9.2-6.fc21.i686.rpm
 
You will need todo this as root user

wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/updates/21/i386/g/glibc-2.20-8.fc21.i686.rpm
wget ftp://ftp.pbone.net/mirror/download.fedora.redhat.com/pub/fedora/linux/updates/21/i386/l/libstdc++-4.9.2-6.fc21.i686.rpm

rpm -Uvh --force --nodeps glibc-2.20-8.fc21.i686.rpm libstdc++-4.9.2-6.fc21.i686.rpm

Mirrors can be found here if the links are dead.
http://rpm.pbone.net/index.php3/stat/4/idpl/28989829/dir/fedora_21/com/glibc-2.20-8.fc21.i686.rpm.html
http://rpm.pbone.net/index.php3/stat/4/idpl/28878844/dir/fedora_21/com/libstdc++-4.9.2-6.fc21.i686.rpm.html
 
 Steam Arma3 Install
 
Add User I've gone with epoch, Basically we add the user, download the steamcmd decompress that then make a simple bash file to download Arma3, You will need to change XX YY with your username and password

adduser epoch
su - epoch
mkdir steamcmd
cd steamcmd
wget http://media.steampowered.com/client/steamcmd_linux.tar.gz
tar zxfv steamcmd_linux.tar.gz
cd ~
echo -e '#!/bin/bash\n./steamcmd/steamcmd.sh +login XX YY +force_install_dir /home/epoch/arma3 +"app_update 233780" validate +quit' > a3update.sh
chmod +x a3update.sh
./a3update.sh

You could also try anonymous logins (TO BE TESTED) Does not work as A3 Server requires purchase
https://developer.valvesoftware.com/wiki/Dedicated_Servers_List

echo -e '#!/bin/bash\n./steamcmd/steamcmd.sh +login anonymous +force_install_dir /home/epoch/arma3 +"app_update 233780" validate +quit' > a3update_anonymous.sh
chmod +x a3update_anonymous.sh
./a3update_anonymous.sh

Redis Install
 
Use your favorite text editor to open up /etc/redis.conf i like nano myself, search for requirepass (in nano press ctrl+w and enter requirepass) once you have found this un comment that line and place whatever password you like.  This will need to match your EpochServer.ini later on.
 
*more to come on optimization
 
Now lets start redis and set it to auto boot as root do the following

systemctl enable redis
service redis start

Redis should now be up and running.  The dump file is kept at /var/lib/redis/dump.rdb 
 
 Epoch Install
 
You will need to get the client and server files copied to the box, you can either SCP them from your desktop PC or use a wget or something to get them.  *You can use the steam workshop to download the main client files but I have not covered that here *YET*
 
to check you have the right libaries you will need to do the following, You can ignore the errors with libhiredis and libpcre as they are taken care of with the "export LD_LIBRARY_PATH" within the script
 
Once you have the files decompressed on your server make sure all the main folders are lower case, I had to change @Epoch\Addons to @epoch\addons

 

Get Client Files (could be done better)

cd ~
mkdir tmp
url=`wget http://epochmod.com/download.php -q -O -|grep "Official HTTP Mirrors"|awk -F\| {'print $1"\n"$2'}|sed -n 's/.*href="\([^"]*\).*/\1/p'|head -n1`; echo "$url";wget "$url"
unzip Epoch_Client_*
mv \@Epoch/ \@epoch
mv \@epoch/Addons/ \@epoch/addons
mv \@epoch/ ~/arma3/

Getting the server files, You can do the following on a clean server to get the files. We delete the DB and BEC dir as this is not needed on Linux.

cd ~
mkdir tmp
wget https://github.com/EpochModTeam/Epoch/archive/master.zip
unzip master.zip
rm -r Epoch-master/Server_Install_Pack/DB/
rm -r Epoch-master/Server_Install_Pack/BEC/
mv Epoch-master/Server_Install_Pack/* ~/arma3/

Now lets check we have the right libraries. If the output has anthing todo with "not found" or gives errors you will need to fix them

ldd ~/arma3/\@epochhive/epochserver.so
ldd ~/arma3/sc/battleye/beserver.so
ldd ~/arma3/arma3server

Now we need to run the epoch_linux_startscript.sh script with the check option

cd ~/arma3/
./epoch_linux_startscript.sh check

You should get something like the following, You will see errors and this will tell you what you need to run to fix it

ArmA 3 directory: /home/epoch/arma3 OK
Server executable: /home/epoch/arma3/arma3server OK
CFG directory: /home/epoch/arma3/sc OK
Config file: /home/epoch/arma3/sc/config.cfg OK
Basic file: /home/epoch/arma3/sc/basic.cfg OK
Battleye directory: /home/epoch/arma3/sc/battleye/ OK
Arma3Profile: /home/epoch/arma3/sc/users/sc/sc.arma3profile OK
Log directory: /home/epoch/arma3/logs MISSING!
========= We need that folder. You can use the next row to create it: =========
mkdir /home/epoch/arma3/logs

Old Log directory: /home/epoch/arma3/logs/old MISSING!
========= We need that folder. You can use the next row to create it: =========
mkdir /home/epoch/arma3/logs/old

Profile directory: ~/.local/share/Arma\ 3\ -\ Other\ Profiles/sc MISSING!
========= You should create this folder. You can use the next row for that: =========
=========       ( Not sure if we need this? Capital letters are ok ?)       =========
mkdir -p ~/.local/share/Arma\ 3\ -\ Other\ Profiles/sc

Arma3Profile symlink: ~/.local/share/Arma\ 3\ -\ Other\ Profiles/sc/sc.Arma3Profile MISSING!
========= You should creat this symlink. You can use the next row for that: =========
=========       ( Capital letters are ok in ~/.local/share/Arma 3.. !)      =========
ln -s /home/epoch/arma3/sc/sc.arma3profile ~/.local/share/Arma\ 3\ -\ Other\ Profiles/sc/sc.Arma3Profile


Port number will be: 2302
PID file will be: /home/epoch/arma3/2302.pid
RUN file will be: /home/epoch/arma3/2302.run

Start cmd will be:
/home/epoch/arma3/arma3server >>/home/epoch/arma3/logs/port_2302.25.05.15_1001.log 2>&1 -config=/home/epoch/arma3/sc/config.cfg -cfg=/home/epoch/arma3/sc/basic.cfg -port=2302 -name=sc -pid=/home/epoch/arma3/2302.pid [email protected] -cpuCount=4 -exThreads=1 -maxmem=2047 -nosound -autoinit -loadMissionToMemory

If you got something MISSING, you have to work from the top to the bottom, fix the top issue and start the check again!

Now just run the command its asking you to-do. for me I just did the following

mkidr -p /home/epoch/arma3/logs/old
mkdir -p ~/.local/share/Arma\ 3\ -\ Other\ Profiles/sc
ln -s /home/epoch/arma3/sc/sc.arma3profile ~/.local/share/Arma\ 3\ -\ Other\ Profiles/sc/sc.Arma3Profile

Now just run the check again and you should have no errors.

 

Configurations

 

Now just edit the following files to what settings you like

 

Make sure your Password in the Redis section matches the password you set when doing the redis install.

nano ~/arma3/\@epochhive/EpochServer.ini

Change your Admin settings in here

nano ~/arma3/\@epochhive/epochah.hpp

You should be ready to start the server now

~/arma3/epoch_linux_startscript.sh start

BattlEye Install
 
Make sure your BEServer.cfg is changed to lower case
Change your EpochServer.ini "IP = 127.0.0.1" to the main interface of your server, 127.0.01 does not seem to connect
 
you can run the following line in the same dir at the ini file and it will change it for you
 

IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1  -d'/'`; sed -i '0,/IP = 127.0.0.1/s//IP = '"$IP"'/' EpochServer.ini

  
ASM Install
 
Taken from http://forums.bistudio.com/showthread.php?182602-Arma-Server-Monitor-for-Linux
 
The simplest way to keep the ASM running even when the server restarts is as follows. Find the line that says 
 

# this is a background watchdog process. Do not start directly
while [ -f ${RUNFILE} ]; do

 
Directly under that add the following

#Keeps ASM running if found and executable
if [ -x "${ARMA_DIR}/asm" ]; then
	echo >>${LOGFILE} "WATCHDOG ($$): [$(date)] Starting ASM"
	killall -9 asm 1> /dev/null 2>/dev/null
	$ARMA_DIR/asm -s &>$ARMA_DIR/asm.out &
fi

To just enable or disable the ASM just "chmod -x asm" or "chmod +x asm"
 
 
Performance Tweaks
 
You can use the linux command taskset to set the cpu affinity for processors, Looks for the "${SERVER} >>${LOGFILE}" in the start script and put something like this infront of the line, This would enable it for cpu0, cpu1, cpu2 and cpu3

taskset -c 0,1,2,3 ${SERVER} >>${LOGFILE} 2>&1 -config=${CONFIG} -cfg=${CFG} -port=${PORT} -name=${NAME} -pid=${PIDFILE} -mod=${MODS} -servermod=${SERVERMODS} -bepath=${BEPATH} ${OTHERPARAMS}

You can also use the nice command to prioroties the proccess. by default application have 0 set to them. positive figures lower the priority, negatives increase priority. On Centos don't go more than -20 as that is what the core items need like disk controls and stuff, to make it perminate for the epoch user to have -10 you can edidt the /etc/security/limits.conf todo this just add a new line with "epoch hard priority -10" or you can just run this as root

echo -e "epoch hard priority -10" >> /etc/security/limits.conf

Share this post


Link to post
Share on other sites

Notes, Older Distro's may have some errors like the following.  You will either need to update your glibc and libstdc++ to glibc-2.20.x and libstdc++-4.9.x or newer.

[[email protected] @epochhive]$ ldd epochserver.so
./epochserver.so: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by ./epochserver.so)
./epochserver.so: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./epochserver.so)
        linux-gate.so.1 =>  (0x00eec000)
        libhiredis.so.0.10 => not found
        libpcre.so.3 => not found
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00167000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00252000)
        libc.so.6 => /lib/libc.so.6 (0x00270000)
        libm.so.6 => /lib/libm.so.6 (0x00428000)
        /lib/ld-linux.so.2 (0x00587000)

debugging stuff if you need it..  

[[email protected] ~]$ ldd arma3/arma3server
        linux-gate.so.1 =>  (0xf77bf000)
        libpthread.so.0 => /lib/libpthread.so.0 (0xf779c000)
        librt.so.1 => /lib/librt.so.1 (0xf7793000)
        libdl.so.2 => /lib/libdl.so.2 (0xf778e000)
        libsteam_api.so => /home/epoch/arma3/libsteam_api.so (0xf777b000)
        libstdc++.so.6 => /lib/libstdc++.so.6 (0xf7683000)
        libm.so.6 => /lib/libm.so.6 (0xf7636000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf761b000)
        libc.so.6 => /lib/libc.so.6 (0xf744f000)
        /lib/ld-linux.so.2 (0xf77c0000)
[[email protected] ~]$ ldd arma3/\@epochhive/epochserver.so
        linux-gate.so.1 =>  (0xf77c0000)
        libhiredis.so.0.10 => not found
        libpcre.so.3 => not found
        libstdc++.so.6 => /lib/libstdc++.so.6 (0xf75db000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xf75c0000)
        libc.so.6 => /lib/libc.so.6 (0xf73f3000)
        libm.so.6 => /lib/libm.so.6 (0xf73a6000)
        /lib/ld-linux.so.2 (0xf77c1000)

 

centostopa3.jpg

 

centosasm.jpg

Share this post


Link to post
Share on other sites

Pass but from what I see so far AI do seem to be snappier and it does use CPU more easily

 

Yes, easily. doing them at the moment.   If anyone want to have a play or want more infor drop me a PM, can do a online demo/meeting if anyone wants

Share this post


Link to post
Share on other sites
tom34

 

I am not really a Debian man more Centos, RH or Slackware. If people really need it I could however lots of above is generics anyway and will work for most distros.  What are you having trouble with ?

 

Thanks

Share this post


Link to post
Share on other sites

Hi Dwarfer did not want to clutter up your Linux performance thread so I thought I would ask here did you mange to get a semi stable cps dose it even matter ?

I have tried a few different command line args but dose not affect the cps or fps 

 

Thanks JamieKG

Share this post


Link to post
Share on other sites

Thanks for all these ideas, help me a lot !

Change your EpochServer.ini "IP = 127.0.0.1" to the main interface of your server, 127.0.01 does not seem to connect

Are you sure of that ? I don't have "" and it seems to work perfectly !!

Share this post


Link to post
Share on other sites

Intresting with the difference on the space windows versus Linux take :P

 

CentOS minimum (Dwarfer is recommending) you can fit on an old CD-R, my windows 7 Ultimate i own with a real license take 2 DVDS i think (atleast). :)

Share this post


Link to post
Share on other sites

Hows the performance going on Linux? Are you using it for your live servers yet?

 

Do you mean me?

 

Sorry to say i have been stuck with to much work and IRL stuff, so havent got much time.

 

For the moment i have installed CentOS on my computer i use as testserver at home and come to the step where i checked the libraries. Seems like some of them wasent updated as intended (was late so was to tired to continue for the time being).

 

But im very new to Linux to. Been stuck with Windows environment for to long time both at home and at work, except for using some Unix at work but was long time ago.

 

One other problem is i get stuck at checking around for hours reading up on all kinds of intresting stuff about Linux and how to do guides (its fun with something new and learn). :P

 

But Dwarfers guide is really great, helps out alot! :)

 

So will continue this weekend if i get time.

Share this post


Link to post
Share on other sites

Downloading the server package from Steam doesn't require you to purchase it.

You can create a new Steam account and download the server package using that account even if you don't buy the game.

Don't use your main Steam account or you won't be able to run the server and play on it at the same time.

Share this post


Link to post
Share on other sites
second_coming

 

Good to know you can just download the server with a simple register. Did not know that. 

 

However you can run your server and still play on it downloaded from the same account :-).  Even with A2 you could :-)..  H Client maybe not but simple server yes :-)

Share this post


Link to post
Share on other sites

https://raw.githubusercontent.com/katzsmile/DayZAdmin/master/modules/rcon.php

That also works and is a bit tidier :)

config.php

<?php

	$serverip = "127.0.0.1";
	$serverport = "2302";
	$rconpassword = "xxxx";
?>
rcon.php

<?php 

function strToHex($string)
{
    $hex='';
    for ($i=0; $i < strlen($string); $i++)
    {
        $hex .= dechex(ord($string[$i]));
    }
    return $hex;
}

function hexToStr($hex)
{
    $string='';
    for ($i=0; $i < strlen($hex)-1; $i+=2)
    {
        $string .= chr(hexdec($hex[$i].$hex[$i+1]));
    }
    return $string;
}

function computeUnsignedCRC32($str){
   sscanf(crc32($str), "%u", $var);
   $var = dechex($var + 0);
   return $var;
}
 
function dec_to_hex($dec)
{
    $sign = ""; // suppress errors
	$h = null;
    if( $dec < 0){ $sign = "-"; $dec = abs($dec); }

    $hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5,
                  6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'a',
                  11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e',   
                  15 => 'f' );
       
    do
    {
        $h = $hex[($dec%16)] . $h;
        $dec /= 16;
    }
    while( $dec >= 1 );
   
    return $sign . $h;
} 

function get_checksum($cs)
{
    $var = computeUnsignedCRC32($cs);
	//echo "crchex: ".$var."<br/>";
	$x = ('0x');
	$a = substr($var, 0, 2);
	$a = $x.$a;
	$b = substr($var, 2, 2);
	$b = $x.$b;
	$c = substr($var, 4, 2);
	$c = $x.$c;
	$d = substr($var, 6, 2);
	$d = $x.$d;
	return chr($d).chr($c).chr($b).chr($a);
} 

function rcon($serverip,$serverport,$rconpassword,$cmd){
	$passhead = chr(0xFF).chr(0x00);
	$head = chr(0x42).chr(0x45);
	$pass = $passhead.$rconpassword;
	$answer = "";
	$checksum = get_checksum($pass);

	$loginmsg = $head.$checksum.$pass;

	$rcon = fsockopen("udp://".$serverip, $serverport, $errno, $errstr, 1);
	stream_set_timeout($rcon, 1);

	if (!$rcon) {
		echo "ERROR: $errno - $errstr<br />\n";
	} else {
		fwrite($rcon, $loginmsg);
		$res = fread($rcon, 16);
		
		$cmdhead = chr(0xFF).chr(0x01).chr(0x00);
		//$cmd = "Players";
		$cmd = $cmdhead.$cmd;
		$checksum = get_checksum($cmd);
		$cmdmsg = $head.$checksum.$cmd;
		$hlen = strlen($head.$checksum.chr(0xFF).chr(0x01));
		
		fwrite($rcon, $cmdmsg);
		$answer = fread($rcon, 102400);
		
		if ( strToHex(substr($answer, 9, 1)) == "0"){
			$count = strToHex(substr($answer, 10, 1));
			//echo $count."<br/>";
			for ($i = 0; $i < $count-1; $i++){
				$answer .= fread($rcon, 102400);
			}
		}
		//echo strToHex(substr($answer, 0, 16))."<br/>";
		//echo strToHex($answer)."<br/>";
		//echo $answer."<br/>";
		$cmd = "Exit";
		$cmd = $cmdhead.$cmd;
		$checksum = get_checksum($cmd);
		$cmdmsg = $head.$checksum.$cmd;
		fwrite($rcon, $cmdmsg);
	}

	return $answer;
}


?>

warning.php

<?php

	include("rcon.php");
	include("config.php");
	
	$msg = $argv[1];
	$cmd = "say -1 $msg";
	rcon($serverip,$serverport,$rconpassword,$cmd);

?>
called from a crontab entry:

php -q /home/epoch/arma3/restarter/warning.php "RESTART WARNING Server restarting in 20 minutes"
30 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/epoch/arma3/restarter/warning.php "RESTART WARNING Server restarting in 30 minutes"
50 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/epoch/arma3/restarter/warning.php "RESTART WARNING Server restarting in 10 minutes"
55 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/epoch/arma3/restarter/warning.php "RESTART WARNING Server restarting in 5 minutes"
58 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/epoch/arma3/restarter/warning.php "RESTART WARNING Server restarting in 2 minutes"
59 1,3,5,7,9,11,13,15,17,19,21,23 * * * php -q /home/epoch/arma3/restarter/warning.php "RESTART WARNING Server restarting in 1 minute"
0  0,2,4,6,8,10,12,14,16,18,20,22 * * * ./home/epoch/arma3/epoch_linux_startscript.sh restart

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Advertisement
  • Supporters
  • Discord

×
×
  • Create New...