Currently, all of us were using a single version of drush on our system. But developers who are working on different Drupal versions(7,8 and 9) need the different versions of drush. So here we are looking into installing different versions of drush using 6 simple steps.
1. Create a folder drush on your home
$ mkdir drush
2. Inside drush folder create folders for different versions(eg:- 8, 9, 10)
$ mkdir 9
3. Navigate to one of the folder
$ cd /home/user/drush/9
4. Install drush9
$ composer require drush/drush:9.x
5. Navigate to the usr/local/bin folder
6. Add drush alias you want to run(Here drush9 is the name added for the drush 9 version)
$ sudo ln -s /home/user/drush/9/vendor/bin/drush drush9
Continue these steps on other folders also.
(On folder 8 install drush 8 and add alias as drush8
Similarly for 10 install drush 10 and add alias as drush10)
NB:- The latest version of drush is 11, so we prefer installing version 11 and using the alias as drush itself