How to Install FileRun on Ubuntu with Apache

This brief post shows students and new users how to install FileRun on Ubuntu Linux with Apache HTTP web server. It also has a link to setup free Let’s Encrypt SSL certificates to secure your FileRun web portal.

FileRun is a free and open source self-hosted file share and sync based on PHP and MySQL that allows you to access your files anywhere through a secure cloud storage, and also offers file backup and sharing for your photos, videos, files and more.

If you want to create a self-hosted file share and sync platform for your home or office, FileRun might be the simplest way to do it, especially if you will need platform that’s easy to manage.

This tutorial is based on Ubuntu Linux. We’ll be installing Apache web server, MariaDB database server and PHP modules. We’ll also link to another post that will show you how to secure your FileRun website using Let’s Encrypt free SSL certificates.

For more about FileRun, please check its homepage

To get started with installing FileRun on Ubuntu Linux, follow the steps below:

How to install Apache on Ubuntu Linux

As mentioned above, we’re going to be using Apache web server to run FileRun. FileRun requires a web server to function, and Apache is the most popular open source web servers available today.

To install Apache on Ubuntu, run the commands below:

sudo apt update
sudo apt install apache2

After installing Apache, the commands below can be used to stop, start and enable Apache services to always start up everytime your server starts up.

sudo systemctl stop apache2.service
sudo systemctl start apache2.service
sudo systemctl enable apache2.service

To test whether Apache is installed and functioning, open your web browser and browse to the server’s IP address or hostname.

If you see the above page in your browser, then Apache is working as expected.

How to install MariaDB on Ubuntu Linux

A database server is required for FileRun to function. FileRun stores its content in a database, and MariaDB is probably the best database server available to run FileRun.

MariaDB is fast, secure and the default server for almost all Linux servers. To install MariaDB, run the commands below:

sudo apt install mariadb-server
sudo apt install mariadb-client

After installing MariaDB, the commands below can be used to stop, start and enable MariaDB services to always start up when the server boots.

sudo systemctl stop mariadb.service
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

Next, run the commands below to secure the database server with a root password if you were not prompted to do so during the installation.

sudo mysql_secure_installation

When prompted, use the guide below to answer:

If you've just installed MariaDB, and haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): PRESS ENTER

Switch to unix_socket authentication [Y/n] n

Change the root password? [Y/n] n

Remove anonymous users? [Y/n] y

Disallow root login remotely? [Y/n] y

Remove test database and access to it? [Y/n] y

Reload privilege tables now? [Y/n] y

All done!

To verify and validate that MariaDB is installed and working, login to the database console using the commands below:

sudo mysql -u root -p

You should automatically be logged in to the database server since we initiated the login request as root. Only the root can login without password, and only from the server console.

mariadb welcome

If you see a similar screen as shown above, then the server was successfully installed.

How to install PHP on Ubuntu Linux

As we also mentioned above, we’re installing PHP on Ubuntu since FileRun requires it. PHP packages are added to Ubuntu repositories. The versions the repositories might not be the latest. If you need to install the latest versions, you’ll need to add a third party PPA repository.

To a third party repository with the latest versions of PHP, run the commands below.

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php

At the time of this writing, the latest PHP version 7.4.

sudo apt update

Next, run the commands below to install PHP 7.4 and related modules.

sudo apt install php7.4 php7.4-common php7.4-mysql php7.4-gmp php7.4-curl php7.4-intl php7.4-mbstring php7.4-xmlrpc php7.4-gd php7.4-xml php7.4-cli php7.4-zip

Next, you’ll want to change some PHP configuration settings that work great with FileRun. Run the commands below to open PHP default configuration file.

sudo nano /etc/php/7.4/apache2/conf.d/filerun.ini

Then copy the lines below and paste into the file above. Save your changes and exit.

expose_php              = Off  
error_reporting         = E_ALL & ~E_NOTICE  
display_errors          = Off  
display_startup_errors  = Off  
log_errors              = On  
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  
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  
date.timezone            = "UTC"

One last module which is required is ionCube. Run the steps below to install it and add it to PHP configurations as well.

Download the package for Ubuntu 64-bit.

sudo wget 

Next, run the commands below to extract it into the /usr/lib/php directory.

sudo tar -xzf ioncube_loaders_lin_x86-64.tar.gz -C /usr/lib/php

Then run the commands below to create a ioncube config file.

sudo nano /etc/php/7.4/apache2/conf.d/00-ioncube.ini

And paste the following line in the file and save.

zend_extension = /usr/lib/php/ioncube/

Save the file and exit.

With the ionCube extension installed, you can now continue with creating FileRun database and other configurations.

How to create FileRun database on Ubuntu

At this point, we’re ready to create FileRun database. As mentioned above, FileRun uses databases to store its content.

To create a database for FileRun, run the commands below:

sudo mysql -u root -p

Then create a database called filerun


Next, create a database user called filerunuser and set password

CREATE USER 'filerunuser'@'localhost' IDENTIFIED BY 'new_password_here';

Then grant the user full access to the database.

GRANT ALL ON filerun.* TO 'filerunuser'@'localhost' WITH GRANT OPTION;

Finally, save your changes and exit.


How to download FileRun on Ubuntu Linux

We’re ready to download FileRun and begin configuring it. First, run the commands below to download the latest version of FileRun from its repository.

Next, extract the downloaded content into a new folder called filerun.

cd /tmp
sudo wget -O 
sudo unzip -d /var/www/filerun

Then run command below to allow www-data user to own the new FileRun directory.

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

How to configure Apache for FileRun

We have downloaded FileRun content into a new folder we called FileRun. Now, let’s configure Apache to create a new server block to use with our FileRun website. You can create as many server blocks with Apache.

To do that, run the commands below to create a new configuration file called filerun.conf in the /etc/apache2/sites-available/ directory to host our FileRun server block.

sudo nano /etc/apache2/sites-available/filerun.conf

In the file, copy and paste the content below into the file and save.

<VirtualHost *:80>
  ServerAdmin [email protected]
  DocumentRoot /var/www/filerun
  <Directory /var/www/filerun/>
       Options FollowSymlinks
       AllowOverride All
       Require all granted

       ErrorLog ${APACHE_LOG_DIR}/error.log
       CustomLog ${APACHE_LOG_DIR}/access.log combined

Save the file and exit.

After saving the file above, run the commands below to enable the new file that contains our FileRun server block. Restart Apache after that.

sudo a2ensite filerun.conf
sudo systemctl restart apache2.service

At this stage, FileRun is ready and can be launched by going to the server’s IP or hostname.

You will see FileRun setup wizard.

However, we want to make sure our server is protected with Let’s Encrypt free SSL certificates. So, continue below to learn how to generate Let’s Encrypt SSL certificate for websites.

How to setup Let’s Encrypt for FileRun

We have written a great post on how to generate and manage Let’s Encrypt SSL certificates for Apache web server. You can use that post, to apply it here for your FileRun website.

To read the post on how to generate Let’s Encrypt SSL certificates for website, click on the link below:

How to Setup Let’s Encrypt on Ubuntu Linux with Apache – Website for Students

If you were successful in generating a Let’s Encrypt SSL certificate, you should then reopen the server block for our FileRun website by running the commands below.

sudo nano /etc/apache2/sites-available/filerun.conf

The new FileRun server blocks configurations should look similar to the line below. Take notes of the highlighted lines.

  • The first server block listens on port 80.  It contains a 301 redirect to redirect HTTP to HTTPS.
  • The second server block listens on port 443. It contains a 301 redirect to redirect www to non-www domain.
<VirtualHost *:80>

  Redirect permanent / 

<VirtualHost *:443>
  DocumentRoot /var/www/filerun

  Protocols h2 http:/1.1

  <If "%{HTTP_HOST} == ''">
    Redirect permanent / 
  ErrorLog ${APACHE_LOG_DIR}/
  CustomLog ${APACHE_LOG_DIR}/ combined

  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/
  SSLCertificateKeyFile /etc/letsencrypt/live/
  SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"

  SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
  SSLCompression off
  SSLUseStapling on

  Header always set Strict-Transport-Security "max-age=63072000"

  <Directory /var/www/filerun/>
       Options FollowSymlinks
       AllowOverride All
       Require all granted

Save the file above, then restart Apache and PHP using the commands below.

sudo systemctl reload apache2

Finally, if everything went as planned, you should be able to start FileRun setup wizard by browsing to the server hostname or IP address over HTTPS.

A FileRun setup wizard should appear. Follow the wizard to complete the setup.

Make sure all requirements are met.

You will need to know the following items before proceeding. Use the database connection info you created above.

  • Database name
  • Database username
  • Database password
  • Database host

Then, type in the database connection info and click Next

Take notes of the super admin account password.

Login and begin setting up your environment.

How to install ImageMagick and FFmpeg on Ubuntu Linux

For generating thumbnails for image files, photography files and even PDF documents, install ImageMagick.

sudo apt install imagemagick
sudo apt install ffmpeg

After installing FileRun, enable it inside FileRun from the control panel, under the System configuration > Files > Image preview section, using the path /usr/bin/ffmpeg.

Also enable ImageMagic in the control panel, under the Configuration > Interface > Thumbnails and preview section, by setting ImageMagick support’s Mode to IMagick PHP Extension

That should do it!


This post showed you how to install FileRun on Ubuntu Linux with link to setting up Let’s Encrypt. If you find any error above, or have something to add, please use the comment form below.