Client node environment setup - johnkeates/PufferPanel GitHub Wiki

On your node server, where you will be using the minecraft servers:

###1. Install all dependencies:

Note: make sure you have wheezy-backports enabled, otherwise you won't have a useful nodejs source!

####1.1. Packages

Almost everything can be installed from the official repositories. To do so, execute:

sudo apt-get install \
git postfix denyhosts zip \
openssl curl git rssh quota unzip \
nodejs-legacy build-essential pwgen

If you have any of those packages already installed, apt wil simply ignore your request for that specific package but still install the rest.

####1.2. NPM

Install npm using:

curl https://www.npmjs.org/install.sh | sudo sh

You need npm for GSD later on. NPM is not in the official Debian repositories.

####1.3. Notes and Explanations for the sections above

This installs everything you need for your client node, including Postfix for email support and nodejs for javascript applications, quota for user quotas and build-essential for the upcoming steps.

Additionally, it sets you up with some developer tools and it also installs DenyHosts which uses TCPWrappers's /etc/hosts.deny to blacklist brute forcing hostst on the fly so SSH break-ins are a a lot harder.

####1.4. Oracle JRE

Since minecraft requires Java, it makes sense to install a quality Java Runtime. Let's take the one made by Oracle. In order to make this support system defaults and updates, use the webupd8team repository:

su - # echo needs root, you can use sudo su too
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
apt-get update
exit

This sets you up with a respository that allows you to install Oracle's Java from the system package managers. To do so:

sudo apt-get install oracle-java7-installer

If you had a different JVM installed, execute this to make Oracle Java the default JVM Runtime:

sudo apt-get install oracle-java7-set-default

All of these commands are for Java 7. If you want to install a different version, subsitute the 7 with the version you want (and make sure it exist in the repo, or it simply won't do anything)

###2. Setup the node environment

####2.1. SRV Directories First, setup a few directories you're going to need:

sudo mkdir /srv/scripts
sudo mkdir /srv/servers
sudo mkdir /srv/modpacks

####2.2. SSHD and RSSH Configure sshd by executing:

sudo nano /etc/ssh/sshd_config

and apply these steps to set sftp to use the internal command:

  • Comment out (by adding a hash mark in front of the line (#)):

    Subsystem sftp /usr/lib/openssh/sftp-server

  • Insert (above or below that line):

    Subsystem sftp internal-sftp

  • Set the rssh group to sftp-only by adding this to the end of the file:

Match Group rsshusers
    ChrootDirectory /srv/servers/%u
    X11Forwarding no
    AllowTcpForwarding no
    ForceCommand internal-sftp

Save by pressing Control+X, Y, Enter

Next, configure RSSH:

sudo addgroup rsshusers
sudo nano /etc/rssh.conf

Inside the configuration file, remove the hash mark (#) in front of allowsftp to enable sftp. To save press Control+X, press Y, press Enter

With RSSH and SSHD done, lets get some other services set-up:

####2.3. GSD Install gsd by moving to the srv directory and cloning it from the repo using git:

cd /srv/ && sudo git clone https://github.com/gametainers/gsd.git

Then install it using a restricted user:

sudo chown -R www-data:www-data /srv/gsd
sudo chmod -R 0775 /srv/gsd
cd /srv/gsd; sudo npm install; cd ~

####2.4. CPULimit Now, setup cpulimit, with the following commands:

git clone https://github.com/DaneEveritt/cpulimit.git
cd cpulimit
make
sudo cp cpulimit /usr/local/sbin/

you cannot use a pre-packaged version, you need this custom one.

####2.5. Finished and next steps

This concludes the environment setup phase.

Continue on to the PufferPanel Client node setup to setup the actual panel for your node.