WSL2 for Bioinformatics: GROMACS, Vina, Open Babel
Skip to content

Set Up WSL2 for GROMACS, Vina and Open Babel

Set Up WSL2 for GROMACS, Vina and Open Babel

Run wsl --install in an administrator PowerShell on Windows 10 build 19041 or later, restart, then create your Ubuntu user. Inside that Ubuntu shell, sudo apt install gromacs openbabel gives you gmx and obabel, and AutoDock Vina runs from the pre-compiled Linux binary on its GitHub releases page.

Almost every tutorial in computational chemistry assumes you are sitting at a Linux prompt. You are not. You have a Windows laptop, the department cluster account has not arrived yet, and the install page for the tool you need starts with sudo apt. The usual advice is to dual boot, which costs you a partition and an afternoon, or to run a virtual machine, which costs you performance. There is a third option that most students are not told about clearly enough. This guide, written by the StemSkills Lab team from 10+ years in sequence and structural bioinformatics, drug discovery and design, and multiscale molecular modeling, takes you from a stock Windows machine to a working Ubuntu shell with GROMACS, AutoDock Vina and Open Babel installed, plus the file paths and error messages that trip people up on the way. If you want the wider simulation context first, read our pillar guide on learning molecular dynamics with GROMACS, and for the order to build these skills in, see the computational biology skills roadmap.

Is WSL2 good enough for real MD and docking, or do you need to dual boot?

WSL2 is not an emulator and it is not the old WSL1 translation layer. It runs a real Linux kernel in a lightweight managed virtual machine, so the binaries you install are ordinary Linux binaries doing ordinary Linux work. For coursework, ligand preparation, docking runs, tutorial-scale MD systems and every bit of scripting and analysis around them, it is the right tool. For a 200 ns production run on a solvated membrane protein, you want the cluster regardless of which operating system is on your laptop.

OptionSetup costWindows apps at the same timeGPU accessBest for
WSL2One command plus a restartYes, side by sideYes, via the Windows NVIDIA driverLearning, ligand prep, docking, tutorial MD, analysis scripts
Dual boot LinuxRepartition, installer, bootloaderNo, reboot to switchYes, native driverHeavy local MD on a workstation you control
VirtualBox or similarDownload an ISO, install a guestYesGenerally no CUDA passthroughTesting a distribution you will throw away
HPC cluster accountApply, wait, learn the schedulerNot applicableYes, sharedProduction simulations and long trajectories

The practical reason to start with WSL2 is that the skill transfers. The commands you type into Ubuntu on your laptop are the same commands you will type into the cluster later, so nothing you learn here has to be relearned.

What do you need before you run wsl –install?

Microsoft states the requirement plainly in the official WSL install documentation: you must be running Windows 10 version 2004 or higher, build 19041 or higher, or Windows 11. Check yours by pressing Windows+R, typing winver and reading the build number. You also need hardware virtualisation enabled in your BIOS or UEFI, which on most laptops it already is.

Open PowerShell as administrator, right-click and choose Run as administrator, then run the install command and restart when it asks you to.

wsl --install

That single command enables the required Windows features and installs Ubuntu as the default distribution. On first launch it asks you to create a Linux username and password, which are separate from your Windows account. The password does not echo as you type it, which is normal and not a broken keyboard.

If WSL is already present, wsl --install prints the help text instead of installing anything. In that case list what is available and pick a distribution explicitly.

wsl --list --online
wsl --install -d Ubuntu-24.04

Three commands are worth memorising on the Windows side. wsl -l -v lists your distributions with the WSL version each one uses, and you want the number 2 in that column. wsl --update pulls the latest WSL kernel. wsl --shutdown stops every running distribution, which is how you apply configuration changes and how you recover a session that has locked up.

If a distribution somehow landed on WSL 1, convert it in place:

wsl --set-default-version 2
wsl --set-version Ubuntu 2

Once Ubuntu opens, update the package lists before installing anything, because a fresh image is always behind.

sudo apt update && sudo apt upgrade -y
sudo apt install -y build-essential wget git

Where do your Windows files live inside WSL, and where should your project go?

This is the single most common source of confusion, and getting it wrong will make your simulations feel slow for reasons that have nothing to do with your hardware. Your Windows C: drive is mounted inside Ubuntu at /mnt/c, so your Downloads folder is at /mnt/c/Users/<your-windows-name>/Downloads. Going the other way, type \\wsl$ into the Windows File Explorer address bar and you will see the Linux file systems of every installed distribution. From inside Ubuntu, explorer.exe . opens the current Linux directory in File Explorer, which is the fastest way to drag a PDB file out to a Windows viewer.

You can read and write across the boundary, but you should not work there. Microsoft’s guidance in Working across file systems is explicit: “For the fastest performance speed, store your files in the WSL file system if you are working in a Linux command line.” Keep your simulation directories under your Linux home, /home/<your-linux-name>/projects, and copy finished figures out to Windows when you need them. A trajectory written to /mnt/c pays a file system translation cost on every write.

While you are setting things up, decide how much of the machine WSL2 may use. By default the VM takes 50% of your total system memory and the same number of logical processors as Windows has. Create %UserProfile%\.wslconfig in Notepad if you want to change that, then run wsl --shutdown for it to take effect.

[wsl2]
memory=8GB
processors=4

Confirm what Ubuntu actually sees with free -h and nproc before you blame a slow run on the software.

Want the guided, hands-on version?

Our live Molecular Modeling & MD Simulations cohort bootcamp takes you from zero to running real docking and MD workflows, with a portfolio project for your grad-school applications.

Join the waitlist (free) →

How do you install GROMACS inside WSL2?

There are two routes and the right one depends on whether you are learning or producing. The package manager route is one line, and Ubuntu ships a real GROMACS build in its universe repository: version 2023.3 on Ubuntu 24.04 LTS, and 2025.4 on Ubuntu 26.04 LTS, according to the Ubuntu package archive.

sudo apt install -y gromacs
gmx --version

That is enough to work through any tutorial: gmx pdb2gmx, gmx editconf, gmx solvate, gmx grompp and gmx mdrun all behave exactly as the manual describes. The trade-off is that the packaged build is not tuned to your CPU and lags the current release.

Build from source when you want the latest version or CPU-specific optimisation. The GROMACS installation guide publishes a short procedure it calls the quick and dirty installation, and it requires CMake 3.28 or later with a C++17 compiler such as gcc 11 or newer. Install those first with sudo apt install cmake, then substitute the version number of the tarball you downloaded:

tar xfz gromacs-2026.3.tar.gz
cd gromacs-2026.3
mkdir build
cd build
cmake .. -DGMX_BUILD_OWN_FFTW=ON -DREGRESSIONTEST_DOWNLOAD=ON
make
make check
sudo make install
source /usr/local/gromacs/bin/GMXRC

The -DGMX_BUILD_OWN_FFTW=ON flag downloads and compiles the FFT library for you, which removes the most common dependency failure. Do not skip make check: it runs the regression tests, and a compiler that produces subtly wrong numbers is far more expensive to discover three weeks into a project. The compile takes a while on a laptop, so start it and go and read something.

The last line is the one people forget. GMXRC puts gmx on your PATH for the current shell only, so make it permanent:

echo 'source /usr/local/gromacs/bin/GMXRC' >> ~/.bashrc

If you are citing GROMACS later, the software paper is Abraham et al., GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers, SoftwareX, 2015, 1 to 2, 19 to 25.

How do you install AutoDock Vina inside WSL2?

Vina is distributed as a self-contained Linux binary, so there is nothing to compile. Download the Linux x86_64 asset from the AutoDock Vina releases page, where v1.2.7 is the current release, then make it executable. The official documentation gives the run pattern as ./vina_<version>_<OS>_<architecture>, so use the filename you actually downloaded:

chmod +x vina_1.2.7_linux_x86_64
./vina_1.2.7_linux_x86_64 --help
sudo mv vina_1.2.7_linux_x86_64 /usr/local/bin/vina

That last move is optional and it saves you typing the full filename in every command afterwards. If you want the Python bindings for scripted virtual screening, the Vina installation documentation gives a separate route, and notes that the bindings and the binary are two different installs:

pip install -U numpy vina

Vina is worth understanding rather than just running. The original paper by Trott and Olson reports that “AutoDock Vina achieves an approximately two orders of magnitude speed-up compared to the molecular docking software previously developed in our lab (AutoDock 4), while also significantly improving the accuracy of the binding mode predictions” (Journal of Computational Chemistry, 2010, 31, 455 to 461). That hundredfold speed difference is why a screening run that would have been a cluster job in 2008 is now something your laptop finishes over lunch, and it is also why Vina became the default teaching tool for docking.

How do you install Open Babel and convert a ligand to PDBQT?

Open Babel is the translator that sits between everything else. Vina reads PDBQT, your ligand arrived as SDF or SMILES, and obabel is what closes that gap. Ubuntu packages it as openbabel, currently version 3.1.1 across the 22.04, 24.04 and 26.04 LTS releases.

sudo apt install -y openbabel
obabel -V

Three conversions cover most of what a beginner needs. Generate a 3D structure from a SMILES string, set the protonation state for physiological pH, and write the PDBQT file Vina expects with Gasteiger partial charges:

obabel ligand.smi -O ligand.sdf --gen3d
obabel ligand.sdf -O ligand_ph.sdf -p 7.4
obabel ligand_ph.sdf -O ligand.pdbqt --partialcharge gasteiger

Open the resulting PDBQT in a text editor once and look at it. Knowing that the file is plain text with atom types and charges in fixed columns is what lets you diagnose a Vina parse error in ten seconds instead of an hour. The tool paper is O’Boyle et al., Open Babel: An open chemical toolbox, Journal of Cheminformatics, 2011, 3, 33.

Which errors stop beginners, and how do you fix each one?

Every error below is one that appears on a first setup rather than an exotic edge case. Read the message, match the row, apply the fix.

What you seeWhat is actually wrongFix
Error code 0x80370102 during installHardware virtualisation is off, or the Virtual Machine Platform feature is not enabledEnable VT-x or AMD-V in BIOS or UEFI, reboot, run wsl --install again
WslRegisterDistribution failed, error 0x800701bcThe WSL2 Linux kernel component is missing or staleRun wsl --update in an administrator PowerShell, then wsl --shutdown
wsl --install prints the help textWSL is already installed, so the bare command does nothingUse wsl --list --online then wsl --install -d Ubuntu-24.04
gmx: command not found after a source buildGMXRC was sourced in a shell you have since closedecho 'source /usr/local/gromacs/bin/GMXRC' >> ~/.bashrc then reopen the shell
$'\r': command not foundA script written on Windows has CRLF line endingssudo apt install dos2unix then dos2unix yourscript.sh
Permission denied running the Vina binaryThe downloaded file is not marked executablechmod +x vina_1.2.7_linux_x86_64
Vina parse error naming a line in your PDBQTThe ligand or receptor file was converted incorrectly or has leftover hydrogens or watersRegenerate the ligand with obabel, strip waters and heteroatoms from the receptor before conversion
Everything feels slow, especially file writesThe project directory sits under /mnt/cMove the project to ~/projects in the Linux file system
A config change to .wslconfig does nothingThe VM is still running with the old settingsRun wsl --shutdown and wait roughly 8 seconds before relaunching

Can you use your NVIDIA GPU from inside WSL2?

Yes, and the rule for doing it is the one people break most often. GPU acceleration in WSL2 comes from the driver on the Windows side, not from anything you install in Ubuntu. NVIDIA’s CUDA on WSL user guide puts it in one sentence: “This is the only driver you need to install. Do not install any Linux display driver in WSL.”

Install a current NVIDIA Windows display driver, restart, then open Ubuntu and run nvidia-smi. If your card is listed, the GPU is visible to Linux. Installing a Linux display driver inside the distribution is the classic way to break a working WSL2 setup, and the symptom is a nvidia-smi that used to work and now does not. For GROMACS specifically, note that the Ubuntu package is a CPU build; running gmx mdrun on the GPU means building from source with the CUDA toolkit and -DGMX_GPU=CUDA, which is a reasonable second project once the CPU workflow runs end to end.

Frequently asked questions

Is WSL2 free, and does it need a Windows 11 Pro licence?

WSL2 is free and included with Windows. It works on Windows 10 build 19041 or later and on all editions of Windows 11, Home included. You do not need a Pro licence, a subscription, or a Microsoft Store purchase to install Ubuntu through wsl --install.

Will installing WSL2 delete or repartition my Windows files?

No. WSL2 stores the Linux file system inside a virtual hard disk file in your Windows user profile, so no repartitioning happens and your existing files are untouched. Removing a distribution later with wsl --unregister deletes only that virtual disk, which is why you should keep backups of work inside it.

Can I run VMD, PyMOL or other graphical tools from WSL2?

Yes. Recent WSL builds include WSLg, which renders Linux graphical applications in their own Windows windows without extra configuration. Install the Linux package as normal and launch it from the Ubuntu shell. Many students still prefer the native Windows build of PyMOL or VMD for viewing and keep WSL2 for computation.

Should I use apt or build GROMACS from source?

Use apt while you are learning, because it works in one line and runs every tutorial correctly. Build from source when you need a newer release, CPU-specific optimisation, or GPU support. The results are the same physics either way; source builds buy you speed and the current version, not different science.

How much disk space should I set aside?

Plan for roughly 10 GB for Ubuntu plus GROMACS, Open Babel and their dependencies, before any trajectory data. MD output grows fast, so keep an eye on df -h. The WSL2 virtual disk expands as you use it and does not shrink automatically when you delete files.

Where to go next

You now have a Linux shell on a Windows laptop with the three tools that carry most of an early computational chemistry workflow: gmx for simulation, vina for docking, and obabel for the format conversions between them. The next step is to run something end to end rather than installing more software. Take a small protein and a known ligand, prepare both, dock, then set up a short MD run on the complex, and keep every command in a script so the run is reproducible. That single exercise teaches more than another week of setup.

Want the guided, hands-on version?

Our live Molecular Modeling & MD Simulations cohort bootcamp takes you from zero to running real docking and MD workflows, with a portfolio project for your grad-school applications.

Join the waitlist (free) →

Think you know Molecular Docking?
Take the free StemSkills assessment and earn a verifiable certificate you can download and add to your LinkedIn profile.
Start the free assessment

Keep going

MODELLER Tutorial: Build a Homology Model Step by Step Install MODELLER, pick a template, write the align2d alignment, run AutoModel and rank your models by DOPE score,… How to Calculate Protein-Protein Binding Affinity Score your docked protein-protein complex with PRODIGY and HawkDock MM/GBSA, read dG and Kd correctly, and learn why… How to Remove Water Molecules From a PDB File for Docking Strip HOH waters and crystallisation additives from a PDB file with PyMOL, ChimeraX or pdb-tools, and learn which…
See live workshops