Download and Install drupal 8/9 - Composer | Drupal 8

Download and Install drupal 8/9 - Composer

Submitted by editor on Fri, 06/09/2017 - 13:44
Question

How to Download and Install drupal 8 ?

How to Download and Install drupal 8 via composer ?

Requirements:

1. A web server (Apache or another web server)
2. Database (Mysql, MariaDB or SQLite)
3. PHP (Minimum 5.5.9)

For the developpement:
    On windows : WAMP, Docker
    On linux LAMP stack
    On Mac MAMP

Note : It is recomended to install drush (Command line shell and Unix scripting interface for Drupal).
- Install Drush on Linux
- Install Drush on Windows.

Drupal has composer repository, It is recomended to use composer.
- Install Composer on Windows
- Install Composer on Linux

Download Drupal 8 or Drupal 9.

To get the drupal 8 codes, you can use one of the three methods. Download via composer is recomended because composer get automaticly all require dependencies (Of drupal core or contrib modules).

Download drupal via composer. (Recomended methode)

# Run this command from your web server (or Virtual Machine / Virtual Host) public directory.
composer create-project drupal/recommended-project:8.9 drupal8

This will download drupal core and other libreries than in to drupal8 folder.

Download drupal 8 via drush

This method is suitable if you don't want to use composer.
# Run this command from your web server (or Virtual Machine / Virtual Host) public directory.
drush dl drupal -y

Manuel download from web.

Link : https://www.drupal.org/project/drupal
Download the 8.X.X version then uncompress to your web server (or Virtual Machine / Virtual Host) public directory.

Install Drupal 8

Before install drupal on your server, you need to create a database (MySQL/MariaDB or PostgreSQL). If you haven't a database server, you can also use SQLite.

Install Drupal via drush (Recomended).

# Using Mysql Database
# For the example, mysql database User:drupal, Password:drupal Database:drupal
drush site-install standard --db-url='mysql://drupal:drupal@localhost/drupal' --site-name=Drupal --account-name=admin --account-pass=admin  --notify=0 --account-mail=name@mail.com -y

# Using a SQLite database (Not Recomended).
drush site-install standard --db-url='sqlite://sites/default/files/.ht.db.sqlite' --site-name=Drupal8 --account-name=admin --account-pass=admin --notify=0 --account-mail=name@mail.com -y

Install Drupal from Web Interface.

Open web browser and visit the new drupal directory. You will automaticly redirect to the instalation page. Just follow the instruction on the page.
You will select the database, Enter the database details and administration details.

Download and Install modules on drupal 8.

Download contrib modules via composer.

Download via composer is recomended because composer get automaticly all require dependencies of the modules.
# Example. Module : Address
# Download.
composer require "drupal/address ~1.0"
# Then Install via drush.
drush en address -y

Download and install via Drush.

Note : drush will download any modules set as dependencies but not external libreries.
# Example : Module Admin Toolbar
drush en admin_toolbar admin_toolbar_tools -y

Manuel download from web and install via web browser (This method will NOT download dependencies automaticly).

1. Download the modul and extract to drupalroot/modules/contrib
2. Go to /admin/modules (Extend)
3. Select the module and click on 'Install'

Few usefull contrib modules

Enable few useful contrib modules.

drush en admin_toolbar admin_toolbar_tools youtube imce linkit captcha honeypot securelogin pathauto -y

Enable drupal development modules.

drush en devel kint coffee -y

Download some useful drupal modules via composer

composer require drupal/devel
composer require drupal/kint
composer require drupal/backup_migrate
composer require drupal/config_update
composer require drupal/stage_file_proxy
composer require drupal/superfish
composer require drupal/taxonomy_menu
composer require drupal/views_slideshow
composer require drupal/views_slideshow_cycle
composer require drupal/paragraphs
composer require drupal/youtube
composer require drupal/admin_toolbar
composer require drupal/securelogin
composer require drupal/imce
composer require drupal/linkit:5.*
composer require drupal/imce
composer require drupal/captcha
composer require drupal/pathauto
composer require drupal/workbench
composer require drupal/workbench_moderation
composer require drupal/imagecache_external
composer require drupal/honeypot
composer require drupal/simple_analytics
composer require drupal/adsense
composer require drupal/entity_update

 

Check package update

Any package
composer outdated
Drupal packages
composer outdated drupal/*

 

Comments

Another option

This method is n't the best but working.
Create an empty folder and run following commands from the folder.

# Get drupal Project
composer require drupal/drupal
#Move files
mv vendor/drupal/drupal/*  vendor/drupal/drupal/.*
# Note : This will display following erroe messages but don' warry.
# mv: cannot move 'vendor/drupal/drupal/.' to './.': Device or resource busy
# mv: cannot move 'vendor/drupal/drupal/..' to './..': Device or resource busy
# Remove drupal dir
rm -r vendor/drupal/
# Update
composer update

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.