Lando is an Open Source system for running local websites, whether they are WordPress or other types of websites (Drupal, LAMP, LEMP, etc.).
It has a multitude of options, integrates seamlessly with Visual Studio Code and other editors and we have many options to fully adapt it to our needs (PHP version, XDebug, database, web server, npm, gulp, phpMyAdmin, etc., etc.).
It is a fantastic tool for web development and is the one I use in addition to Local (depending on the development) since a few months ago I was bitten by the bug following some conversations in the El Arroyo Dev Club (essential club if you are a professional web developer).
If you want to skip all the literature and go straight to the installation, I recommend you go for the short version.
WSL2
The first thing we will need to install Lando in WSL2, is WSL2, obvious, isn’t it?
If you don’t know what WSL2 is, you may want to install Local and finish the tutorial here.
Indeed, what you want is to install Lando on WSL2 (if not, what would you do here?), the first thing you have to do is to check that you do not have Docker installed on Windows, if not, uninstall and reboot or you will have nothing but problems later and you will end up coming back to this point.
The next point to consider before starting is to check that your computer supports virtualization and that it is enabled. The easiest way to check this is in the Task Manager, Performance tab and under the CPU graphs you will see if virtualization is supported and enabled.
Now we must enter our WSL2 installation with Ubuntu and execute the following command:
# curl -Ls https://github.com/lando/hyperdrive/releases/download/v0.6.1/hyperdrive > /tmp/hyperdrive \
&& chmod +x /tmp/hyperdrive \
&& /tmp/hyperdrive
This command will do the following:
- Download a copy of the file
https://github.com/lando/hyperdrive/releases/download/v0.6.1/hyperdrive
- Copy its contents to
/tmp/hyperdrive
- Make the file executable
/tmp/hyperdrive
- Execute the script
/tmp/hyperdrive
And that is all.
Well, we will have to answer the questions and accept to install everything required, Docker, Lando and all that is necessary:
It’s that easy. Thanks to Hyperdrive we will be able to install Lando with all its dependencies in an easy, fast and secure way.
And now?
Now let’s enjoy Lando and his many possibilities. Just remind you that to get a good performance on WSL2 use the WSL2 file system and not the Windows one, that is to say, do not run it on your Windows user which is usually the default directory.
If you have an alias file in your Bash or ZSH, you can create one for the WSL home and one for the Windows home, something like this:
# Ir al directorio home
alias h='cd /home/linux-home-user/'
# Ir al directorio home Windows
alias hw='cd /mnt/c/Users/windows-home-user/'
And after loading the alias file, from your .bashrc
or .zshrc
run h
so that every time you open the console it defaults to your Linux directory and not the Windows directory.
If you create a recipe
similar to this one:
Now we can “lift” our web site, download the core with wp-cli (wp core download
), install, execute, etc… and the truth is that with magnificent response times once the web site is lifted (lando start
):
Short version
Execute the following command:
# curl -Ls https://github.com/lando/hyperdrive/releases/download/v0.6.1/hyperdrive > /tmp/hyperdrive \
&& chmod +x /tmp/hyperdrive \
&& /tmp/hyperdrive
Follow the instructions.
Have a cup of coffee, you’ve earned it 😉
Updated 02/24/2022
Diego F. C. tells us from El Arroyo Club the following:
The machines I had using Lando for WordPress development were a bit slow and the updates could not be performed, some “alerts” would pop up, etc. After seeing a bit of what was going on, the problem was that the Docker image that WordPress runs on could not “resolve” DNS that were not internal.
SOLUTION:
Create/edit inside the WSL2 machine on which you run Lando the file /etc/docker/daemon.json
and add a json with these values (or other DNS as you see, these are CloudFlare’s):
{
"dns": ["1.1.1.1", "1.0.0.1"]
}
We stop whatever we have running with lando (# lando stop
).
Restart docker (# sudo service docker restart
or if you prefer # sudo service docker stop
and # sudo service docker start
).
We launch again what we need with lando (# lando start
)
and voila! It already recognizes the DNS.
Thank you very much, Diego, for your contribution.