Step-by-Step Guide to Installing FileRun on Ubuntu 22.04

FileRun is an open-source, web-based file-sharing application for Linux operating systems. It closely resembles services like Google Drive, iCloud, and Dropbox, allowing users to share and sync files over the internet. Accessible via mobile app, WebDAV, and web browser, it lets you host your own file-sharing solution on the cloud, enabling secure and convenient access to your files from anywhere.

This guide will walk you through the installation of FileRun with Apache and Let’s Encrypt SSL on Ubuntu 22.04.

Prerequisites

  • A server running Ubuntu 22.04.
  • A valid domain name pointed at your server’s IP address.
  • The root password configured on the server.

Install Apache, MariaDB, and PHP

FileRun is written in PHP and uses MariaDB as its database backend, thus requiring the installation of Apache, MariaDB, PHP, and additional packages on your server. Begin by installing the Apache and MariaDB packages with the following command:

apt-get install apache2 mariadb-server mariadb-client

After these packages are installed, you will need to set up PHP. Although Ubuntu 22.04 comes with PHP 8.1, FileRun requires PHP 7.4. Therefore, you need to add the PHP Ondrej repository:

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

Next, add the PHP repository using:

add-apt-repository ppa:ondrej/php

Then update the repository cache and install PHP along with other required extensions:

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

After all packages are installed, proceed to install the IonCube loader:

First, download the IonCube loader:

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

Extract the downloaded file:

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

Create an IonCube configuration file to 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

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

mysql_secure_installation

Follow the prompts 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:

mysql -u root -p

Create a database and user:

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

Grant all privileges to the FileRun database:

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

Flush the privileges and exit the MariaDB shell:

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

Download FileRun

Download the latest version of FileRun from their official website:

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

Unzip the downloaded file:

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

Set the correct permissions and ownership:

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

Create an Apache Virtual Host for FileRun

Create an Apache virtual host configuration file for FileRun:

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, activate the Apache virtual host, and enable the Apache rewrite module:

a2ensite filerun.conf
a2enmod rewrite

Restart the Apache service to apply the changes:

systemctl restart apache2

Verify Apache status:

systemctl status apache2

Expected 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...

Access FileRun Web UI

Open your web browser and navigate to http://filerun.example.com. You will be redirected to the initial setup page:

FileRun Installer

Click Next to continue to the server requirements check page:

Check prerequisites

Proceed by clicking Next to reach the database configuration page:

Database setup

After providing the necessary details, click Next until the installation process completes, reaching the final setup page:

FileRun installation successful

Click Next to view the FileRun login page:

Login to FileRun

Enter your admin username and password, then click Sign in to access the FileRun dashboard:

FileRun dashboard

Secure FileRun with Let’s Encrypt SSL

It’s advisable to secure your website with Let’s Encrypt SSL. To start, install the Certbot client:

apt-get install python3-certbot-apache -y

Once installed, run the following command to secure your website:

certbot --apache -d filerun.example.com

Provide your email and accept the terms of service:

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): your-email@example.com

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

Continue with the HTTP to HTTPS redirection:

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 to enable Let’s Encrypt SSL, ensuring your site is secure:

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 secured it with Let’s Encrypt SSL on Ubuntu 22.04. You can now host your own FileRun server in the cloud, allowing you to share and sync your files, music, and photos easily and securely.

FAQs

  • What is FileRun?
    FileRun is an open-source, web-based file management and sharing application for Linux operating systems, similar to popular cloud services like Google Drive, Dropbox, and iCloud.
  • Which PHP version is required for FileRun?
    FileRun requires PHP 7.4 for optimal functionality, despite Ubuntu 22.04 coming with PHP 8.1.
  • How can I secure my FileRun installation?
    You can secure your FileRun installation using Let’s Encrypt SSL by installing the Certbot client and following the provided configuration steps in this guide.
  • Can I access FileRun on mobile devices?
    Yes, FileRun can be accessed via a mobile app, WebDAV, and a web browser.
  • Is it possible to sync my data across multiple devices?
    Yes, FileRun allows users to sync files across the internet, providing seamless access to your data from any connected device.