Updates
As of 2025-10-23, Trellis has dropped Vagrant and Parallels in favor of Lima VMs. This means Trellis on Windows is not supported at this time.
Introduction
Roots Trellis is a complete WordPress server setup that ensures consistency across local development, staging, and production environments. While it’s traditionally easier to set up on MacOS, this guide will help you set it up on Windows using Windows Subsystem for Linux (WSL).
Key Points
- Use WSL Version 1 for Roots Trellis setup
- Install Ubuntu 20.04 (not 22.04) as Trellis currently runs on this version
- All commands must be run from WSL
Installation Steps
1. Install WSL
Follow the official guide to install WSL. Make sure to install Ubuntu 20.04.
2. Install Global Dependencies
Once Ubuntu 20.04 is installed, you’ll need these core services:
PHP 8.1
sudo add-apt-repository ppa:ondrej/nginxsudo apt updatesudo apt install php8.1 php8.1-mbstring php8.1-xml php8.1-zipHomebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"Composer
brew install composerNFS Server
sudo apt updatesudo apt install nfs-kernel-server3. Install Trellis Dependencies
Trellis relies on the following software tools:
- VirtualBox >= 6.1.38 (install on Windows)
- Vagrant >= 2.2.16 (install on both Windows and WSL)
- Ansible >= 2.10.7 (install in WSL)
VirtualBox
Download and install the latest version of VirtualBox for Windows from the official website.
Vagrant
Install the same version (2.2.16) of Vagrant in both Windows and WSL.
For WSL:
curl -O https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_x86_64.debcurl -O https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_SHA256SUMScurl -O https://releases.hashicorp.com/vagrant/2.2.16/vagrant_2.2.16_SHA256SUMS.sigcurl -sS https://keybase.io/hashicorp/key.asc | gpg --importgpg --verify vagrant_2.2.16_SHA256SUMS.sig vagrant_2.2.16_SHA256SUMSshasum -a 256 -c <(cat vagrant_2.2.16_SHA256SUMS | grep 64.deb) -ssudo apt install ./vagrant_2.2.16_x86_64.debConfigure Vagrant to communicate with Windows and VirtualBox by adding the following to your .bashrc:
export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"Ansible
Install Ansible in WSL:
brew install pipxpip3 install ansible-core==2.10.7 --userIf the above doesn’t work, try:
sudo apt install ansibleTroubleshooting
SSH Issues
If vagrant ssh doesn’t work, try:
echo 'alias vssh="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no vagrant@127.0.0.1 -i ./.vagrant/machines/default/virtualbox/private_key -p"' >> ~/.bashrcsource ~/.bashrcSlow Site
Install the vagrant-winnfsd plugin:
vagrant plugin install vagrant-winnfsdvagrant reload # if Vagrant was already runningIf problems persist, try forcing TCP instead of UDP by adding nfs_udp: false to the NFS mount point configuration in your Vagrantfile.
Permission Issues
Add the following to /etc/wsl.conf in your WSL instance:
[automount]options = "metadata,umask=22,fmask=11"Then restart WSL and apply correct permissions:
chmod -R 744 trellischmod 600 [path_to_ssh_key_file]Conclusion
This setup process, while complex, allows you to use Roots Trellis effectively on Windows with WSL. Trellis provides a robust development environment for WordPress, ensuring consistency across different stages of your project’s lifecycle.