Flawless updating of tools in a central user server
Posted on July 10, 2015 • 2 minutes • 331 words • Suggest Changes
Handy toolboxes such as SAMtools are getting updated, most of the time they become more useful every iteration. As sysadmin ad hoc, researchers expect to use the meanest, leanest and most cutting edge tools to do there research (unlike you’re overpriced Eyephone). However some people rely on -now- deprecated commands in “automated” scripts. Rewriting those scripts is hard (as in allot of work), learning people to read man pages/-help is close to rocket science. So most of the time we end up not updating those much used tools (or would we be just lazy?). So I came up with this method to have multiple versions installed at the same time, it is probably not the best way. But like this bad boy proves, if it fits, it sits.
# first we install the tool (this is different for every tool)
wget https://github.com/samtools/samtools/releases/download/1.2/samtools-1.2.tar.bz2 tar jxf samtools-1.2.tar.bz2 cd samtools-1.2 make
# don’t do : this will overwrite existing linked version.
make install
# now copy the samtools to the binary’s
cp samtools /usr/local/bin/samtools1.2
Now the user can just call
samtools1.2
for the fancy new version; while the old version can be called upon using :
samtools
The real GNU/Linux hackers obviously don’t want to type the three extra characters. Can change there $PATH variable in the profile, forcing your own binary’s to be executed before system wide binary’s. To do this permanently a user can :
# open bash profile using :
nano +10 ~/.bash_profile
# replace this line :
PATH=$PATH:$HOME/bin
# with
PATH=$HOME/bin:$PATH
# press ctrl+x (to close)
# press Y (to save)
# press enter (to agree to overwrite the existing file)
# create the bin directory in your home
mkdir ~/bin cd ~/bin
Now that you created a location and told linux to use your own binary’s, lets link them. (you could also self-compile and put them here now)
# create the link to samtools1.2
ln -s /usr/local/bin/samtools1.2 samtools
If you have a better way, let me know ! 🙂