‍FileRun is a powerful and versatile file-sharing application for Linux that provides a self-hosted alternative to popular cloud storage services like Google Drive and Dropbox. With FileRun, you can securely store, sync, and share files, access them from anywhere using WebDAV, and even connect with the Nextcloud mobile app. In this step-by-step guide, we will walk you through the process of installing FileRun on Debian 11, ensuring that your files are securely stored and easily accessible.

Prerequisites

Before we begin, make sure you have the following:

  • A server running Debian 11.
  • A valid domain name pointed to your server’s IP address.
  • A configured root password for your server.

Install LAMP Server

To start, we need to install the LAMP (Linux, Apache, MariaDB, PHP) stack on your Debian 11 server. This will provide the necessary components for running FileRun. Open your terminal and run the following command to install the required packages:

apt-get install apache2 mariadb-server mariadb-client php libapache2-mod-php imagemagick ffmpeg php-imagick php-mysql php-fpm php-common php-gd php-json php-curl php-zip php-xml php-mbstring php-bz2 php-intl unzip -y

Once the installation is complete, we also need to install the IonCube loader, which is required by FileRun. Download the IonCube loader by running the following command:

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

Extract the downloaded file using the following command:

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

Next, create a configuration file for the IonCube loader by running the following command:

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

Add the following line to the file:

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

Save and close the file. Now, create a PHP configuration file for FileRun by running the following command:

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

Add the following settings to the file:

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. Finally, restart the Apache service to apply the changes:

systemctl reload apache2

Configure MariaDB Database

Next, we need to secure the MariaDB installation and create a database for FileRun. Run the following command to begin the MariaDB secure installation process:

mysql_secure_installation

Follow the prompts and answer the questions as shown below:

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

Once you have secured MariaDB, log in to the MariaDB shell by running the following command:

mysql -u root -p

Enter the root password you set during the secure installation process. Once you are logged in, create a database and a user for FileRun with the following commands:

CREATE DATABASE filerun;
CREATE USER 'filerun'@'localhost' IDENTIFIED BY 'password';

Replace ‘password’ with a strong password of your choice. Grant all privileges to the FileRun database by running the following command:

GRANT ALL PRIVILEGES ON filerun.* TO 'filerun'@'localhost';

Flush the privileges and exit the MariaDB shell:

FLUSH PRIVILEGES;
EXIT;

Download and Configure FileRun

Now, let’s download the latest version of FileRun and configure it to work with Apache. Download FileRun by running the following command:

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

Once the download is complete, unzip the file and move it to the appropriate directory:

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

Set the correct permissions and ownership for the FileRun directory:

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

Configure Apache for FileRun

To configure Apache for FileRun, we need to create a virtual host configuration file. Run the following command to create the file:

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

Add the following lines to the file:

<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. Now, activate the virtual host and enable the rewrite module by running the following commands:

a2ensite filerun.conf
a2enmod rewrite

Finally, restart the Apache service to apply the changes:

systemctl restart apache2

You can verify the status of Apache by running the following command:

systemctl status apache2

If everything is configured correctly, 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-01-29 15:14:56 UTC; 5s ago
Docs: https://httpd.apache.org/docs/2.4/
Main PID: 22538 (apache2)
Tasks: 6 (limit: 2341)
Memory: 16.4M
CPU: 94ms
CGroup: /system.slice/apache2.service
??22538 /usr/sbin/apache2 -k start
??22539 /usr/sbin/apache2 -k start
??22540 /usr/sbin/apache2 -k start
??22541 /usr/sbin/apache2 -k start
??22542 /usr/sbin/apache2 -k start
??22543 /usr/sbin/apache2 -k start

Jan 29 15:14:56 debian11 systemd[1]: Starting The Apache HTTP Server...

Access FileRun Web UI

Now that FileRun is installed and configured, you can access the FileRun web interface using your web browser. Open your browser and enter the URL http://filerun.example.com. You will be redirected to the FileRun setup page. Click on the “Next” button to proceed.

On the next page, FileRun will perform a server requirements check to ensure that your system meets all the necessary dependencies. If any requirements are not met, you will be prompted to resolve them before proceeding. Click on the “Next” button to continue once all requirements are met.

Next, you will be presented with the database setup page. Enter the database details you created earlier: database name, username, and password. Click on the “Next” button to proceed.

Once the installation is complete, you will see a success message. Click on the “Next” button to access the FileRun login page. Enter your admin username and password, then click on the “Sign in” button.

Congratulations! You have successfully installed FileRun on Debian 11. You can now start using FileRun to store, manage, and share your files securely.

Secure FileRun with Let’s Encrypt SSL

To further enhance the security of your FileRun installation, it is recommended to secure it with a Let’s Encrypt SSL certificate. Let’s Encrypt provides free SSL certificates that can be easily installed on your server.

To get started, we need to install the Certbot client, which will help us obtain and manage the SSL certificate. Run the following command to install Certbot:

apt-get install python3-certbot-apache -y

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

certbot --apache -d filerun.example.com

Follow the prompts and provide your email address when asked. Agree to the terms of service, and Certbot will automatically obtain and install the SSL certificate for your website.

After the installation is complete, Certbot will give you the option to redirect all HTTP traffic to HTTPS. Choose the appropriate option based on your preference. Once the redirection is enabled, all HTTP requests will be automatically redirected to the secure HTTPS version of your website.

Congratulations! You have successfully secured your FileRun installation with Let’s Encrypt SSL. Your website is now protected with a valid SSL certificate, ensuring secure communication between your users and the server.

Conclusion

In this comprehensive guide, we have walked you through the process of installing FileRun on Debian 11, from setting up the LAMP stack to configuring Apache and securing your installation with Let’s Encrypt SSL. With FileRun, you can now have complete control over your file-sharing and storage solution, ensuring the privacy and security of your data.

If you’re looking for a reliable hosting provider for your FileRun installation, consider Shape.host. They offe Linux SSD VPS hosting plans that are optimized for performance and security. With Shape.host, you can enjoy fast and reliable hosting for your FileRun instance, backed by exceptional customer support.