Linux software installation: Difference between revisions

From 22115
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
The commands assume you are using the [https://ubuntu.com/server/docs/package-management apt package manager] used on e.g. Ubuntu Linux.
The commands assume you are using the [https://ubuntu.com/server/docs/package-management apt package manager] used on e.g. Ubuntu Linux.


'''Note''': If your computer uses a CPU based on the ARM architecture, rather than the more common Intel or AMD (x86_64) architectures, some commands may need to be adjusted. Please let me know if this applies to you, so I can provide additional instructions tailored for ARM-based systems
'''Note (ARM CPUs)''': These instructions assume an Intel/AMD (x86_64) CPU. If you are on an ARM-based machine: '''Apple Silicon (M-series) Mac users should follow the [[MacOS_software_installation|macOS instructions]] instead''' — everything works there. Running these Linux instructions on genuine ARM hardware (e.g. ARM Windows via WSL) is uncommon; most tools still work, but a few precompiled programs (notably PAUP*) have no ARM build. If this applies to you, please get in touch and we will find a working setup.


  # Use the out-commented commands below if you want to copy my premade .bashrc file for customising bash
  # Use the out-commented commands below if you want to copy my premade .bashrc file for customising bash
Line 16: Line 16:


  # Java
  # Java
  sudo apt install openjdk-17-jre
# NOTE: install the JDK (not just the JRE): its headers are needed to build BEAGLE's
# Java/JNI plugin below, which is what lets BEAST use BEAGLE. The JDK also runs the
# Java-based tools (BEAST, jModelTest, Tracer, ...).
  sudo apt install openjdk-17-jdk


  # Nedit
  # Nedit
Line 23: Line 26:
  sudo apt -y install nedit
  sudo apt -y install nedit


  # MrBayes
  # MrBayes + BEAGLE library (the BEAGLE library is shared with BEAST X, see below)
  # Note: I am using the flag --disable-sse to avoid crashes on some machines
#
  # It is possible that mb will run faster if you omit this flag
# We build the BEAGLE library (CPU-only) into /usr/local, then build MrBayes against it
  sudo apt -y install git
  # with MPI enabled (one MCMC chain per core) and SSE kept ON. BEAGLE is built with its
# Java/JNI plugin so that BEAST X further down uses this SAME library automatically.
# Linking MrBayes to BEAGLE also removes the need for the old --disable-sse workaround.
#
  # Build tools + MPI library
  sudo apt -y install git cmake build-essential libopenmpi-dev openmpi-bin
#
# 1) Build and install the BEAGLE library, CPU-only, with Java/JNI (so BEAST can use it)
# (this looks up the latest RELEASED BEAGLE version, so the instructions need no updating)
BEAGLE_TAG=$(git ls-remote --tags --refs https://github.com/beagle-dev/beagle-lib.git 'v*' | sed 's|.*/||' | sort -V | tail -n1)
git clone --depth=1 --branch "$BEAGLE_TAG" https://github.com/beagle-dev/beagle-lib.git ~/beagle-lib
cd ~/beagle-lib
JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) cmake -S . -B build -DBUILD_OPENCL=OFF -DBUILD_CUDA=OFF -DBUILD_JNI=ON
cmake --build build -j
sudo cmake --install build
sudo ldconfig
cd ~
#
# 2) Build and install MrBayes with MPI + BEAGLE
  git clone --depth=1 https://github.com/NBISweden/MrBayes.git ~/MrBayes
  git clone --depth=1 https://github.com/NBISweden/MrBayes.git ~/MrBayes
  cd ~/MrBayes
  cd ~/MrBayes
  ./configure --disable-sse
  ./configure --with-mpi --with-beagle=/usr/local
  make
  make
  sudo make install
  sudo make install
  cd ..
  cd ~


  # PAUP
  # PAUP
Line 40: Line 61:
  gunzip paup4a169_ubuntu64.gz
  gunzip paup4a169_ubuntu64.gz
  chmod 755 paup4a169_ubuntu64
  chmod 755 paup4a169_ubuntu64
  sudo mv paup4a169_ubuntu64 /usr/local/bin/paup4a169  
  sudo mv paup4a169_ubuntu64 /usr/local/bin/paup4a169
  mkdir -p ~/opt/paup-compat
  mkdir -p ~/opt/paup-compat
  wget https://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-7/libgfortran4_7.5.0-6ubuntu2_amd64.deb
  wget https://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-7/libgfortran4_7.5.0-6ubuntu2_amd64.deb
Line 47: Line 68:
  dpkg-deb -x libgfortran4_7.5.0-6ubuntu2_amd64.deb ~/opt/paup-compat
  dpkg-deb -x libgfortran4_7.5.0-6ubuntu2_amd64.deb ~/opt/paup-compat
  cat >> ~/.bashrc <<'EOF'
  cat >> ~/.bashrc <<'EOF'
 
  # PAUP* wrapper: add compat libs (libpython2.7, libgfortran4) at runtime
  # PAUP* wrapper: add compat libs (libpython2.7, libgfortran4) at runtime
  paup () {
  paup () {
Line 53: Line 74:
   /usr/local/bin/paup4a169 "$@"
   /usr/local/bin/paup4a169 "$@"
  }
  }
 
  EOF
  EOF
  rm libgfortran4_7.5.0-6ubuntu2_amd64.deb libpython2.7_2.7.18-1~20.04.7_amd64.deb
  rm libgfortran4_7.5.0-6ubuntu2_amd64.deb libpython2.7_2.7.18-1~20.04.7_amd64.deb
Line 75: Line 96:


  # BEASTX
  # BEASTX
# NOTE: BEAST X automatically uses the BEAGLE library we built into /usr/local above
# (the BEAST launcher searches /usr/local/lib), so BEAST and MrBayes share the same
# BEAGLE. Nothing extra to install here for BEAGLE.
  wget https://github.com/beast-dev/beast-mcmc/releases/download/v10.5.0/BEAST_X_v10.5.0.tgz
  wget https://github.com/beast-dev/beast-mcmc/releases/download/v10.5.0/BEAST_X_v10.5.0.tgz
  sudo tar -zxvf BEAST_X_v10.5.0.tgz --directory /usr/local/src
  sudo tar -zxvf BEAST_X_v10.5.0.tgz --directory /usr/local/src
Line 131: Line 155:


  # Set up molevol directory for course exercises
  # Set up molevol directory for course exercises
  # You can place this directory anywhere you prefer:  
  # You can place this directory anywhere you prefer:
  # Just replace tilde (~) in the command below with path to preferred base directory
  # Just replace tilde (~) in the command below with path to preferred base directory
  # (The tilde symbol is short for the user's home directory)
  # (The tilde symbol is short for the user's home directory)
Line 142: Line 166:
; R, RStudio
; R, RStudio
* NOTE: windows users should install the native Windows version and use that
* NOTE: windows users should install the native Windows version and use that
* Download newest version of R from [https://cran.rstudio.com CRAN] and follow instructions to install.  
* Download newest version of R from [https://cran.rstudio.com CRAN] and follow instructions to install.
* Download newest version of RStudio from [https://posit.co/download/rstudio-desktop/ posit.co] and follow instructions
* Download newest version of RStudio from [https://posit.co/download/rstudio-desktop/ posit.co] and follow instructions



Revision as of 13:08, 7 July 2026

These are instructions for how to install software and data used on the course Computational Molecular Evolution (22115) when using the Linux operating system.

The commands assume you are using the apt package manager used on e.g. Ubuntu Linux.

Note (ARM CPUs): These instructions assume an Intel/AMD (x86_64) CPU. If you are on an ARM-based machine: Apple Silicon (M-series) Mac users should follow the macOS instructions instead — everything works there. Running these Linux instructions on genuine ARM hardware (e.g. ARM Windows via WSL) is uncommon; most tools still work, but a few precompiled programs (notably PAUP*) have no ARM build. If this applies to you, please get in touch and we will find a working setup.

# Use the out-commented commands below if you want to copy my premade .bashrc file for customising bash
# WARNING: do not owerwrite a pre-existing .bashrc unless you are sure it contains nothing you want to keep
# NOTE: if you are using a different shell, then you should use the corresponding .rc file (e.g., .zshrc for zsh)
# wget https://teaching.healthtech.dtu.dk/material/22115/bashrc.txt
# mv bashrc.txt ~/.bashrc
# Compiler, make, other system tools needed below
sudo apt-get install build-essential
# Java
# NOTE: install the JDK (not just the JRE): its headers are needed to build BEAGLE's
# Java/JNI plugin below, which is what lets BEAST use BEAGLE. The JDK also runs the
# Java-based tools (BEAST, jModelTest, Tracer, ...).
sudo apt install openjdk-17-jdk
# Nedit
# NOTE: you can use any plain-text editor you prefer
sudo apt update
sudo apt -y install nedit
# MrBayes + BEAGLE library (the BEAGLE library is shared with BEAST X, see below)
#
# We build the BEAGLE library (CPU-only) into /usr/local, then build MrBayes against it
# with MPI enabled (one MCMC chain per core) and SSE kept ON. BEAGLE is built with its
# Java/JNI plugin so that BEAST X further down uses this SAME library automatically.
# Linking MrBayes to BEAGLE also removes the need for the old --disable-sse workaround.
#
# Build tools + MPI library
sudo apt -y install git cmake build-essential libopenmpi-dev openmpi-bin
#
# 1) Build and install the BEAGLE library, CPU-only, with Java/JNI (so BEAST can use it)
# (this looks up the latest RELEASED BEAGLE version, so the instructions need no updating)
BEAGLE_TAG=$(git ls-remote --tags --refs https://github.com/beagle-dev/beagle-lib.git 'v*' | sed 's|.*/||' | sort -V | tail -n1)
git clone --depth=1 --branch "$BEAGLE_TAG" https://github.com/beagle-dev/beagle-lib.git ~/beagle-lib
cd ~/beagle-lib
JAVA_HOME=$(dirname $(dirname $(readlink -f $(which javac)))) cmake -S . -B build -DBUILD_OPENCL=OFF -DBUILD_CUDA=OFF -DBUILD_JNI=ON
cmake --build build -j
sudo cmake --install build
sudo ldconfig
cd ~
#
# 2) Build and install MrBayes with MPI + BEAGLE
git clone --depth=1 https://github.com/NBISweden/MrBayes.git ~/MrBayes
cd ~/MrBayes
./configure --with-mpi --with-beagle=/usr/local
make
sudo make install
cd ~
# PAUP
# NOTE: the linux version of paup has some issues with being linked against older libraries
# I have tried a work-around below, but there may be issues
wget https://phylosolutions.com/paup-test/paup4a169_ubuntu64.gz
gunzip paup4a169_ubuntu64.gz
chmod 755 paup4a169_ubuntu64
sudo mv paup4a169_ubuntu64 /usr/local/bin/paup4a169
mkdir -p ~/opt/paup-compat
wget https://archive.ubuntu.com/ubuntu/pool/universe/g/gcc-7/libgfortran4_7.5.0-6ubuntu2_amd64.deb
wget https://archive.ubuntu.com/ubuntu/pool/universe/p/python2.7/libpython2.7_2.7.18-1~20.04.7_amd64.deb
dpkg-deb -x libpython2.7_2.7.18-1~20.04.7_amd64.deb ~/opt/paup-compat
dpkg-deb -x libgfortran4_7.5.0-6ubuntu2_amd64.deb ~/opt/paup-compat
cat >> ~/.bashrc <<'EOF'
# PAUP* wrapper: add compat libs (libpython2.7, libgfortran4) at runtime
paup () {
  export LD_LIBRARY_PATH="$HOME/opt/paup-compat/usr/lib/x86_64-linux-gnu:${LD_LIBRARY_PATH:-}"
  /usr/local/bin/paup4a169 "$@"
}
EOF
rm libgfortran4_7.5.0-6ubuntu2_amd64.deb libpython2.7_2.7.18-1~20.04.7_amd64.deb
# IQ-TREE 3
wget https://github.com/iqtree/iqtree3/releases/download/v3.0.1/iqtree-3.0.1-Linux.tar.gz
sudo tar -xvf iqtree-3.0.1-Linux.tar.gz --directory /usr/local/src
echo "alias iqtree3='/usr/local/src/iqtree-3.0.1-Linux/bin/iqtree3'" >> ~/.bashrc
# PAML
wget https://github.com/abacus-gene/paml/releases/download/v4.10.10/paml-4.10.10-linux-x86_64.tar.gz
tar -xvf paml-4.10.10-linux-x86_64.tar.gz
sudo cp paml-4.10.10-linux-x86_64/bin/* /usr/local/bin
rm -r paml-4.10.10-linux-x86_64*
# jmodeltest
wget https://github.com/ddarriba/jmodeltest2/files/157117/jmodeltest-2.1.10.tar.gz
sudo tar -xvf jmodeltest-2.1.10.tar.gz --directory /usr/local/src
rm jmodeltest-2.1.10.tar.gz
echo "alias jmodeltest='java -jar /usr/local/src/jmodeltest-2.1.10/jModelTest.jar'" >> ~/.bashrc
# BEASTX
# NOTE: BEAST X automatically uses the BEAGLE library we built into /usr/local above
# (the BEAST launcher searches /usr/local/lib), so BEAST and MrBayes share the same
# BEAGLE. Nothing extra to install here for BEAGLE.
wget https://github.com/beast-dev/beast-mcmc/releases/download/v10.5.0/BEAST_X_v10.5.0.tgz
sudo tar -zxvf BEAST_X_v10.5.0.tgz --directory /usr/local/src
echo 'PATH="/usr/local/src/BEASTv10.5.0/bin${PATH:+:${PATH}}"' >> ~/.bashrc
# FigTree
sudo apt -y install figtree
# Tracer
wget https://github.com/beast-dev/tracer/releases/download/v1.7.2/Tracer_v1.7.2.tgz
sudo mkdir /usr/local/src/Tracer
sudo tar -zxf Tracer_v1.7.2.tgz --directory /usr/local/src/Tracer
sudo ln -s /usr/local/src/Tracer/bin/tracer /usr/local/bin/
rm Tracer_v1.7.2.tgz
# TempEst
wget --content-disposition 'https://tree.bio.ed.ac.uk/download.php?id=102&num=3'
sudo tar -zxf TempEst_v1.5.3.tgz --directory /usr/local/src/
sudo chmod 755 /usr/local/src/TempEst_v1.5.3/bin/tempest
sudo ln -s /usr/local/src/TempEst_v1.5.3/bin/tempest /usr/local/bin/
rm TempEst_v1.5.3.tgz
# MAFFT
sudo apt -y install mafft
# Aliview
wget https://ormbunkar.se/aliview/downloads/linux/linux-version-1.30/aliview.install.run
chmod 755 aliview.install.run
sudo ./aliview.install.run
rm aliview.install.run
# Anders Gorm software: sumt, seqconverter, phylotreelib
# https://github.com/agormp/phylotreelib
# https://github.com/agormp/sumt
# https://github.com/agormp/seqconverter
sudo apt-get install python3-pip
pip3 install seqconverter
pip3 install phylotreelib
pip3 install sumt
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
# maxalign tool (see: https://bmcbioinformatics.biomedcentral.com/articles/10.1186/1471-2105-8-312)
wget https://teaching.healthtech.dtu.dk/material/22115/maxalign.pl
chmod 755 maxalign.pl
sudo mv maxalign.pl /usr/local/bin
# Dependencies for R-packages
sudo apt -y install libcurl4-openssl-dev libxml2-dev libgit2-dev libopenblas-base
# Clean up
sudo apt autoremove --purge
sudo apt clean
# Activate changes to .bashrc in current shell
source ~/.bashrc
# Set up molevol directory for course exercises
# You can place this directory anywhere you prefer:
# Just replace tilde (~) in the command below with path to preferred base directory
# (The tilde symbol is short for the user's home directory)
cd ~
mkdir molevol
wget https://teaching.healthtech.dtu.dk/material/22115/data.tar.gz
tar -xvf data.tar.gz --directory molevol
rm data.tar.gz
R, RStudio
  • NOTE: windows users should install the native Windows version and use that
  • Download newest version of R from CRAN and follow instructions to install.
  • Download newest version of RStudio from posit.co and follow instructions
# R packages (do this inside Rstudio)
install.packages("tidyverse")
install.packages("bayesplot")
install.packages("hexbin")