Posted in Technology

How to set up a self-hosted file storage with Filerun

More and more privacy and cybersecurity-aware people are looking for alternative solutions to popular cloud file storage services like Dropbox, Google Drive, and Microsoft Onedrive. These services have plenty of functionality, but they don’t respect your privacy, and they are also lucrative targets for hackers. Setting up and hosting your own file storage service is a straightforward task for anyone who has some experience with web servers. Here is our guide for installing and configuring Filerun as your self-hosted system.

This is what you need to create a self-hosted Filerun file storage

You need a computer that is running on Linux or Windows. It can be a VPS (Virtual Private Server), a home server, or even a laptop. Disk space is the critical factor here, not performance.

Filerun service is accessed in a web browser or app on any computer or mobile device, but the computer where Filerun service runs requires the following software:

  • Web server, like Apache or Nginx.
  • Mysql/Mariadb 5.6 database or later.
  • PHP 7.1 or later version.
  • PHP extensions exif, gd, mbstring, openssl, POD, xml, zlib. Linux systems often come with these extensions activated. You can check yours with this command line command: php -m . If a required extension is missing, you may have to install it for your operating system, or just activate it in command line. The method depends on your operating system. For instance, for Debian and its derivatives, command phpenmod activates extensions.
  • IonCube loader.
ioncube php loader setup wizard

How to install Filerun

Our production system runs on Debian 10 Linux, so this guide is based on that, but the process is the same for all servers.

I assume that you already have a web server, Mysql/Mariadb and PHP running, so I will skip them. IonCube is a piece of software that enrypts and decrypts PHP code, and Filerun uses it.

Download Ioncube from the developer’s page:
https://www.ioncube.com/loaders.php
The easiest way to setup Ioncube is to download and unpack the Loader Wizard on the server, and run it in a web browser. If it runs and the test says Ioncube is ready, skip to the database setup.

If Ioncube Loader Wizard fails (as it did for us when we wanted to run it on a Linux VPS), you have to install Ioncube manually. The best path is to follow instructions given at the screen where the wizard stopped. In our case (Debian 10 on a VPS), we had to download the Linux (64 bits) package, unpack it, and follow instructions in the package.

Next, create a database for Filerun. You may do it, for instance, with phpmyadmin or in command line. The command line process goes like this (replace databasename and username with your own):

mysql -u root -p mysqlrootpasswordhere
create database databasename;
grant all on databasename.* TO username@localhost identified by "passwordforthismysqluser";
exit;

Now, we are ready to download the latest version of Filerun:

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

Move the downloaded file to a directory that the web server can access. For instance /var/www/html or give Filerun its own directory /var/www/html/filerun. Unzip the file into the directory.

On Linux systems, you have to check permissions of the system/data directory that is located under the Filerun directory. The web server user must be the owner of the data directory and its files. Command line (assuming you are in the Filerun directory):

chown -R www-data system/data
chgrp -R www-data system/data

Now, everything is ready, and you can login to the brand new file storage. Point your browser to (assuming you installed Filerun in a directory named filerun):
https://mydomain.com/filerun
or if you have installed the software on a local computer:
localhost/filerun

A simple setup form asks you to fill in the database name and a few other items. The system automatically generates superuser admin and a complex password. SAVE THE PASSWORD.

Once you are inside Filerun, go straight to the Control Panel (top right corner), open the user account, and select Permissions. Set a directory path for the file storage that is outside web server’s public space. For instance, if you create a directory /var/www/filerunfiles and set that path as the file storage, files are not visible to the internet (except through Filerun). Set permissions on Linux:

chown www-data /var/www/filerunfiles

While you are logged in as superuser, create a user account for your own daily use as well.

An installation document with additional security tips can be viewed here.

filerun superuser settings

How to use Filerun

Our small team accesses, downloads, uploads and shares documents stored in Filerun in web browser only, but dedicated applications for phones, tablets, and PCs are available as well.

Two choices are available for mobile devices: apps that can transfer files using Webdav protocol and the Nextcloud sync app.

A sync app for Windows, Mac, and Linux PCs is available. It is the same PC app as Nextcloud uses.

Backup

Two sets of data – files uploaded to the Filerun system, and Filerun database – should be backed up.

Mysql database that stores Filerun’s metadata can be backed up with phpmyadmin, but an automated tool is better in the long run. For instance, Mysqldump command comes with Mysql. It exports a given database that can be imported to the system when required.

Files uploaded to Filerun are the same as they were before the upload because Filerun doesn’t modify them. Depending on your usage, you may consider if and how to back them up.