Using drush7 and drush8 on debian

Using drush7 and drush8 on debian

As Drupal8 was released i had to find a way to use drush8 with Drupal8 and Drush7 for Drupal7 sites. Having drush8 installed globally i wanted to have a simple drush7 to be used when i want to configure or setup a drupal7 site. So this simple solution works like a charm:

1. make a drush7 directory within your home directory and jump into it
sudo mkdir drush7 && cd drush7
2. Install drush 7 via composer:
 sudo composer require drush/drush:7.*
3. make an alias for drush7
sudo vi ~/.bashrc
alias drush7="~/drush7/vendor/bin/drush"

4. Test if it works
drush7 status
5. Yes, the output looks like this
Drush script:  /home/username/drush7/vendor/drush/drush/drush.php
Drush version:  7.1.0

You could of course do this with all the drush versions available, so using different versions for each usecase can be accomplished very easily.