Yum

From DreamFactory
Jump to: navigation, search
(PHP)
(Redirected page to DreamFactory/Yum)
 
Line 1: Line 1:
==PHP==
+
#REDIRECT [[DreamFactory/Yum]]
Dreamfactory requires PHP 5.6+ 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 [http://fedoraproject.org/wiki/EPEL  RHEL EPEL] repository to your sources list.  Instructions for doing this are available [http://www.rackspace.com/knowledge_center/article/installing-rhel-epel-repo-on-centos-5x-or-6x here].
+
<source lang="bash">sudo yum install git curl php php-common php-cli php-curl php-json php-gd</source>
+
 
+
==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.
+
<br>
+
<br>
+
'''Example:'''
+
*First make sure you have the '''wget''' utility installed.
+
<source lang="bash">sudo yum install wget</source>
+
*Use the '''wget''' utility to download and add MySQL from the [https://dev.mysql.com/downloads/repo/yum/ community repository].
+
<source lang="bash">wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm</source>
+
*Add the repository
+
<source lang="bash">sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm</source>
+
*Update the system. (May require '''sudo''')
+
<source lang="bash">yum update</source>
+
*Next install MySQL.
+
<source lang="bash">sudo yum install mysql-server</source>
+
'''Note:''' You will see during the installation process that the mysql-client dependency is installed.
+
*Start the MySQL server.
+
<source lang="bash">sudo systemctl start mysqld</source>
+
<br>
+
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.
+
<br>
+
<br>
+
'''Example:'''
+
*Run the following command in the shell to harden MySQL server.
+
<source lang="bash">sudo mysql_secure_installation</source>
+
*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.
+
<br>
+
*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.
+
<br>
+
'''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.
+
<source lang="bash">mysql -u root -p</source>
+
*Create a database to be used as the system database for your Dreamfactory installation.
+
<source lang="sql">CREATE DATABASE dreamfactory;</source>
+
*Grant privileges to a user for the database.
+
<source lang="sql">GRANT ALL PRIVILEGES ON dreamfactory.* TO 'df_admin'@'localhost' IDENTIFIED BY 'df_admin';</source>
+
*Flush privileges and quit.
+
<source lang="sql">FLUSH PRIVILEGES;</source>
+
<source lang="sql">quit</source>
+
 
+
==Web Server==
+
 
+
===Nginx===
+
 
+
Instructions for installing Nginx on CentOS 7 are [https://www.digitalocean.com/community/tutorials/how-to-install-nginx-on-centos-7 here].
+
<pre> $ sudo yum install nginx </pre>
+
 
+
Here's a sample nginx default.conf file.
+
 
+
<pre>
+
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;
+
    }
+
}
+
</pre>
+
 
+
===Apache===
+
 
+
<pre>
+
$ sudo yum install httpd
+
</pre>
+
 
+
* '''Open the Firewall for http'''
+
 
+
<pre>
+
$ setenforce 0
+
$ firewall-cmd --permanent --add-service=http
+
$ firewall-cmd --reload
+
</pre>
+
 
+
* '''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.
+
 
+
<pre> $ sudo nano /etc/httpd/conf/httpd.conf </pre>
+
 
+
* '''Change the DocumentRoot and the Directory settings'''
+
 
+
<pre>
+
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>
+
</pre>
+
 
+
* '''Restart the web server'''
+
 
+
<pre> $ sudo service httpd restart </pre>
+
 
+
Your DreamFactory Application should now be active and available by entering the DNS name or IP address of your server into a web browser.
+

Latest revision as of 14:44, 7 December 2017

Redirect to: