Install Mrbayes software running multi-threaded on WSL (Windows Subsystem for Linux)
- WSL1;
- beagle-lib-3.1.2;
- openmpi-4.1.5;
- mrbayes-3.2.7;
To install WSL1, please take a look at the official tutorial of WSL. Or download WSL distribution in the Windows Microsoft store.
First, enable the WSL function, Follow these steps:
Windows Control Panel -> Programs and Features -> Turn Windows features on or off -> √ Windows Subsystem for Linux -> Restart.
WSL2 is turned on by default and needs to be set to WSL1 in Powershell.
Set the default WSL version to WSL1:
wsl --set-default-version 1
Then search for WSL in the Windows Microsoft Store to download Ubuntu 22.04.4 LTS-WSL (You can also choose Debian, etc.).
After the download is complete, install it and set the username and password after installation.
WSL1 is installed successfully.
sudo apt-get update && sudo apt-get upgrade # Update sources and packages
sudo apt-get install -y gcc cmake build-essential autoconf automake subversion libtool git pkg-config openjdk-11-jdk
Download beagle-lib-3.1.2.tar.gz, mrbayes-3.2.7.tar.gz, and openmpi-4.1.5.tar.gz in Releases (Note: I haven’t tried a higher version of beagle. I don’t know if it applies to Mrbayes3.2.7.).
Download and extract beagle-lib-3.1.2.tar.gz, mrbayes-3.2.7.tar.gz, and openmpi-4.1.5.tar.gz to any location in Windows (example path: C:\Mrbayes-Mpi_in_WSL-Package).
Copy beagle-lib-3.1.2.tar.gz, mrbayes-3.2.7.tar.gz, and openmpi-4.1.5.tar.gz to WSL, and then unzip it.
cp /mnt/d/Mrbayes-Mpi_in_WSL-Package/beagle-lib-3.1.2.tar.gz /home/username/
tar -xzvf beagle-lib-3.1.2.tar.gz
cp /mnt/d/Mrbayes-Mpi_in_WSL-Package/mrbayes-3.2.7.tar.gz /home/username/
tar -xzvf mrbayes-3.2.7.tar.gz
cp /mnt/d/Mrbayes-Mpi_in_WSL-Package/openmpi-4.1.5.tar.gz /home/username/
tar -xzvf openmpi-4.1.5.tar.gz
Installation sequence: beagle-lib-3.1.2 -> openmpi-4.1.5 -> mrbayes-3.2.7.
cd
cd beagle-lib-3.1.2 && ll
./configure
make
sudo make install
Configure environment variables
vim ~/.bashrc
Add the following to the end of the .bashrc file
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
source ~/.bashrc
cd
cd openmpi-4.1.5 && ll
./configure
make
sudo make install
Configure environment variables
vim ~/.bashrc
Add the following to the end of the .bashrc file
MPI_HOME=/usr/local/openmpi
export PATH=${MPI_HOME}/bin:$PATH
export LD_LIBRARY_PATH=${MPI_HOME}/lib:$LD_LIBRARY_PATH
export MANPATH=${MPI_HOME}/share/man:$MANPATH
source ~/.bashrc
Verify installation
cd examples && ll
make
mpirun -np 4 hello_c
cd
cd mrbayes-3.2.7/ && ll
./configure --with-mpi --with-beagle
make
sudo make install
Thus, the installation was successful
mpirun -np 4 mb # 4 cores running Mrbayes (number of cores depends on computer CPU)