Wednesday, February 17, 2021

How to install Drush using composer on Ubuntu 16.04

 


Installing/Upgrading Drush on Ubuntu

Step 1:  Updating

As a matter of good practices, we’ll update our system

sudo apt-get update

Step 2:  Install Zip

Most likely you’ll already have the zip command but if you don’t go ahead and install.

sudo apt-get install zip unzip

Step 3: Install Curl

sudo apt-get install curl php7-cli git

Step 4: Install Composer

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Step 5: Install Drush

Using the following command will install the newest version of Drush, at this time it is

composer global require drush/drush

Alternatively, you can install the Drush version of your choice by appending the version needed.  If you’d like Drush 8 use…

composer global require drush/drush:8

Step 6: Add Drush Directory to Your Path

If performing the version check in Step 6 gives you the message of “command not found” then open your .bashrc file and input the following into the file

#path for Drush

export PATH="$HOME/.composer/vendor/bin:$PATH"

Run source show recognize the changes to the file.

source .bashrc

Step 7: Verify the Installation of Drush

You’ll be able to verify the version of the Drush install and other useful information by running the following command.

drush status

Output:

PHP binary     : /usr/bin/php7.0

PHP config     : /etc/php/7.0/cli/php.ini

PHP OS          : Linux

Drush script  : /root/.composer/vendor/bin/drush

Drush version : 9.5.2

Drush temp     : /tmp

Drush configs : /root/.composer/vendor/drush/drush/drush.yml

Drupal root   : /root/.composer/vendor/drush/drush/sut



renforce@renforce:~$ composer global require drush/drush:8.x

renforce@renforce:~$ drush --version 

renforce@renforce:~$ which drush

renforce@renforce:~$ cd /var/www/html/drupal8

renforce@renforce:/var/www/html/drupal8$ drush --version

 Drush Version   :  8.2.3

renforce@renforce:/var/www/html/drupal8$ drush cr

Cache rebuild complete. [ok]

renforce@renforce:/var/www/html/drupal8$ drush cr

Cache rebuild complete.   [ok]

renforce@renforce:/var/www/html/drupal8$ drush dl superfish

Project superfish (8.x-1.3) downloaded to /var/www/html/drupal8//modules/superfish. [success]

renforce@renforce:/var/www/html/drupal8$ drush en superfish

The following extensions will be enabled: superfish

Do you really want to continue? (y/n): y

superfish was enabled successfully. [ok]

 

Bug Query:-
Step 1: Error If you get the error like..



 Step 2: Run this command but first you have to check global composer and drush are install in your pc.

composer require --dev drush/drush


Step 3: Now check drush version.



No comments:

Post a Comment

If you have any problem please let me know.