Install/Multicraft and Minecraft Server: Difference between revisions

From Playful Exploration
Jump to navigation Jump to search
Line 248: Line 248:
     permit
     permit
  policy-spf_time_limit = 3600s
  policy-spf_time_limit = 3600s
And add this to the end:
# DKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345


  nano /etc/postfix/master.cf
  nano /etc/postfix/master.cf
Line 303: Line 310:
     group = postfix
     group = postfix
   }
   }
Install DomainKeys Identified Mail (DKIM)
apt-get install opendkim opendkim-tools
nano /etc/opendkim.conf
Add these:
KeyTable          /etc/opendkim/KeyTable
SigningTable      /etc/opendkim/SigningTable
ExternalIgnoreList /etc/opendkim/TrustedHosts
InternalHosts      /etc/opendkim/TrustedHosts
LogWhy yes
Then:
mkdir /etc/opendkim
nano /etc/opendkim/TrustedHosts
Enter all domains, hostnames or IP addresses
127.0.0.1
localhost
playfulexploration.com
158.69.197.154
nano /etc/default/opendkim
Uncomment:
SOCKET="inet:12345@localhost" # listen on loopback on port 12345
Generate the pair of public/private keys:
mkdir -p /etc/opendkim/keys/playfulexploration.com
cd /etc/opendkim/keys/playfulexploration.com
opendkim-genkey -s default -d playfulexploration.com
chown opendkim:opendkim default.private
echo 'default._domainkey.playfulexploration.com mydomain.com:default:/etc/opendkim/keys/playfulexploration.com/default.private' >/etc/opendkim/KeyTable
echo 'playfulexploration.com default._domainkey.playfulexploration.com' >/etc/opendkim/SigningTable
cat /etc/opendkim/keys/playfulexploration.com/default.txt
The output needs to be added as an DNS entry of type TXT:
default._domainkey      IN      TXT    ( "v=DKIM1; k=rsa; "
          "p=MIG...QAB" )  ; ----- DKIM key default for playfulexploration.com

Revision as of 09:50, 2 January 2016

Install Multicraft on Debian 8

Prepare

Open SSH shell. Elevate yourself to super user

   su -

Update all existing software to latest

   apt-get -y update
   apt-get -y upgrade


Install the apache2 web server

Note: Don't need this when installing Nginx as shown further below.

See also: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-debian-8

   apt-get -y install apache2 libapache2-mod-php5 php5-sqlite php5-gd
   apt-get -y install zip unzip
   service apache2 restart

At this point the web server is running. Web browser should show a default page.

Install Java from Oracle

   echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee /etc/apt/sources.list.d/webupd8team-java.list
   echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu trusty main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
   apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
   apt-get update
   apt-get -y install oracle-java8-installer


Install Multicraft

   wget http://www.multicraft.org/download/linux64 -O multicraft.tar.gz
   tar xvzf multicraft.tar.gz
   cd multicraft
   ./setup.sh               #follow the instructions, defaults are ok except for
                            #the web path use /var/www/html

Complete the browser based installation as instructed.

Hide the 'protected' folder, this download test shall fail: http://158.69.197.154/multicraft/protected/data/panel/schema.mysql.sql

   nano /etc/apache2/sites-enabled/000-default.conf

Add a section for /var/www/html

   <Directory /var/www/html>
       Options -Indexes +FollowSymLinks +MultiViews
       AllowOverride All
       Order allow,deny
       allow from all
   </Directory>

Restart apache:

   service apache2 restart
   # Navigate to http://yourserver/multicraft/setup.php and run the installer.

Start Multicraft:

   /home/minecraft/multicraft/bin/multicraft -v start

If all looks good then delete the setup.php file as instructed.

   rm /var/www/html/multicraft/setup.php


Fix the BukGet list by fixing some php files

   cd /var/www/html/multicraft/
   wget http://multicraft.org/files/bg_update_2014.02.zip
   unzip bg_update_2014.02.zip
   rm bg_update_2014.02.zip


Make Multicraft auto start after reboot

   nano /etc/rc.local

Add this to the end of the file before the exit(0) command:

   /home/minecraft/multicraft/bin/multicraft -v start


Create a server and add the craftbukkit plugins if choice

...


Add Group Manager

This manually adds the the group permissions plugin which doesn't come with the multicraft repository. See http://wiki.ess3.net/wiki/Group_Manager.

   cd /home/minecraft/multicraft/servers/server4/plugins/  # change server4 to actual server location
   wget https://github.com/essentials/Essentials/releases/download/gm-final/EssentialsGroupManager.jar
   chown mc4:mc4 EssentialsGroupManager.jar  # change mc4 to match the user of the other jar files
   chmod 770 EssentialsGroupManager.jar

Using multicraft restart the mc server. This will create a GroupMananger directory in the plugins folder.

   cd /home/minecraft/multicraft/servers/server4/plugins/  # change server4 to actual server location
   cd GroupManager/
   rm globalgroups.yml
   wget https://raw.githubusercontent.com/essentials/Essentials/release/EssentialsGroupManager/src/globalgroups.yml
   chown mc4:mc4 globalgroups.yml    # change mc4 to match the user of the other jar files
   cd worlds/world/
   rm groups.yml
   wget https://raw.githubusercontent.com/essentials/Essentials/release/EssentialsGroupManager/src/groups.yml
   
   chmod 770 *.jar
   chown mc4:mc4 *                   # change server4 to actual server location
   cd /home/minecraft/_
   # rm *
   wget http://dev.bukkit.org/media/files/780/922/Essentials.zip
   wget http://dev.bukkit.org/media/files/780/921/Essentials-extra.zip
   unzip Essentials.zip
   unzip Essentials-extra.zip
   rm EssentialsProtect.jar   # this one prevents deleting block, not sure why, so remove it for now
   chmod 770 *.jar
   chown mc4:mc4 *                   # change server4 to actual server location
   mv *.jar /home/minecraft/multicraft/servers/server4/plugins/


Install spigot essentials

See http://www.instructables.com/id/How-to-install-Essentials-18-for-BukkitSpigot/?ALLSTEPS

   cd /home/minecraft/multicraft/servers/server4/plugins/  # change server4 to actual server location
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/Essentials/target/Essentials-2.x-SNAPSHOT.jar -O Essentials-2.jar
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsSpawn/target/EssentialsSpawn-2.x-SNAPSHOT.jar -O EssentialsSpawn.jar
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsAntiBuild/target/EssentialsAntiBuild-2.x-SNAPSHOT.jar -O EssentialsAntiBuild.jar
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsChat/target/EssentialsChat-2.x-SNAPSHOT.jar -O EssentialsChat.jar
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsGeoIP/target/EssentialsGeoIP-2.x-SNAPSHOT.jar -O EssentialsGeoIP.jar
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsProtect/target/EssentialsProtect-2.x-SNAPSHOT.jar -O EssentialsProtect.jar
   wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsXMPP/target/EssentialsXMPP-2.x-SNAPSHOT.jar -O EssentialsXMPP.jar
   # wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsGeoIP/target/original-EssentialsGeoIP-2.x-SNAPSHOT.jar -O original-EssentialsGeoIP.jar
   # wget https://hub.spigotmc.org/jenkins/job/Spigot-Essentials/lastSuccessfulBuild/artifact/EssentialsXMPP/target/original-EssentialsXMPP-2.x-SNAPSHOT.jar -O original-EssentialsXMPP.jar


Add BuyCraft

See https://server.buycraft.net/setup.

   cd /home/minecraft/multicraft/servers/server4/plugins/  # change server4 to actual server location
   wget http://dev.bukkit.org/media/files/900/161/Buycraft.jar

past this into the mc console

   /buycraft secret 786d18a6060ac247667d9380f550202452e7e8f8
   

Install LEMP, linux nginx mysql php

See: https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-debian-7 See: http://stackoverflow.com/questions/25591040/nginx-serves-php-files-as-downloads-instead-of-executing-them

   apt-get update
   apt-get install mysql-server    #leave passwords blank
   mysql_install_db
   /usr/bin/mysql_secure_installation
   apt-get install nginx-full
   service nginx start
   nano /etc/nginx/sites-available/default

look for:

   [...]
   server {
       listen   80;

add index.php to index

   index index.php index.html index.htm;

change the server name to server name or ip

   server_name m.chaospage.com;

Change the "location ~ \.php$ {" section, uncomment include snippets/fastcgi-php.conf

   location ~ \.php$ {
     try_files $uri =404;
     fastcgi_pass unix:/var/run/php5-fpm.sock;
     fastcgi_index index.php;
     fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
     include fastcgi_params;

also protect the multicraft protected folder

   location /multicraft/protected {
       deny all;
       return 404;
   }

Install and Configure PHP

   apt-get install php5-fpm php5-mysql
   nano /etc/php5/fpm/php.ini  # origin suggests to set cgi.fix_pathinfo=0
   echo '<?php phpinfo(); ?>' > /var/www/html/phpinfo21.php

Navigate to http://m.chaospage.com/phpinfo21.php to enure the php page runs correctly


Install MediaWiki, on a Nginx Server

See: http://technology.mattrude.com/2012/02/configuring-mediawiki-to-be-used-with-nginx/

Install Postfix and Dovecot as smtp/imap mail server

See: https://scaron.info/blog/debian-mail-postfix-dovecot.html

apt-get install postfix postfix-policyd-spf-python
# chose 'Internet Site'
# chose playfulexploration.com
/etc/postfix/main.cf

Change smtpd_tsl.. values:

smtpd_tls_cert_file =/etc/letsencrypt/live/playfulexploration.com/cert1.pem
smtpd_tls_key_file  =/etc/letsencrypt/live/playfulexploration.com/privkey1.pem
smtpd_tls_CAfile    =/etc/letsencrypt/live/playfulexploration.com/chain1.pem
smtpd_use_tls=yes
smtpd_tls_auth_only=yes
# Mail will be stored in users ~/mail directories
home_mailbox = mail/
# From http://wiki2.dovecot.org/HowTo/PostfixAndDovecotSASL
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

Also change the smtpd_recipient_restrictions and add policy-spf_time_limit:

smtpd_recipient_restrictions =
   permit_sasl_authenticated,
   reject_invalid_hostname,
   reject_unknown_recipient_domain,
   reject_unauth_destination,
   reject_rbl_client sbl.spamhaus.org,
   check_policy_service unix:private/policy-spf,
   check_sender_access hash:/etc/postfix/sender_access,
   check_recipient_access hash:/etc/postfix/recipient_access,
   permit
policy-spf_time_limit = 3600s

And add this to the end:

# DKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345
nano /etc/postfix/master.cf

uncomment the lines starting with #submission and #smtps:

submission inet n       -       -       -       -       smtpd
 -o syslog_name=postfix/submission
 -o smtpd_tls_security_level=encrypt
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_reject_unlisted_recipient=no
 -o smtpd_client_restrictions=$mua_client_restrictions
 -o smtpd_helo_restrictions=$mua_helo_restrictions
 -o smtpd_sender_restrictions=$mua_sender_restrictions
 -o smtpd_recipient_restrictions=
 -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
 -o milter_macro_daemon_name=ORIGINATING
smtps     inet  n       -       -       -       -       smtpd
 -o syslog_name=postfix/smtps
 -o smtpd_tls_wrappermode=yes
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_reject_unlisted_recipient=no
 -o smtpd_client_restrictions=$mua_client_restrictions
 -o smtpd_helo_restrictions=$mua_helo_restrictions
 -o smtpd_sender_restrictions=$mua_sender_restrictions
 -o smtpd_recipient_restrictions=
 -o smtpd_relay_restrictions=permit_sasl_authenticated,reject
 -o milter_macro_daemon_name=ORIGINATING

Also, add the following line at the bottom of the file:

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=email:email argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
policy-spf  unix  -       n       n       -       -       spawn
  user=nobody argv=/usr/bin/policyd-spf

Install Dovecot for IMAP

apt-get install dovecot-common dovecot-imapd
nano /usr/share/dovecot/conf.d/10-ssl.conf

Set:

ssl = required
ssl_ca = </etc/letsencrypt/live/playfulexploration.com/chain1.pem
ssl_cert = </etc/letsencrypt/live/playfulexploration.com/cert1.pem
ssl_key = </etc/letsencrypt/live/playfulexploration.com/privkey1.pem

Then:

nano /usr/share/dovecot/conf.d/10-master.conf

Uncomment and change this section:

service auth {
  ...
  # Postfix smtp-auth
  unix_listener /var/spool/postfix/private/auth {
    mode = 0660
    user = postfix
    group = postfix
 }

Install DomainKeys Identified Mail (DKIM)

apt-get install opendkim opendkim-tools
nano /etc/opendkim.conf

Add these:

KeyTable           /etc/opendkim/KeyTable
SigningTable       /etc/opendkim/SigningTable
ExternalIgnoreList /etc/opendkim/TrustedHosts
InternalHosts      /etc/opendkim/TrustedHosts
LogWhy yes

Then:

mkdir /etc/opendkim
nano /etc/opendkim/TrustedHosts

Enter all domains, hostnames or IP addresses

127.0.0.1
localhost
playfulexploration.com
158.69.197.154
nano /etc/default/opendkim

Uncomment:

SOCKET="inet:12345@localhost" # listen on loopback on port 12345

Generate the pair of public/private keys:

mkdir -p /etc/opendkim/keys/playfulexploration.com
cd /etc/opendkim/keys/playfulexploration.com
opendkim-genkey -s default -d playfulexploration.com
chown opendkim:opendkim default.private
echo 'default._domainkey.playfulexploration.com mydomain.com:default:/etc/opendkim/keys/playfulexploration.com/default.private' >/etc/opendkim/KeyTable
echo 'playfulexploration.com default._domainkey.playfulexploration.com' >/etc/opendkim/SigningTable
cat /etc/opendkim/keys/playfulexploration.com/default.txt

The output needs to be added as an DNS entry of type TXT:

default._domainkey      IN      TXT     ( "v=DKIM1; k=rsa; "
         "p=MIG...QAB" )  ; ----- DKIM key default for playfulexploration.com