Tutorials  /  Linux Basics

Install DreamFactory on CentOS 7 with Apache, PHP & MariaDB

Ccentron Redaktion · June 2025 ·6 min read ·Linux Basics, Tutorial

DreamFactory is a free and open source solution that enables you to convert any database into a REST API service.

This tutorial explains how to set up the Open Source Edition of DreamFactory on a CentOS 7 server.

Requirements

  • A CentOS 7 x64 server instance
  • A user with sudo privileges
VM

Matching infrastructure at centron

No hardware needed to follow along: ccloud³ VMs with full root access start at €3.12 per month, billed by the hour and ready in seconds. Rent a cloud server →

Step 1: Perform System Updates

Start by logging in via SSH as a sudo-enabled user. Update your system with the following commands:

Console
sudo yum install epel-release -y
sudo yum update -y
sudo shutdown -r now

Step 2: Set Up Apache Web Server

DreamFactory requires Apache. You can install it using the YUM package manager as shown below:

Console
sudo yum install httpd -y

Then, remove the default welcome page of Apache:

Console
sudo sed -i 's/^/#&/g' /etc/httpd/conf.d/welcome.conf

Prevent Apache from displaying directory contents publicly:

Console
sudo sed -i "s/Options Indexes FollowSymLinks/Options FollowSymLinks/" /etc/httpd/conf/httpd.conf

Activate Apache and ensure it starts on boot:

Console
sudo systemctl start httpd.service
sudo systemctl enable httpd.service

Step 3: Install and Configure MariaDB

We will use MariaDB 10.1 as the backend database for DreamFactory.

3.1 Create the MariaDB 10.1 Repository

Use this snippet to define the YUM repository for MariaDB 10.1:

Code
cat < 
cat <

3.2 Install MariaDB Using YUM

Now install MariaDB server and client packages with this command:

Console
sudo yum install MariaDB-server MariaDB-client -y

3.3 Enable and Launch MariaDB

Start MariaDB and make sure it launches on system boot:

Console
sudo systemctl start mariadb.service
sudo systemctl enable mariadb.service

3.4 Secure MariaDB Installation

Run the built-in MariaDB script to apply essential security settings:

Console
sudo /usr/bin/mysql_secure_installation

Follow the prompts with the following responses. Be sure to substitute your own secure password where required:

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

3.5 Create a DreamFactory Database in MariaDB

Use the following steps to create the required database and user for DreamFactory. First, log into MariaDB as root:

Code
mysql -u root -p

Enter the root password set in the previous step. Inside the MySQL shell, run the following commands to set up the DreamFactory database and user. Be sure to replace the sample credentials with your own secure values:

Code
CREATE DATABASE dreamfactory;
CREATE USER 'dreamfactoryuser'@'localhost' IDENTIFIED BY 'yourpassword';
GRANT ALL PRIVILEGES ON dreamfactory.* TO 'dreamfactoryuser'@'localhost' IDENTIFIED BY 'yourpassword' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EXIT;

Step 4: Install PHP 7.x and Composer

4.1 Install PHP 7.1 and Required Extensions

To install PHP 7.1 and the necessary modules on CentOS 7, use the Webtatic YUM repository as follows:

Console
sudo rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
sudo yum install mod_php71w php71w-common php71w-cli php71w-gd php71w-mbstring php71w-mcrypt php71w-xml php71w-mysqlnd php71w-pecl-mongodb -y

4.2 Download and Install Composer

To install Composer version 1.3.1, execute the following sequence of commands. Please be aware that Composer’s installation process might change in the future, so it's best to consult their official site for the most recent steps:

Console
cd
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

4.3 Move Composer to a Global Path

Make Composer accessible system-wide with this command:

Console
sudo mv composer.phar /usr/local/bin/composer

Step 5: Install Git and DreamFactory

5.1 Install Git

Use the following command to install Git on CentOS 7:

Console
sudo yum install git -y

5.2 Download and Install DreamFactory

Download the most recent stable version of DreamFactory (2.4.2 at the time of writing) and proceed with installation using the commands below:

Console
cd
wget https://github.com/dreamfactorysoftware/dreamfactory/archive/2.4.2.tar.gz
tar -zxvf 2.4.2.tar.gz
cd dreamfactory-2.4.2
composer install --no-dev
sudo mv ~/dreamfactory-2.4.2 /opt
sudo chown -R root:root /opt/dreamfactory-2.4.2
sudo chown -R apache:apache /opt/dreamfactory-2.4.2/storage/ /opt/dreamfactory-2.4.2/bootstrap/cache/
sudo chmod -R 2775 /opt/dreamfactory-2.4.2/storage/ /opt/dreamfactory-2.4.2/bootstrap/cache/
cd /opt/dreamfactory-2.4.2

To generate the environment configuration file, run the setup command:

Console
sudo php artisan dreamfactory:setup

Provide the requested database details as shown:

  • Choose database type: 1 (for MySQL)
  • MySQL Host: localhost
  • Database Name: dreamfactory
  • Username: dreamfactoryuser
  • Password: yourpassword
  • Database Port: 3306

Now repeat the same command to set up the first admin user:

Console
sudo php artisan dreamfactory:setup

Use the following information when prompted:

  • First name: John
  • Last name: Doe
  • Display name: John Doe
  • Email: admin@example.com
  • Password: <your-admin-password>

5.3 Configure DreamFactory for Web Access

Create a virtual host configuration file for DreamFactory. Replace the placeholder values with your own details:

Code
cat < 
cat <

Restart Apache to apply the configuration:

Console
sudo systemctl restart httpd.service

To allow external web access, update the firewall settings:

Console
sudo firewall-cmd --zone=public --permanent --add-service=http
sudo firewall-cmd --reload

Step 6: Access DreamFactory Web Interface

Open your browser and navigate to http://203.0.113.1. You can then log in with the admin email and password you set during setup.

Conclusion

By following this comprehensive guide, you’ve successfully installed the DreamFactory Open Source Edition on a CentOS 7 server. You’ve configured Apache, MariaDB, PHP, Composer, and DreamFactory itself, as well as secured your database and web environment. You can now begin building RESTful APIs with DreamFactory and connect your applications to virtually any backend database through a streamlined, scalable interface.

Jetzt 200 € Guthaben sichern

Testen Sie Ihr Setup auf ccloud³

Registrieren Sie sich in der ccloud³ und erhalten Sie 200 € Startguthaben für Ihr Projekt – z. B. für eine PostgreSQL-VM mit automatischen Backups.

centron Redaktion Technische Redaktion

Das Redaktionsteam von centron schreibt Anleitungen aus dem Betriebsalltag: getestet auf unserer eigenen Plattform, betrieben im Rechenzentrum in Hallstadt bei Bamberg.

Kategorie Linux Basics
Teilen
Noch offene Fragen?

Our team will help you with your specific setup - in German or English, by people who run the platform themselves.

War dieses Tutorial hilfreich?

Your answer is stored anonymously and helps us improve our tutorials.

Kommentare

No comments yet - be the first to ask a question about this tutorial.

Sign in to comment

Comments are open to centron customers. Sign in to your account to ask a question about this tutorial.

Weiterlesen

Das könnte Sie auch interessieren

Jetzt kostenlos anfangen

Melden Sie sich an und erhalten Sie in den ersten 60 Tagen ein Guthaben von 200 € bei centron.

Dieses Werbeangebot gilt nur für neue Konten. Angebot ausschließlich für Gewerbetreibende.

Jetzt loslegen Sales kontaktieren