Last updated: 22 October 2021
In this tutorial, we will install a FileRun instance on a CentOS 7 server running Apache, MariaDB 10 and PHP 7.4 as FPM. We will also configure the server with an SSL certificate and install any third-party software FileRun might make use of, so that you can enjoy all FileRun features on a secure server.
Before you begin this tutorial you'll need a CentOS 7 server.
We'll be installing most of the required software using CentOS's package manager,
yum. You can learn more about how to use yum here.
This guide assumes that you have some experience with editing text files from the command line. We are using
vim in our examples.
Prior experience with installing and configuring Apache, MariaDB or PHP is however not necessary.
Step 1 — Installing Apache
The following two commands will install, and start, the Apache web server:
sudo yum install httpd sudo systemctl start httpd.service
You can verify that by visiting your server's public IP address in your web browser. You should see the Apache welcoming page, letting you know that it is working properly.
Step 2 — Installing MariaDB 10
Now that we have our web server up and running, it is time to install a database server. This server will be managing the FileRun database which holds the application settings, the users settings and information about your files.
FileRun requires MariaDB 10 or MySQL version 5.7 (or higher). Given that CentOS 7 provides by default the older MariaDB/MySQL we first need to update the yum repositories:
sudo vim /etc/yum.repos.d/MariaDB10.repo
If you are getting
vim: command not found, you need to install
vim, like this
sudo yum install vim
Add the following text in it:
# MariaDB 10.1 CentOS repository list - created 2016-01-18 09:58 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.1/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
Then save and exit the file with
With two simple commands the database server MariaDB will be installed and running:
sudo yum install mariadb-server mariadb sudo systemctl start mariadb
Now that our MariaDB server is running, we want to run a simple script which will improve the security of our database:
The prompt will ask you for your current MariaDB root password. Since you just installed MariaDB, you won’t have one, so leave it blank by pressing
ENTER. Then the prompt will help you set a password:
Enter current password for root (enter for none): OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MariaDB root user without the proper authorization. Set root password? [Y/n] y New password: PASSWORD Re-enter new password: PASSWORD Password updated successfully! Reloading privilege tables.. ... Success!
For the rest of the questions, you should simply hit the
ENTER key through each prompt to accept the default values. This will remove some sample users and databases, disable remote root logins, and load these new rules so that MariaDB immediately respects the changes we have made.
The last thing you will want to do is enable MariaDB to start on boot. Use the following command to do so:
sudo systemctl enable mariadb.service
The database server is now configured and we can proceed with creating our FileRun database and the user account which will access it.
To get started, log into MariaDB with the root account:
mysql -u root -p
Enter the password you set for the MariaDB root user when you installed the server.
FileRun requires a separate database for storing its data. While you can call this database whatever you prefer, we will be using the name
filerun for this example.
CREATE DATABASE filerun;
Next, create a separate MariaDB user account that will interact with the newly created database. Creating one-function databases and accounts is a good idea from a management and security standpoint. As with the naming of the database, choose a username that you prefer. We chose to go with the name
filerun for this guide.
GRANT ALL ON filerun.* to 'filerun'@'localhost' IDENTIFIED BY 'YOUR-DB-PASSWORD';
Note: Be sure to put an actual password where the command states: YOUR-DB-PASSWORD
With the user assigned access to the database, perform the flush-privileges operation to ensure that the running instance of MariaDB knows about the recent privilege assignment:
This concludes the configuration of MariaDB, therefore we will quit the session by typing:
Make a note of the database name
filerun, the username
filerun and the password
YOUR-DB-PASSWORD as we will need this information again shortly.
Step 3 — Installing PHP-FPM 7.4
FileRun requires PHP version 7.1 or higher. Given that CentOS 7 provides by default the older PHP version 5.4 we first need to update the yum repositories:
sudo yum install epel-release yum-utils sudo yum install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
Yum may prompt you to import the repository GPG key. Type
y and hit
Now, enabling the PHP 7.4 Remi repository:
sudo yum-config-manager --enable remi-php74
We can now install PHP 7.4:
sudo yum install php-fpm php
Next, create the system startup links for PHP-FPM and start it:
sudo systemctl enable php-fpm.service sudo systemctl start php-fpm.service
PHP-FPM is a daemon process (with the init script
/etc/init.d/php-fpm) that runs a FastCGI server on port
To make Apache work with PHP-FPM, we can use the
ProxyPassMatch directive in each
vhost that should use PHP-FPM (see http://wiki.apache.org/httpd/PHP-FPM).
We do that by editing the Apache configuration file:
sudo vim /etc/httpd/conf/httpd.conf
and adding this somewhere near the end (before the
IncludeOptional conf.d/*.conf line):
<IfModule proxy_module> ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000/var/www/html/$1 </IfModule>
It should look like this:
Next, higher up in the same configuration file, locate the
DirectoryIndex directive and append
DirectoryIndex index.html index.php
Restart Apache and now PHP is installed.
sudo systemctl restart httpd.service
Step 4 — Configuring PHP
The following command will install the PHP modules needed by FileRun:
sudo yum install php-imagick php-mbstring php-opcache php-pdo php-mysqlnd php-gd php-xml php-zip
One last module which is not included in the
yum repository is
Download and extract the latest
ionCube version using the following commands:
cd /usr/lib64/php/modules sudo wget http://downloads3.ioncube.com/loader_downloads/ioncube_loaders_lin_x86-64.tar.gz sudo tar xvfz ioncube_loaders_lin_x86-64.tar.gz
If you are getting
wget: command not found, you need to install
wget, like this
sudo yum install wget
Next, let's create a file which will automatically get appended by PHP to its configuration. This will include all the settings needed by FileRun.
sudo vim /etc/php.d/01_filerun.ini
Paste the following inside the created 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" zend_extension = /usr/lib64/php/modules/ioncube/ioncube_loader_lin_7.4.so
Note: You can find the latest FileRun recommended PHP settings here: https://docs.filerun.com/php_configuration
Finally, we need to restart the PHP-FPM service for the changes to take effect:
sudo systemctl restart php-fpm.service
Your server now meets all the requirements and we can proceed with installing FileRun.
Step 6 — Installing FileRun
Download FileRun in the root folder of your webserver (
cd /var/www/html/ sudo wget -O FileRun.zip https://filerun.com/download-latest-centos-7
Extract the FileRun installation package:
sudo unzip FileRun.zip
If you are getting
unzip: command not found, you need to install
unzip, like this
sudo yum install unzip
Remove the installation package as it is no longer needed:
sudo rm FileRun.zip
Adjust the folder permissions to allow Apache to write in the FileRun temporary data folder. Other files and folders, being owned by the root user, will not be writable by Apache.
sudo chown -R apache:apache system/data/
If your system has SElinux installed, you will need to adjust the folder context as well:
sudo chcon -t httpd_sys_rw_content_t -R system/data
Open your browser and point it to
You should see the FileRun installation wizard which will help you get FileRun running with just a few clicks:
Next to proceed. Review the server requirements check and make sure there is no red error message:
Next to proceed with the database connection setup:
- Type in the
Database nameyou used at the step 2 of this tutorial:
- Type in the
- Type in the
- Then click
You will be presented with the following screen, letting you know that FileRun has been successfully installed:
Warning: Make sure you made a copy of the username and password displayed on the screen, before proceeding. The password is being randomly generated at this step. Do not use the password from this tutorial screenshot, it won't work on your install.
Next to open FileRun. You should see the login page:
The form should be prefilled so you can just hit
Step 7 — Securing the FileRun installation
Install a SSL certificate: https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-centos-7 and make sure you always access FileRun via HTTPS.
As soon as you sign into FileRun you will be prompted to change the password. Although the automatically generated password is quite secure, it's still a good idea to set your own.
Warning: The FileRun superuser is the only account not protected against brute force login attacks, so it is very important that you set a password that cannot be guessed by a computer. Set a long password, containing also uppercase letters, digits and symbols.
At first login you will be prompted to configure the FileRun superuser account with a home folder. Set the home folder path pointing to a folder which is located outside the public area of your web server (ie. outside
You could create a folder
/files and store all the FileRun files in there:
sudo mkdir /files sudo chown apache:apache /files sudo chcon -t httpd_sys_rw_content_t -R /files
Next, connect to the MariaDB server again:
mysql -u root -p
Update the configured MariaDB user account and remove the
REVOKE ALTER, DROP ON filerun.* FROM 'filerun'@'localhost'; FLUSH PRIVILEGES;
You will need to add these permissions back before you will be installing any FileRun software update in the future. To do that, connect again to the database server and runt the following commands:
GRANT ALTER, DROP ON filerun.* TO 'filerun'@'localhost'; FLUSH PRIVILEGES;
For generating thumbnails for image files, photography files and even PDF documents, install ImageMagick like this:
sudo wget https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm sudo rpm -Uvh rpmfusion-free-release*rpm sudo yum install libheif sudo yum install ImageMagick*
And enable it inside FileRun from the control panel, under the
System configuration >
Thumbs and previews section, using the
IMagick PHP Extension mode.
You have now successfully deployed FileRun on a CentOS 7 server. It's time to upload your files, photos, music or work documents and start sharing.
For more information on FileRun features and settings, visit https://docs.filerun.com