See this Github comment thread for any issues or additional context for getting Warden running on Windows with WSL 2.
The instructions below cover how to install Warden on Windows, using WSL 2.
-
Install Ubuntu 20 LTS in WSL 2
- To access the shell/terminal inside of Ubuntu WSL, open the
Ubuntu 20.04
program that will have been installed in the step above (If you want to be able to copy/paste, see here. Going forward, this article assumes you will run all commands inside of the Ubuntu terminal
- To access the shell/terminal inside of Ubuntu WSL, open the
-
Install Docker Desktop (these instructions were tested using Docker 4.9.0 on June 13th, 2022)
-
Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
-
Install Warden
-
Try installing Warden using this command:
brew install davidalger/warden/warden
However if you run into an error likeError: The following formula cannot be installed from bottle and must be built from source. warden
, then follow these steps:sudo mkdir /opt/warden sudo chown $(whoami) /opt/warden git clone https://github.com/davidalger/warden.git /opt/warden echo 'export PATH="/opt/warden/bin:$PATH"' >> ~/.bashrc PATH="/opt/warden/bin:$PATH"
-
In order to avoid a warning about an invalid SSL certificate when loading Warden sites, you need to configure your browser to trust the certificate used by Warden. To do that in Firefox, go to
Options > Privacy & Security > Certificates > View Certificates...
and then import the certificate located at/c/.warden/ssl/rootca/certs/ca.cert.pem
. Check all the boxes as you are importing the certificate.
-
-
At this point you should now be able to use Warden to create new environments or initialize existing ones. You'll want to use a folder inside of the
~/
directory for your Warden sites, such as~/sites
. -
You will need to manually create hosts records for each site. Edit your hosts file and add an entry like this for each site you're managing with Warden:
127.0.0.1 app.example.test
- You can access the files inside the Ubuntu installation using Window's File Explorer by typing in
\\wsl$\<YourDistroName>\
to the address bar. You'll want to determine what the exact path is for your version of Linux and then create a bookmark to it for easy reference. - If you don't already have one, you will want to create an SSH public/private key pair inside your Ubuntu installation. To do this, open the
wsl
program, run a command likecd ~
, and then follow these instructions to setup an SSH key.- See here for how to copy this SSH key into Warden
- Database connection: It's often helpful to use a MySQL GUI tool to connect to databases inside of Warden.
- MySQL Workbench: Here is a screenshot showing how you would configure Warden to connect to a project named
8020
:
-
Note: you may need to run this command to copy the Warden tunnel SSH key to a location that is readable by MySQL Workbench:
sudo cp /c/.warden/tunnel/ssh_key /c/warden_tunnel_ssh_key
-
- TablePlus: Here is a screenshot showing how you would configure Warden to connect to a project named
8020
:
- MySQL Workbench: Here is a screenshot showing how you would configure Warden to connect to a project named
- You can use an IDE like PhpStorm to edit files inside of your Warden projects by opening up the project directory (e.g.,
/c/sites/example.test
)
The instructions below cover how to install Warden on Windows, using WSL 1.
-
Install Ubuntu 18 LTS in WSL
- To access the shell/terminal inside of Ubuntu WSL, open the
wsl
program that will have been installed in the step above (you can also run theUbuntu 18.04 LTS
program. If you want to be able to copy/paste, see here. Going forward, this article assumes you will run all commands inside ofwsl
- To access the shell/terminal inside of Ubuntu WSL, open the
-
Install Docker Desktop
- If you don't have Windows Pro or Windows Enterprise, follow these instructions
-
Follow the steps in this article. Some adjustments to the article:
- Once you install Docker Desktop, go to
Resources > File Sharing
and selectC
- Before you move forward with the
Verify Everything Works
step, restart Windows - Skip this step:
Can't use Docker for Windows?
- Once you get to the
You're all done! You can skip the 17.09 steps below if you followed the above steps.
section of the article, move on to the next step below.
- Once you install Docker Desktop, go to
-
Run
sudo apt install linuxbrew-wrapper
-
You may see an error like this:
Warning: /home/linuxbrew/.linuxbrew/bin is not in your PATH. /usr/bin/brew: 78: exec: /home/erikhansen/.linuxbrew/bin/brew: not found
Ignore that error and run the commands listed here.
-
-
Install Warden
- By default, Warden will want to use the home directory of your Linux installation. Due to the nature of how files are shared between Linux and Windows, we need to configure Warden to use the
/c
directory (that you should have setup as a shared directory in a previous step). Run the following commands inside a wsl shell:echo 'export WARDEN_HOME_DIR=/c/.warden' >> ~/.bashrc echo 'export WARDEN_COMPOSER_DIR=/c/.composer' >> ~/.bashrc export WARDEN_HOME_DIR=/c/.warden export WARDEN_COMPOSER_DIR=/c/.composer
- Increase the Docker Desktop memory limit, per the Warden documentation recommendation
- Install Warden using Homebrew
- In order to avoid a warning about an invalid SSL certificate when loading Warden sites, you need to configure your browser to trust the certificate used by Warden. To do that in Firefox, go to
Options > Privacy & Security > Certificates > View Certificates...
and then import the certificate located at/c/.warden/ssl/rootca/certs/ca.cert.pem
. Check all the boxes as you are importing the certificate.
- By default, Warden will want to use the home directory of your Linux installation. Due to the nature of how files are shared between Linux and Windows, we need to configure Warden to use the
-
At this point you should now be able to use Warden to create new environments or initialize existing ones. You'll want to use a folder inside of the
/c
directory for your Warden sites, such as/c/sites
. -
You will need to manually create hosts records for each site. Edit your hosts file and add an entry like this for each site you're managing with Warden:
127.0.0.1 app.example.test
Amazing! Save my day