In this tutorial, we are going to provide you with step by step instructions on how to install Directus on an Ubuntu 14.04 VPS.
Directus is an open-source headless content management system written in backbone.js that provides a feature-rich environment for fast development and management of custom database schemas.
The installation process is fairly easy and it takes only a couple of minutes.
At the time of writing this tutorial, the latest stable version of Directus is 6.3.3 and it requires:
- PHP 5.5 or higher (preferably the latest), with curl, pdo_mysql, mod_rewrite, fileinfo PHP extensions and GD graphics library enabled, and memory_limit PHP variable set to 136 MB or higher
- MySQL 5.2 or higher
- Apache Web Server 2.0 or higher compiled with mod_rewrite module.
This install guide assumes that Apache is already installed and configured on your virtual Server.
Let’s start with the installation.
Update OS packages:
Make sure your server OS packages are fully up-to-date:
apt-get update apt-get upgrade
Enable Apache rewrite module if it is not already done so:
a2enmod rewrite
Install curl package using the following command:
apt-get install curl
Install Composer:
Composer is an application-level package manager for the PHP programming language. Download and install Composer using the following commands:
cd /opt curl -sS https://getcomposer.org/installer | php
Make the ‘composer.phar’ file executable:
chmod +x composer.phar
Make Composer globally available for all users on your server:
mv composer.phar /usr/local/bin/composer
Install git package using:
apt-get install git
Install Directus
Run the following command in order to download Directus on your server:
git clone https://github.com/directus/directus.git directus
Move the Directus installation to the document root directory of the web server (i.e. /var/www/html/):
mv directus/ /var/www/html/
Disable MySQL strict mode and create a new MySQL database for Directus on your server:
mysql -u root -p
mysql> CREATE DATABASE directusdb;
mysql> GRANT ALL PRIVILEGES ON directusdb.* TO ‘directususer’@’localhost’ IDENTIFIED BY ‘Your-pa55w0rd’ WITH GRANT OPTION;
mysql> SET @@global.sql_mode= ”;
mysql> FLUSH PRIVILEGES;
mysql> quit
Install the dependencies by executing:
apt-get install php5-gd php5-mcrypt php5-mysql php5-imagick imagemagick
Enable mcrypt extension and restart Apache:
php5enmod mcrypt service apache2 restart
cd /var/www/html/directus/ $ php /usr/local/bin/composer install
All files have to be readable by the web server, so set a proper ownership:
chown www-data:www-data -R /var/www/html/directus/
Open the php.ini configuration file with the following command:
vi /etc/php5/cli/php.ini
Modify the following settings:
memory_limit = 136M post_max_size = 72M upload_max_filesize = 64M
Create a new virtual host directive in Apache
For example, create a new Apache configuration file named ‘directus.conf’ on your virtual server:
touch /etc/apache2/sites-available/directus.conf ln -s /etc/apache2/sites-available/directus.conf /etc/apache2/sites-enabled/directus.conf vi /etc/apache2/sites-available/directus.conf
Then, add the following lines:
ServerAdmin [email protected]
DocumentRoot /var/www/html/directus/
ServerName your-domain.com
ServerAlias www.your-domain.com
Options FollowSymLinks
AllowOverride All
Order allow,deny
allow from all
ErrorLog /var/log/apache2/your-domain.com-error_log
CustomLog /var/log/apache2/your-domain.com-access_log common
Remove the 000-default.conf file:
rm /etc/apache2/sites-enabled/000-default.conf
Restart the Apache web server for the changes to take effect:
service apache2 restart
Open your favorite web browser, navigate to http://your-domain.com/ and if you configured everything correctly the Directus installer should be starting. You should follow the easy instructions on the install screen inserting the necessary information as requested.
After everything is completed, delete the installation directory:
rm -rf /var/www/html/directus/installation
Log in to the Directus administration back-end at http://your-domain.com/users and start using it.
That is it. The Directus has been installed on your server.
PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.