How to Install Drush on Brand New Debian Linux Server

How to Install Drush on Brand New Debian Linux Server

I got brand new Debian Linux installation. One thing which cannot miss there is Drush command. Previously I installed it using this tutorial made by linda.com. But since Drush moved to Github.com it’s not actual anymore (but still very helpful for newbie like me so watch it).

Instructions which were actual in the time of writing this article are available on Github.com. I started from thre  because I didn't know what I know now:

1. Go to /usr/local/share directory

cd /usr/local/share

2. Download latest stable Drush

wget https://github.com/drush-ops/drush/archive/master.zip

3. Unzip archive

unzip master.zip

Note: You may miss zip and unzip command as I did so run:

apt-get install zip
apt-get install unzip

4. Remove .zip and rename folder

rm *zip
mv drush-master drush

Note: We can check what's inside.

cd drush
ls -all

5. Link 2 folders and try to run Drush

ln -s /usr/local/share/drush/drush /usr/local/bin/drush
drush

And I got another error:

Unable to load autoload.php. Drush now requires Composer in order to install its dependencies and autoload classes. Please see README.md.

Advertisement

I need to install some incomprehensible dependency  called Composer. Why are developers doing this? I googled out what is it and how to download and install Composer. Luckily it's "easy" to do.

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer

But I realized that my brand new VPS server (Ubuntu) do not support curl command so I wrote an article on how to install Curl manually. When I installed all what I needed (curl, composer) I run through all this commands from drush installation guide:

sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
source $HOME/.bashrc

One command was with a note "to install Drush 7.x (dev) which is required for Drupal 8" but at the time of writing Drush 7 was fully developed (they probably didn't update documentation) but I rut it so:

composer global require drush/drush:dev-master
composer global update

Restart apache for every case:

/etc/init.d/apache2 restart

And that's it! I have newest Drush on my Debian Linux server.

Advertisement

Post is listed in the Drupal category and marked with the following tag(s): Linux, Server, Ubuntu.