Installation Ubuntu 16
Contents
Prerequisites
DreamFactory requires certain applications for install and other functionality.
- Install git, curl, zip, unzip
- <source lang="bash">$ sudo apt-get install git curl zip unzip</source>
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
- <source lang="bash">$ sudo apt-get install php php-mbstring php-zip php-curl php-mongodb php-sqlite3 php-mysql</source>
Install for Nginx
Install
- <source lang="bash">$ sudo apt-get install php-fpm php php-mbstring php-zip php-curl php-mongodb php-sqlite3 php-mysql</source>
Configure PHP FPM
You will need a text editor for this task. The instructions use Nano which comes installed in Ubuntu
- Edit the php-fpm php.ini file
- <source lang="bash">sudo nano /ect/php/7.0/fpm/php.ini</source>
- Find the line that reads ;cgi.fix_pathinfo=1
- Change it to read cgi.fix_pathinfo=0
- Save and exit (Ctrl+x, Y, <Enter>)
Composer
Composer is a PHP dependency manager and is required for installing DreamFactory.
- Make a bin directory in your home directory if it doesn't already exist.
- <source lang="bash">$ cd ~</source>
- <sourec lang="bash">$ mkdir bin</source>
- Get the setup file from composer
- <source lang="bash">$ php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"</source>
- Install composer to your bin directory
- <source lang="bash">$ php composer-setup.php --install-dir=/home/username/bin --filename=composer</source>
- Restart your terminal app (if using Linux with a GUI) or log out and log back in.
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
- Install the server and client from Apt
- <source lang="bash">$ sudo apt-get install mariadb-server mariadb-client</source>
Setup
- Login to the database
- <source lang="bash">$ sudo mysql</source>
- 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>
- 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>
- 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.
- 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">$ sudo mkdir /opt/dreamfactory</source>
- <source lang="bash">$ sudo chown -R dfuser /opt/dreamfactory</source>
- Navigate to the working directory and use git to clone the dreamfactory repo
- <source lang="bash">$ cd /opt/dreamfactory</source>
- <source lang="bash">$ git clone https://github.com/dreamfactorysoftware/dreamfactory.git ./</source>
- Use composer to get dependencies
- Note for commercial users Copy your commercial license files into the working directory at this point.
- <source lang="bash">$ composer install --no-dev</source>
- 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.
- <source lang="bash">$ php artisan dreamfactory:setup</source>
- Reset permissions on the storage and cache directories.
- <source lang="bash">$ sudo chown -R dfuser:www-data storage/ bootstrap/cache/</source>
- <source lang="bash">$ sudo chmod -R 2775 storage/ bootstrap/cache/</source>
- Clear the application cache
- <source lang="bash">$ php artisan cache:clear