There are many ways to install software (packages) inside Linux. For this workshop, we will learn how to install using Method (1) and (4).
- Pre-built package/software or also known as binary package.
- Whenever possible, try to obtain a pre-built package or also known as binary package.
- To install, you usually just need to extract (if it is compressed) and add it to your $PATH.
- Install through package manager such as ‘apt’ or ‘yum’ or ‘dpkg’.
- the main problem with this method is you are required to have admin privileges
- in the QU-Azure HPC, normal user (non-admin privilege) will not be able to use this feature
- if you have your own linux server or your own linux laptop/desktop, you can install software using this method
- this will usually install the tools/software in the /usr/bin location
- Install from source file
- When binary package is not available and you do not have access to package manager, you can try to compile the source file.
- compiling a source file refers to the process where human written programming language (e.g., C, C++, Java) is converted into a machine language that can be directly executed by a computer.
- the process typically involves commands like
- ./configure
- make
- make install
- Once upon a time, this was the main method to install bioinformatics software for people who do not have admin privileges.
- the main problem with this method is that you need to make sure all the libraries dependency are met
- Install through Conda package manager
- this is the latest way to install many bioinformatics software
- Conda is a package manager (similar to Windows’s Add or Remove Programs)
- To install Conda
- sh Anaconda3-2024.02-1-Linux-x86_64.sh and follow the instructions
- verify Conda has been installed by typing conda –version
- To install Conda
- It can install many packages using various ‘channels’. A channel refers to the location where Conda looks to download packages.
- Add important Conda channels via conda config –append channels defaults anaconda bioconda conda-forge r
- Example of channels that are most often associated with bioinformatics are:
- defaults
- conda-forge
- bioconda
- r
- anaconda
- To search for a package in Conda
- use https://anaconda.org/
- conda search replace-with-package-name
- To install
- conda install -c replace-with-channel-name replace-with-name-of-package
- To add a channel
- conda config –add channels replace-with-channel-name
- To show channels
- conda config –show
- To create conda environment
- conda create –name ENVIRONMENT_NAME
- To activate conda environment
- conda activate reads_pre_processing
- To deactivate conda environment
- conda deactivate
Adding software to $PATH
- open .bashrc file using vim
- vim ~/.bashrc
- add the following line:
- export PATH=”/path/to/conda/bin:$PATH”
- save the .bashrc file
- source the .bashrc file (sometime you need to exit the terminal)
- source ~/.bashrc
What is bashrc file?
- The ~/.bashrc file is a script that runs every time you open a new terminal window (or a new shell). The “~” represents your home directory, and “.bashrc” is the name of the file. The dot before the file name means it’s a hidden file.
- The
~/.bashrc
file is used to configure your shell. It can contain commands, shell aliases, functions, and variables. - It’s often used to set environment variables, change the command prompt, set the default editor, and create shortcuts for commonly used commands.