Managing Drupal 7 & 8 with drush
Like many Drupal companies we're gearing up for Drupal 8 while still developing mainly in Drupal 7. As such, we need an easy way to manage both versions with Drush. There are some excellent guides out there for Mac OS (eg http://www.newmediacampaigns.com/blog/install-drush-for-drupal-7) but I didn't find instructions for the kind of set up I needed just for Ubuntu so here's the steps I followed in case anyone else wishes to do the same.
First off, apt-get curl if you don't already have it using apt-get. You need curl to get composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
Now it's in the right place (or else move it there if you didn't ask for it to be put in /usr/local/bin)
Make sure that composer is in your system path:
Get drush - let's get 7 and 8 and look after them both with composer (not apt-get) from now on:
composer global require drush/drush:7.*
So now drush 7 is my global (ie default drush) but I want 8 too so cd into .composer/vendor (if you want to put drush 8 next to your global drush)
composer require drush/drush:dev-master (not global)
sed -i '1i export PATH="$HOME/.composer/vendor/bin:$PATH"' $HOME/.bashrc
Don't forget to ~/.bashrc to reload your changes
Now run drush + cmd as you would normally in any d7 site & use drush8 + cmd in any d8 site.