Beta 42

Research and Development

Menu

Deploy Filerun Server on Ubuntu 19.10

This guideline was prepared for Ubuntu 19.10 Server, but should work for 18.04 LTS as well.

Server Preparation

Download Ubuntu 19.10 Server and burn the ISO onto a USB stick. Install it using a static IP address.

If deployed on a laptop, it is possible that power management would need to be configured.

Next, configure ssh access with crypto keys and UFW.

Configure the MOTD and set the server timezone if needed.

Next, setup a LAMP stack on the server and secure the MySQL server.

Make sure to alter your MySQL user with native password:

ALTER USER 'user'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';

Finally, setup Apache Virtual Hosts using /var/www/filerun/ as the directory for FileRun and https access via Certbot by Let's Encrypt.

Install ionCube

Go to ionCube Loaders page to locate the latest version for your architecture.

wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz

Extract the archive:

tar xvfz ioncube_loaders_lin_x86-64.tar.gz

This creates a directory named ioncube which contains various files for various PHP versions. Choose the right folder for your PHP version. In our example, we need the file PHP version 7.3, which is ioncube_loader_lin_7.3.so.

Copy this file to the PHP extensions folder:

sudo cp ioncube/ioncube_loader_lin_7.3.so /usr/lib/php/20180731/

For PHP to load the extension, we need to add it to the PHP configuration. We can do it in the main php.ini PHP configuration file, but it’s cleaner to create a separate file. We can set this separate file to load before other extensions to avoid possible conflicts.

Create a file named 00-ioncube.ini inside the /etc/php/7.3/apache2/conf.d directory. The 00 at the beginning of the filename ensures this file will be loaded before other PHP configuration files.

sudo vim /etc/php/7.3/apache2/conf.d/00-ioncube.ini

Paste the following loading directive, then save and close the file.

zend_extension = "/usr/lib/php/20180731/ioncube_loader_lin_7.3.so"

Restart Apache to implement your changes:

sudo systemctl restart apache2

Configure PHP

The following command will install the PHP modules needed by FileRun:

sudo apt-get install php-mbstring php-zip php-curl php-gd php-ldap php-xml

With ionCube installed, let's create a file which will automatically get appended by PHP to its configuration. This will include all the settings needed by FileRun.

sudo vim /etc/php/7.3/apache2/conf.d/filerun.ini

Paste the following inside the created file:

error_reporting          = E_ALL & ~E_NOTICE
display_errors           = Off
display_startup_errors   = Off
log_errors               = On
error_log                = "${APACHE_LOG_DIR}/php_error.log"
ignore_repeated_errors   = Off
allow_url_fopen          = On
allow_url_include        = Off
variables_order          = "GPCS"
allow_webdav_methods     = On
memory_limit             = 128M
max_execution_time       = 300
output_buffering         = Off
output_handler           = ""
zlib.output_compression  = Off
zlib.output_handler      = ""
safe_mode                = Off
register_globals         = Off
magic_quotes_gpc         = Off
date.timezone            = "UTC"
file_uploads             = On
upload_tmp_dir           = /var/cloud_files/temp/
upload_max_filesize      = 20M
post_max_size            = 20M
enable_dl                = Off
disable_functions        = ""
disable_classes          = ""
session.save_handler     = files
session.use_cookies      = 1
session.use_only_cookies = 1
session.auto_start       = 0
session.cookie_lifetime  = 0
session.cookie_httponly  = 1
session.cookie_secure    = 1

Find the latest FileRun recommended PHP settings here: http://docs.filerun.com/php_configuration

Create the FileRun folders:

sudo mkdir /var/cloud_files/
sudo mkdir /var/cloud_files/temp/
sudo mkdir /var/cloud_files/users/
sudo chown www-data:www-data -R /var/cloud_files/

Install ImageMagick, GraphicsMagick, ffmeg, stl-thumb, pngquant

Instal ImageMagick with apt:

sudo apt install imagemagick

Instal Imagick PHP Extension:

sudo apt install php-imagick

Install ffmpeg:

sudo apt install ffmpeg

Install GraphicsMagick:

sudo apt install graphicsmagick

Download the latest stl-thumb package:

wget https://github.com/unlimitedbacon/stl-thumb/releases/download/v0.3.1/stl-thumb_0.3.1_amd64.deb
sudo apt install ./stl-thumb_0.3.1_amd64.deb

Install pngquant:

sudo apt install pngquant

Restart Apache to implement your changes:

sudo systemctl restart apache2

Instal FileRun

Download FileRun:

sudo wget -O FileRun.zip http://www.filerun.com/download-latest

Install unzip:

sudo apt-get install unzip

Extract the downloaded FileRun archive:

sudo unzip FileRun.zip -d /var/www/filerun/

Set ownership:

sudo chown www-data:www-data -R /var/www/filerun/

Open your browser and point it to the server IP or the FQDN, as per your config.

From there, you just have to follow the web installer, which will help you get FileRun running with just a few clicks.