For an alternative using NGINX, use this tutorial.
In this tutorial, we will install a FileRun instance on an Ubuntu 20 server running Apache, MySQL and PHP. We will also configure the server with an SSL certificate and install any third-party software FileRun might make use of, so that you can enjoy all FileRun features on a secure server.
Before you begin this tutorial you will need an Ubuntu 20 server, with Apache, MySQL and PHP.
Please follow this tutorial to set the prerequisites up: How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 20.04 You can stop before the step number 4 (Creating a Virtual Host for your Website) as the remaining steps are not required for the goal of this guide.
The MySQL server should be now ready for creating our FileRun database and the user account which will access it.
To get started, log into MySQL with the root account:
1sudo mysql
While you can name your FileRun database whatever you prefer, we will be
using the name filerun
for this example.
1CREATE DATABASE filerun;
Next, create a separate MySQL user account that will manage the newly
created database. Creating one-function databases and accounts is a good
idea from a management and security standpoint. As with the naming of
the database, choose a username that you prefer. We chose to go with the
name filerun
for this guide.
1CREATE USER 'filerun'@'localhost' IDENTIFIED BY 'YOUR-DB-PASSWORD';
Note: Be sure to put an actual password where the command states: YOUR-DB-PASSWORD
Now grant all privileges to the user on the newly created database:
1GRANT ALL ON filerun.* TO 'filerun'@'localhost';
With the user assigned access to the database, perform the flush-privileges operation to ensure that the running instance of MySQL knows about the recent privilege assignment:
1FLUSH PRIVILEGES;
This concludes the configuration of MySQL, therefore we will quit the session by typing:
1exit
Make a note of the database name filerun
, the username filerun
and
the password YOUR-DB-PASSWORD
as we will need this information again
shortly.
The following command will install the PHP modules needed by FileRun:
1sudo apt-get install php-mbstring php-zip php-curl php-gd php-ldap php-xml php-imagick php-mysql
One last module which needs manual installation is ionCube
:
Download the package (Linux 64 bit):
1sudo wget https://downloads.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz
And extract it
1sudo tar -xzf ioncube_loaders_lin_x86-64.tar.gz -C /usr/lib/php
Now, let's load PHP with the downloaded extension:
1sudo vim /etc/php/7.4/apache2/conf.d/00-ioncube.ini
And paste the following inside:
1zend_extension = /usr/lib/php/ioncube/ioncube_loader_lin_7.4.so
With the ionCube extension 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.
1sudo vim /etc/php/7.4/apache2/conf.d/filerun.ini
Paste the following inside the created file:
1expose_php = Off
2error_reporting = E_ALL & ~E_NOTICE
3display_errors = Off
4display_startup_errors = Off
5log_errors = On
6ignore_repeated_errors = Off
7allow_url_fopen = On
8allow_url_include = Off
9variables_order = "GPCS"
10allow_webdav_methods = On
11memory_limit = 128M
12max_execution_time = 300
13output_buffering = Off
14output_handler = ""
15zlib.output_compression = Off
16zlib.output_handler = ""
17safe_mode = Off
18register_globals = Off
19magic_quotes_gpc = Off
20upload_max_filesize = 20M
21post_max_size = 20M
22enable_dl = Off
23disable_functions = ""
24disable_classes = ""
25session.save_handler = files
26session.use_cookies = 1
27session.use_only_cookies = 1
28session.auto_start = 0
29session.cookie_lifetime = 0
30session.cookie_httponly = 1
31date.timezone = "UTC"
Note: You can find the latest FileRun recommended PHP settings here.
Finally, we need to restart Apache for the changes to take effect:
1sudo systemctl restart apache2
Your server now meets all the requirements and we can proceed with installing FileRun.
Clean the default files from the root folder of your webserver
(/var/www/html/
):
1cd /var/www/html/
2sudo rm index.html
3sudo rm info.php
Download FileRun:
Download the FileRun installation zip archive from the FileRun client account: https://my.filerun.com
Install unzip
:
1sudo apt-get install unzip
Extract the downloaded FileRun archive:
1sudo unzip FileRun.zip
Make Apache the owner of the folder so that it can make change:
1sudo chown -R www-data:www-data /var/www/html/
Open your browser and point it to http://YOUR-SERVER-IP
From here, you just have to follow the web installer, which will help you get FileRun running with just a few clicks.
From here you just have to follow the installer, which will help you get FileRun running with just a few clicks:
FileRun installer welcome screen
Click Next
to proceed. Review the server requirements check and make
sure there is no red error message:
FileRun server requirements check
Click Next
to proceed with the database connection setup:
Database name
you used at the step 2 of this tutorial:
filerun
MySQL user
: filerun
Password
: set_database_password
Next
FileRun database connection setup
You will be presented with the following screen, letting you know that FileRun has been successfully installed:
FileRun successful installation
Warning: Make sure you made a copy of the username and password displayed on the screen, before proceeding. The password is being randomly generated at this step. Do not use the password from this tutorial screenshot, it won't work on your installation.
Click Next
to open FileRun. You should see the login page:
FileRun login page
The form should be prefilled so you can just hit Sign in
.
As soon as you sign into FileRun you will be prompted to change the password. Although the automatically generated password is quite secure, it's still a good idea to set your own.
Warning: The FileRun superuser is the only account not protected against brute force login attacks, so it is very important that you set a password that cannot be guessed by a computer. Set a long password, containing also uppercase letters, digits and symbols.
Sign in as FileRun superuser, open the control panel and select the
Software update
option, click the Check for updates
and install
eventual available updates. This will make sure you are running the
latest available FileRun version.
The permissions of the FileRun application files should not allow PHP (or any other web server application) to make changes to them:
1sudo chown -R root:root /var/www/html
The system/data
FileRun folder is the only folder where PHP needs
write access.
1sudo chown -R www-data:www-data /var/www/html/system/data
Now let's set the FileRun superuser's home folder. It is important that
the home folder path is pointing to a folder which is located outside
the public area of your web server (i.e. outside /var/www/html
). You
could create a folder /files
and store all the FileRun files in there:
1sudo mkdir /files
2sudo chown www-data:www-data /files
Connect to the MySQL server as root again:
1sudo mysql
Update the configured MySQL user account and remove the ALTER
and
DROP
privileges.
1REVOKE ALTER, DROP ON filerun.* FROM 'filerun'@'localhost';
2FLUSH PRIVILEGES;
3exit
Note: You will need to add these permissions back before you will be installing any FileRun software update in the future. To do that, connect again to the database server and runt the following commands:
1GRANT ALTER, DROP ON filerun.* TO 'filerun'@'localhost';
2FLUSH PRIVILEGES;
3exit;
For generating thumbnails for image files, photography files and even PDF documents, install ImageMagick like this:
1sudo apt-get install imagemagick
And enable it inside FileRun from the control panel, under the
Configuration
→ Interface
→ Thumbnails and preview
section, by
setting ImageMagick support
's Mode
to IMagick PHP Extension
. Do
press the Check version
button to make sure FileRun can use the
setting.
For generating thumbnails for video files install FFmpeg like this:
1sudo apt-get install ffmpeg
And enable it inside FileRun from the control panel, under the
System configuration
→ Files
→ Image preview
section, using the
path /usr/bin/ffmpeg
.
This is highly recommended, to improve the security of your data and also to allow to access the FileRun API which the mobile apps use.
To proceed, please follow this tutorial: How To Secure Apache with Let's Encrypt on Ubuntu 20.04
mod_rewrite
is an Apache module used for URL manipulations. FileRun
needs this for certain features, such as opening a Microsoft Office
file directly in your local program, without downloading it first.
1sudo a2enmod rewrite
This will activate the module or alert you that the module is already in effect. To put these changes into effect, restart Apache:
1sudo apachectl restart
A .htaccess file allows us to have custom configuration, defined per folder, without having to edit the Apache main configuration files.
By default, Apache prohibits using a .htaccess
file, so first you
need to allow changes to the file. Open the default Apache configuration
file using nano
or your favorite text editor.
1sudo vim /etc/apache2/apache2.conf
Inside that file, you will find the block <Directory /var/www/>
.
Inside that block, make sure AllowOverride
is set to All
.
1<Directory /var/www/>
2 Options Indexes FollowSymLinks
3 AllowOverride All
4 Require all granted
5</Directory>
Save and close the file. To put these changes into effect, restart Apache.
1sudo systemctl restart apache2
You have now successfully deployed FileRun on a Ubuntu 20 server. It's time to upload your files, photos, music or work documents and start sharing.