Installation MacOS

From DreamFactory
Jump to: navigation, search
DreamFactoryOSX10.11Installation MacOS

Prerequisites

DreamFactory requires certain applications for install and other functionality.

  1. git, curl, zip, and unzip are installed automatically with OS X 10.11
  2. Install Homebrew

PHP

These instructions will install PHP 7 with various modules. DreamFactory requires the mbstring, zip, curl, mongodb, and sqlite3 php modules. Additionally php-fpm is installed if you will be running Nginx as your web server (recommended.) Finally, the mysql php module needs to be installed if you will be using MySQL or MariadDB, which these instructions recommend for the system database. Other database types will require their php modules to be installed for use within DreamFactory. This is covered in the Drivers and Modules section.

Install for Apache

Install for Nginx

  1. Install PHP and default modules with Brew
    • <source lang="bash">$ brew install php70 --with-fpm --with-pear</source>
    • <source lang="bash">$ brew install php70-mongodb</source>
    • <source lang="bash">$ brew services start php70</source>

Composer

Composer is a PHP dependency manager and is required for installing DreamFactory.

  1. Install Composer using Homebrew
    • <source lang="bash">$ brew install composer</source>

Database

You'll need a database for the system to store configuration information. We recommend MariaDB for this. Other supported system databases are SQLite, PostgreSQL, and Microsoft SQL.

MariaDB

Install

  1. Install MariaDB using Homebrew
    • <source lang="bash">$ brew install mariadb</source>
  2. Start the MariaDB service and set it to run on boot
    • <source lang="bash">$ brew services start mariadb</source>

Setup

  1. Login to the database
    • <source lang="bash">$ mysql -uroot</source>
  2. Create a database. You can name it whatever you like. Just make sure you save this information. For the example we called it dreamfactory.
    • <source lang="mysql">CREATE DATABASE dreamfactory;</source>
  3. Create a user with all privileges on that database. You can name the user and password whatever you like. Just make sure you save this information. For the example we used dfadmin for both the user and the password.
    • <source lang="mysql">GRANT ALL PRIVILEGES ON dreamfactory.* to 'dfadmin'@'localhost' IDENTIFIED BY 'dfadmin';</source>
  4. Flush privileges on the database and quit.
    • <source lang="mysql">FLUSH PRIVILEGES;</source>
    • <source lang="mysql">quit</source>

DreamFactory

Installing DreamFactory involves getting the required code via git and composer and then using the Laravel artisan command to set up the system. In these instructions, we will assume you are logged in as a user named dfuser. Anywhere you see this username substitute your own.

  1. Create a directory for installation and make your user the owner of the directory. This will be the working directory for the remainder of this section.
    • <source lang="bash">$ mkdir /usr/local/var/dreamfactory</source>
  2. Navigate to the working directory and use git to clone the dreamfactory repo
  3. Use composer to get dependencies
    • Note for commercial users: Copy your commercial license files into the working directory before running this command.
    • <source lang="bash">$ composer install --no-dev</source>
  4. Setup the DreamFactory system database connection
    • <source lang="bash">$ php artisan dreamfactory:setup</source>
      • Select option 1 for MySQL. Answer the onscreen prompts regarding database connection and credentials (which you set in the Database section.)
    • <source lang="bash">$ php artisan dreamfactory:setup</source>
      • Answer the onscreen prompts to create your first admin user for the system.
  5. Clear the application cache
    • <source lang="bash">$ php artisan cache:clear</source>

Web Server

DreamFactory relies on a web server application to serve the REST endpoints as well as the admin application to users. Options are Nginx and Apache.

Nginx

  1. Install Nginx from Homebrew
    • <source lang="bash">$ brew install nginx</source>
  2. Start Nginx and set to autostart on boot
    • <source lang="bash">$ brew services start nginx</source>
  3. Navigate to the configuration directory
    • <source lang="bash">$ cd /usr/local/etc/nginx</source>
  4. Edit the config
    • <source lang="bash">$ vim nginx.conf</source>
    • Find the section that starts with server {. You should edit this entire section so that it looks like this:
    • server {}
    • Save and exit the file
  5. Create and edit the php-fpm config for nginx
    • <source lang="bash">$ mkdir conf.d</source>
    • <source lang="bash">$ vim conf.d/php-fpm</source>
    • Edit this file so it looks like this:
    • location ~ \.php$ {try_files $uri = 404;fastcgi_pass 127.0.0.1:9000;fastcgi_index index.php;fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;include fastcgi_params;}
    • Save and exit the file