Project

General

Profile

Install drush » History » Revision 3

Revision 2 (Jon Goldberg, 11/21/2017 08:46 PM) → Revision 3/4 (Jon Goldberg, 11/21/2017 08:47 PM)

{{last_updated_at}} by {{last_updated_by}} 
 # Install drush 

 {{>toc}} 

 You can install drush via Composer, a .phar, or from git.    Your local machine may need multiple versions of drush to match the versions available on live sites.    In that instance, let's consider using the methods described on this page. 
 When installing drush on a live site, installing a .phar file is preferred.    For now, let's default to using drush 7 until [issue 1581](https://github.com/drush-ops/drush/issues/1581) is fixed, then let's standardize on drush 8. 

 ## Installing drush 7 on a production site 

 * Determine the version number for the most recent stable release of drush 7 from [this page](https://github.com/drush-ops/drush/releases).    In this example, 7.4.0 is the latest version. 
 * Run the following as root: 

 ~~~ shell 
 cd /usr/local/bin 
 wget https://github.com/drush-ops/drush/archive/7.4.0.tar.gz 
 tar xzvf 7.4.0.tar.gz 
 cd drush-7.4.0 
 # If necessary, run: apt install composer (or yum install composer) 
 composer install  
 cd .. 
 ln -s drush-7.4.0/drush drush 
 # test That it's accessible from anywhere 
 cd ~ 
 drush --version 
 ~~~ 

 ## Installing drush 8 on a production site 

 * Download the .phar file for the most recent stable release of drush 8 from [this page](https://github.com/drush-ops/drush/releases). 
 * If you have root access, install drush for all users: 

 ~~~ shell 
 chmod +x drush.phar 
 sudo mv drush.phar /usr/local/bin/drush 
 ~~~ 

 * If root access is unavailable, make it available to the logged-in user's path. 

 
 ~~~ shell 
 chmod +x drush.phar 
 mkdir $HOME/bin 
 mv drush.phar $HOME/bin 
 cd $HOME/bin 
 # If shell is bash, distro is NOT Ubuntu. 
 echo PATH=`pwd`:'$PATH' >> "$HOME/.bash_profile" 
 # If shell is bash, distro IS Ubuntu. 
 echo PATH=`pwd`:'$PATH' >> "$HOME/.profile" 
 # If shell is zsh 
 echo PATH=`pwd`:'$PATH' >> "$HOME/.zshrc" 
 ~~~