Yum

From DreamFactory
Jump to: navigation, search

PHP

Dreamfactory requires PHP 5.5+ to be installed. In CentOS and Red Hat Enterprise Linux environments this means PHP will need to be installed. Please note that the php-json package isn't available is some distro repositories. If this is the case, you can add the RHEL EPEL repository to your sources list. Instructions for doing this are available here.

sudo yum install git curl php php-common php-cli php-curl php-json php-gd

Database

MySQL/MariaDB

Note: If you intend to use MySQL/MariaDB as the system database you will need to install the database server and client package.

Example:

  • First make sure you have the wget utility installed.
sudo yum install wget
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
  • Add the repository
sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
  • Update the system. (May require sudo)
yum update
  • Next install MySQL.
sudo yum install mysql-server

Note: You will see during the installation process that the mysql-client dependency is installed.

  • Start the MySQL server.
sudo systemctl start mysqld


One thing you might notice during the installation is that you weren't prompted to create root user credentials like you would be in other Linux distros such as Ubuntu.You will need to harden the MySQL server to address some basic security concerns of a default MySQL server installation.

Example:

  • Run the following command in the shell to harden MySQL server.
sudo mysql_secure_installation
  • Answer the on screen prompts to create a root user credentials and purge the anonymous user that comes with default MySQL installation. You will be returned to the shell after completing this step.


  • Next you will need to create a database for DreamFactory to use. Note:You do not have to use the database name and credentials in the following example.


Example:

  • Log in to MySQL. You will be asked to enter a password. Use the password created for the root user in the previous step.
mysql -u root -p
  • Create a database to be used as the system database for your Dreamfactory installation.
CREATE DATABASE dreamfactory;
  • Grant privileges to a user for the database.
GRANT ALL PRIVILEGES ON dreamfactory.* TO 'df_admin'@'localhost' IDENTIFIED BY 'df_admin';
  • Flush privileges and quit.
FLUSH PRIVILEGES;
quit

Web Server

Nginx

Instructions for installing Nginx on CentOS 7 are here.

 $ sudo yum install nginx 

Here's a sample nginx default.conf file.

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /path/to/dreamfactory/public;
    index index.php index.html index.htm;

    server_name server_domain_name_or_IP;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root /usr/share/nginx/html;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
}

Apache

$ sudo yum install httpd
  • Open the Firewall for http
$ setenforce 0
$ firewall-cmd --permanent --add-service=http
$ firewall-cmd --reload
  • Enable Site

Finally, we need to configure Apache to connect to the DreamFactory application. Below are the instructions to change the default site on Apache. For instructions on setting up virtual hosts, review the Apache documentation.

In this example, we'll edit the Apache default configuration file.

 $ sudo nano /etc/httpd/conf/httpd.conf 
  • Change the DocumentRoot and the Directory settings
DocumentRoot "/opt/dreamfactory/public"

<Directory "/opt/dreamfactory/public">
    Options -Indexes +FollowSymLinks -MultiViews
    AllowOverride All
AllowOverride None
    Require all granted
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^.*$ /index.php [L]
    <LimitExcept GET HEAD PUT DELETE PATCH POST>
        Allow from all
    </LimitExcept>
</Directory>
  • Restart the web server
 $ sudo service httpd restart 

Your DreamFactory Application should now be active and available by entering the DNS name or IP address of your server into a web browser.