Installing Directus 7 on LAMP
Before you can experience all of the awesome features within Directus 7, you first need to install it. In this article, I’ll show you how to get started with Directus.
This tutorial assumes you have a LAMP (Linux, Apache, MySQL, PHP) stack pre-installed. If you don’t have a server yet, I highly recommend getting a DigitalOcean droplet with a LAMP one-click install.
If you already have a VPS with a clean Ubuntu installation, I recommend you follow this tutorial on installing the LAMP stack.
The following steps should work for other versions of Ubuntu, and even other operating systems, but not all of these combinations have been tested.
Installing Directus using SSH & Git (recommended)
PHP, Apache & MySQL setup
Directus requires PHP’s cUrl extension to be installed, so let’s start by installing that:sudo apt-get install php-curl
Directus also requires mod_rewrite
to be enabled. You can enable mod_rewrite
by runningsudo a2enmod rewrite
and making sure that the following config is set in /etc/apache2/sites-available/000-default.conf
.
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
(Make sure to restart the apache2 service after making changes to the config by running: sudo systemctl restart apache2
)
Cloning Directus from GitHub
Next up, navigate to /var/www/html
by running cd /var/www/html
. This is Apache’s default public folder in which we’ll install Directus.
Next up, clone Directus from GitHub as follows:git clone https://github.com/directus/directus.git
This clones the master branch of Directus to a folder called directus
.
Note: the owner of the directus
folder may be set to root
if you clone Directus directly. Make sure to change the owner back to www-data
otherwise Directus won’t have write-access to important locations like /uploads
. You can reset the permissions by running sudo chown www-data -R /var/www/html/directus
.
Pointing Apache to Directus
The last thing that’s left is making sure that Apache is using Directus as the document root. This will ensure that bad actors have no way to access the private data in your system and will put the API endpoints in the root. This allows you to retrieve your data from /
and access the admin app at /admin
.
With Directus installed, you’re ready to start creating something amazing!
Your friends at Directus
🐰