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 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. In this example, 7.4.0 is the latest version.
- Run the following as root:
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.
- If you have root access, install drush for all users:
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.
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"