How to install Drush 9 and Composer for Drupal 8

DRUSH 9

Installing composer on Linux system

What is composer

Composer is a tool for dependency management in PHP or Drupal 8 website. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you, Lets see how to install composer in our system globally so that all user on system can access that.

1. Firstly, Download composer using curl from your home directory

$ sudo curl -sS https://getcomposer.org/installer | php

2. Now, Move composer.phar file to bin directory

$ sudo mv composer.phar /usr/local/bin/composer

3. Now create a symbolic link

$ sudo ln -sf /usr/local/bin/composer /usr/bin/composer

4. To check composer

$ composer

Installing Drush 9 on Linux system

What is Drush

Drush is command line interface for drupal sites. It is a very useful tool as it helps you perform various admin tasks using just one or two commands in the terminal (like drupal core update, database update, enabling druapl module,s etc). Now lets see how to install drush 9 globally so that all users on system can access that.

1. Go to /usr/local/bin directory

$ cd /usr/local/bin

2. Download drush using composer

$ sudo composer require drush/drush:9.x

3. It will create a vendor folder in /usr/local/bin automatically

4. Now create a symbolic link

$ sudo ln -sf /usr/local/bin/vendor/drush/drush /usr/bin/drush

5. To check Drush 9

drush status

NOTE

$ sudo composer require drush/drush:dev-master

We recommend to download the latest development version of drush

To download a stable version of drush you'll need to explicitly mention the version number as I did

References

  • https://www.digitalocean.com/community/questions/how-to-install-drush-on-lamp-16-04
  • https://drupal.stackexchange.com/questions/117712/drush-installed-globally-via-composer-as-root-user-but-how-to-access-drush-with
  • https://modulesunraveled.com/blog/install-drush-7-and-8-and-automatically-switch-versions-based-project http://blog.netgloo.com/2016/05/14/installing-drush-via-composer/

+1-800-712-8823

2901 E Baltimore St, Baltimore, MD 21224

info@simpleinformation.com

Contact us