Jump to content
Sign in to follow this  
Sgt Pepper

Creating a Linux JKA Dedicated Server from scratch

Recommended Posts

Let's assume you just finished installing an operating system, and for the sake of this tutorial, that OS was Ubuntu 16.04 LTS.

 

1: Update repository lists and install the latest packages.

sudo apt update

sudo apt upgrade

sudo apt dist-upgrade

sudo apt autoremove

sudo apt install screen vim htop watch

 

1½) and make sure ssh is installed

sudo apt install ssh

sudo apt install sshd

 

(Optional) 2: Install webmin if you want to make some tasks easier: http://webmin.com/download.html

cd ~

sudo wget http://prdownloads.sourceforge.net/webadmin/webmin_1.870_all.deb

sudo dpkg -i webmin*

sudo apt -f install

 

Webmin will be at:

https://yourserveriporhostname:10000

 

3: Create users, groups, and folders for running the server(s)

sudo groupadd jka

sudo useradd -G jka jka1

sudo mkdir /home/jka

sudo mkdir /home/jka/jka1

 

Set jka1 home directory:

sudo usermod -d /home/jka/jka1 jka1

 

4: Download WinSCP on your desktop and upload the game to /home/jka/jka1 as if that was the GameData directory: https://winscp.net/eng/download.php

 

If you're trying to login as root and it isn't working then you'll need to make an edit to the sshd config:

sudo vi /etc/ssh/sshd_config

 

And make sure the following is set:

PermitRootLogin yes
 
Upload all the /base and server related files, you will want to upload 1.01 from this: https://jkhub.org/files/file/390-jedi-academy-dedicated-server-for-linux/
 
If you want to use OpenJK for security you get the latest *linux-64.tar.gz build of it from:
 
You upload it to the GameData folder:
/home/jka/jka1/
 
And extract the binaries:
sudo tar xvzf openjk*
 
(Optional): Upload the server mod of your choice. Ex. JA+ Server Side 2.4 Build 7: https://jkhub.org/files/file/953-ja-server-side/
You could just open the zip and drag and drop everything in there into /home/jka/jka1 using WinSCP.
Or you could upload the zip file and extract it.
sudo apt install unzip
sudo unzip japlus*
 
5: Once upload is finished, time to set the permissions:
sudo chmod 777 /home/jka
sudo chown -R jka1:jka /home/jka/jka1
 
Set the binaries so they can be executed:
sudo chmod a+x linuxjampded openjk.i386 openjk_sp.i386 openjkded.i386
 
6: You could now launch a server with one of the server files and a command line:
./linuxjampded +set net_port 29070 +set dedicated 2 +set fs_game base +exec server.cfg
./openjkded.i386 +set net_port 29070 +set dedicated 2 +set fs_game japlus +exec server.cfg
 
7: Let's say you want linuxjampded and the base game, so you can make a script to start that server up.
 
cd /home/jka/jka1
sudo vi jka1_start.sh
 
Press insert to copy into the file using right click:
./linuxjampded +set dedicated 2 +set net_port 29070 +set fs_game base +exec server.cfg

Press ESC, then colon : then wq and press enter to write and quit from the file.

 

Make it executable:

sudo chmod a+x jka1_start.sh

 

But this server will die once you close the shell, so you can use screen to keep it open:

screen -dmS jka1 ./jka1_start.sh
 
You can add a -L to the arguments if you want it to log all server activity to screen.log in the GameData folder:
screen -dmLS jka1 ./jka1_start.sh
 
You can then turn this into another script:
sudo vi jka1_screen.sh
screen -dmLS jka1_start ./jka1_start.sh

But the server could still crash, or maybe you're using auto-restart, so you can add a couple extra scripts to keep checking if your server's screen is running and start it if it isn't.

 

sudo vi jka1_autorestart.sh

screen -dmS jka1_restarter watch -n 5 /home/jka/jka1/jka1_restarter.sh

sudo vi jka1_restarter.sh

if ! screen -list | grep -q "jka1_server"; then
    screen -dmLS jka1_server ./jka1_start.sh
fi

And that last one will run whatever type of server you specified at the start of (7:) in jka1_start.sh

 

Edit the server.cfg in /base/ if you're running fs_game base or in /japlus/ or another mod folder if you're using one.

 

Just make sure you've set some master servers because you probably want to be on some lists:

 

seta sv_master1 "masterjk3.ravensoft.com"

seta sv_master2 "master.jkhub.org"
seta sv_master3 "master.qtracker.com"
seta sv_master4 "master0.gamespy.com"
seta sv_master5 "clanservers.net"
 
And make sure at some point the server launches the first map or the server won't start:
 
map mp/ffa3
 
As a final note I recommend running the latest OpenJK build with the latest (2.4b7) version of JA+ to get rid of the known exploits that can crash, overwrite, and delete your server, or allow someone to steal it from you. Set some good long passwords for rcon and the Linux server.
 
You can use the htop command in terminal to monitor your JKA server process.
 
I forgot some extra goodies I was going to post but I'll just edit it later.

Smoo likes this

Share this post


Link to post

Hello,

 

There is several security issues in your tutorial.

 

First one :

 

If you're trying to login as root and it isn't working then you'll need to make an edit to the sshd config:

sudo vi /etc/ssh/sshd_config

 

And make sure the following is set:

PermitRootLogin yes

 

Never do that if you use a password for root login, you have to use a ssh key and restrict ip allowed to connect to your server. In your tutorial if you want to be root just connect as standard user and do :

sudo -i

and you will be root.

If you need change the current user just do a :

su username

(it will prompt for password)

 

 

Second one :

 

 

sudo chmod 777 /home/jka

 

NEVER NEVER NEVER NEVER Do that. If you have permission troubles you have to think about :

 

Who need access (users, groups) what kind of access (write, read, execute) on which file.

 

example :

 

 

home/me/my-dir

-> my-exe

-> my-conf-file

 

you need (as user) the x perm for the exe so do :

chmod u+x /home/me/my-dir/my-exe

and the conf file should not be see or modify

chmod o-rw /home/me/my-dir/my-conf-file

 

In your tutorial this :

 

 

sudo chmod a+x linuxjampded openjk.i386 openjk_sp.i386 openjkded.i386

 

should be :

sudo chmod u+x linuxjampded openjk.i386 openjk_sp.i386 openjkded.i386

 

 

 

 

 

Some others improvement. If you need a new user.

 

do a :

sudo adduser nameOfuser

It create the home, the group, etc


Raz0r likes this

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...