Introduction
FileRun is a free, open source, self-hosted file sharing application for Linux. It is a great alternative to Google Drive and Dropbox. It allows you to share and sync files, access via WebDAV, and even connect with the Nextcloud mobile app. It is written in PHP and uses MariaDB as its database. It allows you to access your files anywhere through secure cloud storage and also offers backup and sharing of photos, videos, files and more.
In this article I will explain how to install FileRun with Apache and Let’s Encrypt SSL on Debian 11.
If you want to install FileRun on a remote server, continue reading; otherwise, skip the first paragraph “Connecting to the server” and read the next.
Server connection
To access the server, you need to know the IP address. You will also need your username and password for authentication. To connect to the server as root, type the following command:
ssh [email protected]_SERVER
Next, you will need to enter the password for the root user.
If you’re not using the root user, you can log in with another username using the same command, then change root to your username :
ssh [email protected]_SERVER
You will then be prompted to enter your user password.
The standard port for connecting via ssh is 22 , if your server uses a different port you will need to specify it using the -p parameter , then type the following command:
ssh [email protected]_SERVER -p PORT
Previous requirements
- A server running Debian 11.
- A valid domain name points to the IP of your server.
- A root password is configured on the server.
Install LAMP server
First, you’ll need to install Apache, MariaDB, PHP, and other packages on your server. You can install them all by running the following command:
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 all the packages are installed, you will also need to install the IonCube loader on 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
Once the download is complete, extract the downloaded file with the following command:
tar -xzf ioncube_loaders_lin_x86-64.tar.gz -C /usr/lib/php
Next, create an ioncube configuration file and define the IonCube source path:
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 configuration:
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
Configure the MariaDB database
First, you will need to secure the MariaDB installation 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 logged in, create a database and user with the following command:
CREATE DATABASE filerun;
GRANT ALL PRIVILEGES ON filerun.* TO 'filerun'@'localhost';
Then grant all privileges to the FileRun database with the following command:
GRANT ALL PRIVILEGES ON filerun.* TO 'filerun'@'localhost';
Then clear the privileges and exit MariaDB with the following command:
FLUSH PRIVILEGES;
EXIT;
Once this is done, you can continue to the next step.
Download FileRun
First, download the latest version of FileRun with the following command:
wget -O FileRun.zip https://filerun.com/download-latest
Once FileRun is downloaded, unzip the downloaded file using the following command:
unzip FileRun.zip -d /var/www/html/filerun/
Then set the appropriate 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 this is done, you can continue to the next step.
Configure Apache 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 rewrite the module with the following command:
a2ensite filerun.conf
a2enmod rewrite
Then restart the Apache service to apply the changes:
systemctl restart apache2
You can also check the status of Apache 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-01-29 15:14:56 UTC; 5s ago
Docs: https://httpd.apache.org/docs/2.4/
Process: 22533 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
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...
Once this is done, you can continue to the next step.
Login to the FileRun web UI
Now open your web browser and access the FileRun web UI using the URL http://filerun.example.com .