Skip to content

Setup on Ubuntu 14.04.5 Desktop 64bit

Κοῖος edited this page Mar 10, 2017 · 3 revisions

This is just an unsupported log of how I personally set it up without any warranties.

Apache Installation

sudo apt update
sudo apt install apache2

sudo apt install mysql-server php5-mysql
sudo mysql_install_db
sudo mysql_secure_installation

sudo apt install php5 libapache2-mod-php5 php5-mcrypt php5-sqlite php-soap
sudo vim /etc/apache2/mods-enabled/dir.conf
  Move index.php to first position
sudo service apache2 restart

sudo chown -R <username> /var/www/html/

Test Apache Setup

vim /var/www/html/info.php
<?php
phpinfo();
?>

Afterwards remove script, since its information is not intended for unauthorized users rm /var/www/html/info.php

Legion Tools Setup

Official Manual: https://docs.google.com/document/d/11vp6dlF25ueVTyaW7FEw6pXfWPrPHI2SCZCp73tth7M/edit#

Can get own IP with: ip addr show eth0 | grep inet | awk '{ print $2; }' | sed 's//.*$//' Or via external service (might only give IPv6): curl http://icanhazip.com Note: To open IPv6 in Firefox use square brackets

cd /var/www/html/LegionTools

Copy LegionTools to /var/www/html Change baseURL in config.php to address:

vim config.php
  $baseURL = "https://<IP>/LegionTools";

Similarly, update location for getTimeWaited.php in Retainer/scripts/vars.js

vim ./Retainer/scripts/vars.js

mkdir db
chmod -R 777 db

Note: This last command is currently wrong in the manual (-r instead of -R).

Enable SSL

LegionTools will only work with SSL enabled and if the above domains are also https.

sudo a2enmod ssl
sudo service apache2 restart

Create key and certificate

sudo mkdir /etc/apache2/ssl
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

sudo vim /etc/apache2/sites-available/default-ssl.conf

2 Modifications:

  • Header becomes
                ServerAdmin <email>
                ServerName <address without www>
                ServerAlias www.<address without www>

                DocumentRoot /var/www/html
  • SSL lines become
                SSLCertificateFile      /etc/apache2/ssl/apache.crt
                SSLCertificateKeyFile /etc/apache2/ssl/apache.key
sudo a2ensite default-ssl.conf
sudo service apache2 restart

Now you can open https://<IP>/LegionTools and use the program.

Setup Debugging and IDE

This assumes that PHP and the web server were set up as described in the following steps. I will use the in my opinion best IDE PhpStorm that is available from Jetbrains (who offer free academic licenses at the time of writing).

Install XDebug

sudo apt-get install php5-xdebug
sudo vim /etc/php5/apache2/php.ini

Add the following:

[xdebug]
zend_extension="/usr/lib/php5/20121212/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_host=127.0.0.1
xdebug.remote_port=9000
xdebug.idekey=PHPSTORM

Run sudo service apache2 restart

Configure WebStorm

Get Jetbrains IDE Support for Chrome: https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji Note: On Ubuntu 14.04 I had to use Chromium (which is better anyways) for it to work, i.e. sudo apt install chromium-browser Either get bookmarklet or browser extension:

Start listening for debug session by clicking on telephone icon with bug and stop sign.

Debug Configuration

Go into Run -> Edit Configurations... Select "JavaScript Debug", click on green plus button, enter URL (http://localhost/LegionTools/index.php) and name, e.g. "Debug LegionTools JS", click "OK". If web server is running you can now click on Bug next to combo box saying "Debug LegionTools JS".

In Chrome, click bug icon of PHP debug extension, select "Debug". Bug will turn green. Alternatively, use bookmarklet to start debugger. You might want to add XDEBUG_SESSION_START parameter to URL in run configuration to start both debugs automatically, i.e. http://localhost/LegionTools/index.php?XDEBUG_SESSION_START=phpstorm

This should provide a decent development environment. I will now go back to tackling the core tasks.

Clone this wiki locally