Updated on 20 October 2017
If you are still unsure and want a flight check of the Drupal core - or any other Drupal project - straight from the comfort of your browser, just have a look at the Simplytest.me service. If you are ready to roll, lift off!
All you need here is a recent PHP version (5.6+), Composer, and limited knowledge of a terminal.
If everything goes well it should be less than a 5 minute process...
hey, let's try something faster than Wordpress ; )
You can check your PHP version under your terminal with the following command.
The output should be something like
PHP 5.6.30 (cli) (built: Feb 7 2017 16:18:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
- Start from the Composer template for Drupal projects. This project is available on GitHub, but at this stage, just execute
composer create-project drupal-composer/drupal-project:8.x-dev drupal84 --stability dev --no-interaction
- Get some coffee while Composer is fetching all the dependencies, then go into the 'web' (also known as docroot) directory and launch to built in PHP server.
php -S localhost:8000
Then open http://localhost:8000 in your favourite browser and follow the installation wizard.
Based on the built in PHP server you will probably have some warning about PHP OPcode caching for performance, you can now safely ignore it and click on 'continue anyway' at the bottom of the page, we are just testing.
Prepare your database credentials or just use the SQLite option if you have no database configured yet.
Feedback more than welcome! Talk, in this one minute poll, about your Drupal 8 adoption
If everything went well, you may want to skip for now the explanations about troubleshooting and alternate methods of installation and go straight to modules and themes installation
- Check your PHP version, see Server Requirements
- Review this article about getting a lightweight PHP MySQL environment for MacOSX High Sierra
- Review this page about troubleshooting Composer
You can download the code straight from Drupal.org, although, this is really not recommanded because most of the modules are now relying on Composer to get their dependencies (e.g. Address needs Commerce Guys libraries).
Avoid using the Composer Manager module that can still be mentionned in some documentation, it was used to cover the lack of Composer support during the early stage of Drupal 8 but is now deprecated.
Alternate Composer project creation methods
- Use Composy.io
- Use Pieter Frenssen Composer template for Drupal projects fork that comes with Behat and Phing.
This is my personal favorite for two reasons : affordable unit tests and Phing based install.
- Just released in October 2017 the Drupal Composer helper intends to facilitate the update process.
Drupal Composer helper
The motive behind writing this plugin was to make a Drupal composer based setup more maintainable. It is easy to start with the template provided by drupal-composer/drupal-project but upgrading it is difficult. The plugin solves that problem by keeping all the code outside your project and in the plugin which would make upgrading as easy as running
Build Drupal sites with composer easily now:— hussainweb (@hussainweb) October 14, 2017
$ composer global require hussainweb/drupal-composer-init
$ composer drupal-init pic.twitter.com/AEf6WrRM2E
Run this command to install the composer plugin (one-time):
$ composer global require hussainweb/drupal-composer-init
To create a new composer.json file, run this command:
$ composer drupal-init
Follow the instructions on the screen to create a composer.json file.
Once the composer.json is created, run the following command to download all dependencies:
$ composer install
More resources on Drupal.org
Using Apache or Nginx server for site building and development
The PHP built in server is just enough for playing around or testing. Using a faster server is strongly recommended for site building or development.
Use an Apache or Nginx server from your host or from a virtual machine.
Just check the installation of a development environment.
Speed of the light Drupal installation
Chances are that you will adopt one of these methods once when you will need to install several Drupal projects.
How to Download and Install Drupal 8.4 using Drupal Console.
Cd in the docroot directory (e.g. 'web').
Example with a MySQL database, see also other installation methods
drush si --db-url=mysql://root:pass@localhost:port/dbname
If you are using Pieter Frenssen fork, just create a copy of build.properties.dist into build.properties.local, then drop these two lines in your terminal and grab some more coffee (you should stop).
phing install (installs Drupal)
phing setup-dev (fast setup of your dev environment).
Example of build.properties.local
The minimal settings of build.properties.local should be
# The project name, also used for the database name (avoid special chars here)
project.name = drupalship
drupal.db.password = root
# The base URL. This is used for doing functional tests in Behat and PHPUnit.
drupal.base_url = http://drupalship.dev
# Verbosity of Drush commands. Set to 'yes' for verbose output.
drush.verbose = yes
The Composer template for Drupal project (Pieter Frenssen fork included) gitignores the vendors (/vendor directory), the Drupal core and contributed modules to keep your repository clean.
It also gitignores the environment settings and user files.
So you can start to create a git repository straight from what was created by Composer. Sweet.
Another timesaver option, give at least a try to distributions, they could probably cover your needs (decoupling, commerce, improve authoring experience, ...) or at least teach you how to configure modules with well tested site building techniques.
Drupal 8.4.x server requirements.
- Web server : like Apache or Nginx on Unix or IIS on Windows
- Database : MySQL 5.5.3+, PostgreSQL 9.1.2, SQLite 3.4.2/
- PHP 5.5.9+, but...
- depending on your Drupal installation, you will need PHP 7.0+ (doctrine/inflector v1.2.0 requires php ^7.0 -> your PHP version (5.6.30) does not satisfy that requirement.)
- Drush, the Drupal shell, needs at least PHP 5.6.0.
- Do not forget that, based on your setup, the PHP version can differ between your server (Apache, ...) and the CLI.
Read this issue about the future Drupal versions: Remove PHP 5.5 and 5.6 support in Drupal 8.6
The easiest way to get started with a development environment is Drupal VM or a local PHP server.
On Mac OSX if you have already PHP and MySQL (homebrew) php -S localhost:8000
We are just talking here about installation, uninstallation and update.
You can also find a list of most installed projects.
Get the project name, it is the URL suffix. E.g. for the Search API module, use search_api, use Composer on the directory of your composer.json file (most of the time, the parent directory of the docroot).
composer install drupal/search_api
If you want a specific version of a module, append the suffix that is right after the 8.x- reference on the project page or run
composer install drupal/search_api:1.x-dev
Then install it via the administration interface (/admin/modules) or use drush under the docroot directory
drush en search_api
For distributions, just follow the method recommanded by the maintainer as it can have some variations.
Uninstall it from the administration interface (/admin/modules/uninstall) or use
drush pmu my_module.
Then remove it via Composer
composer remove drupal/my_module
Update a project
Let's say that we want to update the address project
composer update drupal/address --with-dependencies
Update the core
composer update drupal/core --with-dependencies
Then, in any case, check if a database update is necessary.
drush updb or go to /update.php
Now that you have a Drupal site installed, you can go on with the site building by learning some Drupal concepts.
Oh, one more, if something does not seem to be there after installing a project "keep calm and clear the cache".
Head to /admin/config/development/performance and hit the Clear all caches button or use
drush cr (Drush cache rebuiltd, was drush cc all in Drupal 7).
See also the Drupal tools for developers to setup a development environment, it will avoid you to clear the cache constantly during the build.
This video is an update of the Drupal Dev Days Seville 2017 presentation: Deploying Drupal: Patterns and Antipatterns
Regarding Composer, this post about Composer documentation for Drupal will bring new clues.
Production routines will be detailed later on. Meanwhile, have a look at the production checklist.
You can also have a look at the host page for staging and production environments that are suitable for Drupal 8.