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

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

If you want to build a self-hosted file sharing and sync platform for your home or office, FileRun might be the easiest way to do it, especially if you need a platform that is easy to manage.

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

For more information on FileRun, see its Homepage

To start installing FileRun on Ubuntu Linux, follow the steps below:

How to install Apache on Ubuntu Linux

As mentioned above, we will use the Apache web server to run FileRun. FileRun requires a web server to function, and Apache is the most popular open source web server available today.

To install Apache on Ubuntu, run the following commands:

sudo apt update
sudo apt install apache2

After installing Apache, the following commands can be used to stop, start and enable Apache services always start every time your server starts.

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

To test if Apache is installed and working, open your web browser and look for the IP address or hostname of the server.

http://localhost
apache2 test page

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

How to install MariaDB on Ubuntu Linux

A database server is required for FileRun to work. 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 following commands:

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

After installing MariaDB, the following commands can be used to stop, start and enable MariaDB services always start when the server starts.

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

Then run the following commands to protect the database server with a root password if you were not prompted to do so during installation.

sudo mysql_secure_installation

When prompted, use the guide below to respond:

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, log into the database console using the following commands:

sudo mysql -u root -p

It should automatically log into the database server as we started the login request as root. Only root can login without password and only from server console.

YOU CAN ALSO READ:   How to install PostgreSQL on Ubuntu Linux
mariadb welcome

If you see a screen similar to the one shown above, then the server installed successfully.

How to install PHP on Ubuntu Linux

As we also mentioned earlier, we are installing PHP on Ubuntu as FileRun requires it. The PHP packages are added to the Ubuntu repositories. Repository versions may not be the latest. If you need to install the latest versions, you will need to add a third-party PPA repository.

In a third-party repository with the latest versions of PHP, run the following commands.

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

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

sudo apt update

Then run the following commands 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 settings that work great with FileRun. Run the following commands to open the default PHP configuration file.

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

Then copy the lines below and paste them 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 that is required is ionCube. Please run the steps below to install it and add it to the PHP configurations as well.

YOU CAN ALSO READ:   How to install Python on Ubuntu Linux

Download the package for Ubuntu 64-bit.

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

Then run the following commands to extract it to the / usr / lib / php directory.

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

Then run the following commands to create an ioncube configuration 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/ioncube_loader_lin_7.4.so

Save the file and close.

With the ionCube extension installed, you can now proceed with FileRun database creation and other settings.

How to create a FileRun database in Ubuntu

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

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

sudo mysql -u root -p

Then create a database called filerun

CREATE DATABASE filerun;

Next, create a database user named 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.

FLUSH PRIVILEGES;
EXIT;

How to download FileRun on Ubuntu Linux

We are ready to download FileRun and start configuring it. First, run the following commands to download the latest version of FileRun from your repository.

Then extract the downloaded content into a new folder called filerun.

cd /tmp
sudo wget -O FileRun.zip https://filerun.com/download-latest
sudo unzip FileRun.zip -d /var/www/filerun

Then run the 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 the contents of FileRun into a new folder that we call FileRun. Now, let’s configure Apache to create a new server block to use with our FileRun website. You can create so many server blocks with Apache.

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

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

In the archive, copy and paste the content below in the archive and save it.

<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com
  ServerAdmin admin@example.com
  DocumentRoot /var/www/filerun
    
  <Directory /var/www/filerun/>
       Options FollowSymlinks
       AllowOverride All
       Require all granted
  </Directory>

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

Save the file and close.

After saving the old file, run the following commands 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 started by going to the IP or hostname of the server.

http://example.com

You will see the FileRun setup wizard.

YOU CAN ALSO READ:   How to install Nextcloud on Ubuntu Linux with Nginx

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

How to configure Let’s Encrypt for FileRun

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

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

How to configure Let’s Encrypt on Ubuntu Linux with Apache

If you managed to generate a Let’s Encrypt SSL certificate, you need to reopen the server block for our FileRun website by running the following commands.

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

The new FileRun server block settings should look similar to the following line. Take notes on 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 a domain other than www.
<VirtualHost *:80>
  ServerName example.com
  ServerAlias www.example.com

  Redirect permanent / https://example.com/
</VirtualHost>

<VirtualHost *:443>
  ServerName example.com
  ServerAlias www.example.com
  DocumentRoot /var/www/filerun

  Protocols h2 http:/1.1

  <If "%{HTTP_HOST} == 'www.example.com'">
    Redirect permanent / https://example.com/
  </If>
  
  ErrorLog ${APACHE_LOG_DIR}/example.com-error.log
  CustomLog ${APACHE_LOG_DIR}/example.com-access.log combined

  SSLEngine On
  SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem
  SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem
  SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"
  
  SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384

  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
  </Directory>
 
</VirtualHost>

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

sudo systemctl reload apache2

Finally, if everything went according to plan, you should be able to start the FileRun setup wizard by navigating to the server’s hostname or IP address via HTTPS.

https://example.com/

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

install filerun on ubuntu

Make sure all requirements are met.

filerun ubuntu linux installation wizard

You will need to know the following items before proceeding. Use the database connection information that you created earlier.

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

Then enter your database connection information and click Next

filerun ubuntu linux database configuration

Make a note of the password for the super administrator account.

superadmin filerun account created

Log in and start setting up your environment.

filerun dashboard on ubuntu

You should do that!

Conclusion:

In this tutorial we have seen how to install FileRun on Ubuntu Linux with a link to configure Let’s Encrypt. If you find any errors above or have something to add, please use the comment form below.

Write A Comment