How to Install FileRun on Ubuntu 22.04

FileRun is an open-source and web-based file-sharing application for Linux based operating system. It is very similar to Google Drive, iCloud, and DropBox and allows users to share and sync files over the internet. It can be accessed via mobile app, WebDAV, and web browser. It allows you to host your own file sharing solution on the cloud and access all your files anywhere via secure cloud storage.

This post will show how to install FileRun with Apache and Let's Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name pointed with your server IP.
  • A root password is configured on the server.

Install Apache, MariaDB, and PHP

FileRun is written in PHP and uses MariaDB as a database backend. So, you will need to install the Apache, MariaDB, PHP and other packages to your server. First, install the Apache and MariaDB package using the following command:

apt-get install apache2 mariadb-server mariadb-client

After installing both packages, you will need to install PHP version php7.2-php7.4 on your server. However, Ubuntu 22.04 ships with PHP 8.1 version in the default repository. So you will need to add the PHP Ondrej repository on your server.

First, install all the required dependencies using the following command:

apt install software-properties-common ca-certificates lsb-release apt-transport-https -y

Next, add the PHP repository using the following command:

add-apt-repository ppa:ondrej/php

Next, update the repository cache and install PHP with other required extensions using the following command:

apt update
apt install php7.4 libapache2-mod-php7.4 imagemagick ffmpeg php7.4-imagick php7.4-mysql php7.4-fpm php7.4-common php7.4-gd php7.4-json php7.4-curl php7.4-zip php7.4-xml php7.4-mbstring php7.4-bz2 php7.4-intl unzip -y

Once all the packages are installed, you will also need to install the IonCube loader to your system.

First, download the IonCube loader with the following command:

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

Next, extract the downloaded file with the following command:

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

Next, create a ioncube configuration file and define the path of the IonCube source:

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

Add the following line:

zend_extension = /usr/lib/php/ioncube/ioncube_loader_lin_7.4.so

Save and close the file, then create a PHP configuration file for FileRun:

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

Add the following settings:

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"

Save and close the file, then restart the Apache service to apply the changes:

systemctl reload apache2

Create a Database for FileRun

First, secure the MariaDB installation and set the root password using the following command:

mysql_secure_installation

Answer all the questions as shown below:

Enter current password for root (enter for none):  PRESS ENTER
Set root password? [Y/n] Y 
New password:  
Re-enter new password:  
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 

Next, log in to the MariaDB shell with the following command:

mysql -u root -p

Once you are log in, create a database and user with the following command:

MariaDB [(none)]> CREATE DATABASE filerun;
MariaDB [(none)]> CREATE USER 'filerun'@'localhost' IDENTIFIED BY 'password';

Next, grant all the privileges to the FileRun database with the following command:

MariaDB [(none)]> GRANT ALL PRIVILEGES ON filerun.* TO 'filerun'@'localhost';

Next, flush the privileges and exit from the MariaDB with the following command:

MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> EXIT;

Once you are finished, you can proceed to the next step.

Download FileRun

First, download the latest version of FileRun from their official website using the following command:

wget -O FileRun.zip https://filerun.com/download-latest

Once the FileRun is downloaded, unzip the downloaded file using the following command:

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

Next, set proper permission and ownership with the following command:

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

Once you are finished, you can proceed to the next step.

Create an Apache Virtual Host for FileRun

Next, you will need to create an Apache virtual host configuration file for FileRun. You can create it with the following command:

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

Add the following lines:

<VirtualHost *:80>
        ServerName filerun.example.com

        DocumentRoot /var/www/html/filerun

        <Directory "/var/www/html/filerun">
                Options Indexes FollowSymLinks
                AllowOverride All
                Require all granted
        </Directory>

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

Save and close the file, then activate the Apache virtual host and enable the Apache rewrite module with the following command:

a2ensite filerun.conf
a2enmod rewrite

Next, restart the Apache service to apply the changes:

systemctl restart apache2

You can also check the Apache status with the following command:

systemctl status apache2

You should see the following output:

? apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2022-08-06 09:26:00 UTC; 7s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 21189 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 21193 (apache2)
      Tasks: 6 (limit: 2242)
     Memory: 14.6M
        CPU: 112ms
     CGroup: /system.slice/apache2.service
             ??21193 /usr/sbin/apache2 -k start
             ??21194 /usr/sbin/apache2 -k start
             ??21195 /usr/sbin/apache2 -k start
             ??21196 /usr/sbin/apache2 -k start
             ??21197 /usr/sbin/apache2 -k start
             ??21198 /usr/sbin/apache2 -k start

Aug 06 09:26:00 ubuntu2204 systemd[1]: Starting The Apache HTTP Server...

Once you are finished, you can proceed to the next step.

Access FileRun Web UI

Now, open your web browser and access the FileRun web UI using the URL http://filerun.example.com. You will be redirected to the following page:

FileRun Installer

Click on the Next button. you should see the server requirements check page:

Check prerequisites

Click on the Next button. You should see the database configuration page:

Database setup

Click on the Next button. Once the installation has been finished, you should see the following page:

FileRun installation successful

Click on the Next button. You should see the FileRun login page:

Login to FileRun

Provide your admin username, password, and click on the Sign in button. You should see the FileRun dashboard on the following page:

FileRun dashboard

Secure FileRun with Let's Encrypt SSL

It is also recommended to secure your website with Let's Encrypt SSL. First, you will need to install the Certbot client on your server. You can install it with the following command:

apt-get install python3-certbot-apache -y

Once the Certbot is installed, run the following command to secure your website with Let's Encrypt SSL:

certbot --apache -d filerun.example.com

You will be asked to provide your email and accept the term of service as shown below:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator standalone, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): [email protected]

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf. You must
agree in order to register with the ACME server at
https://acme-v02.api.letsencrypt.org/directory
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(A)gree/(C)ancel: A

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Would you be willing to share your email address with the Electronic Frontier
Foundation, a founding partner of the Let's Encrypt project and the non-profit
organization that develops Certbot? We'd like to send you email about our work
encrypting the web, EFF news, campaigns, and ways to support digital freedom.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
(Y)es/(N)o: Y
Plugins selected: Authenticator apache, Installer apache
Obtaining a new certificate
Performing the following challenges:
http-01 challenge for filerun.example.com
Enabled Apache rewrite module
Waiting for verification...
Cleaning up challenges
Created an SSL vhost at /etc/apache2/sites-available/filerun-le-ssl.conf
Enabled Apache socache_shmcb module
Enabled Apache ssl module
Deploying Certificate to VirtualHost /etc/apache2/sites-available/filerun-le-ssl.conf
Enabling available site: /etc/apache2/sites-available/filerun-le-ssl.conf
Next, select whether or not to redirect HTTP traffic to HTTPS as shown below:

Please choose whether or not to redirect HTTP traffic to HTTPS, removing HTTP access.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: No redirect - Make no further changes to the webserver configuration.
2: Redirect - Make all requests redirect to secure HTTPS access. Choose this for
new sites, or if you're confident your site works on HTTPS. You can undo this
change by editing your web server's configuration.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2

Type 2 and hit Enter to install the Let's Encrypt SSL for your website:

Enabled Apache rewrite module
Redirecting vhost in /etc/apache2/sites-enabled/filerun.conf to ssl vhost in /etc/apache2/sites-available/filerun-le-ssl.conf

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations! You have successfully enabled https://filerun.example.com

You should test your configuration at:
https://www.ssllabs.com/ssltest/analyze.html?d=filerun.example.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

IMPORTANT NOTES:
 - Congratulations! Your certificate and chain have been saved at:
   /etc/letsencrypt/live/filerun.example.com/fullchain.pem
   Your key file has been saved at:
   /etc/letsencrypt/live/filerun.example.com/privkey.pem
   Your cert will expire on 2022-4-29. To obtain a new or tweaked
   version of this certificate in the future, simply run certbot again
   with the "certonly" option. To non-interactively renew *all* of
   your certificates, run "certbot renew"
 - If you like Certbot, please consider supporting our work by:

   Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
   Donating to EFF:                    https://eff.org/donate-le

Conclusion

Congratulations! you have successfully installed FileRun with Apache and Let's Encrypt SSL on Ubuntu 22.04. You can now host your own FileRun server on the cloud and start sharing and syncing your files, music, and photos with your friends and family.

Share this page:

1 Comment(s)