/magento2-lando-wsl2

Local developement environment for Magento 2.4.x based on Lando and Windows 10 with WSL2.

Primary LanguageShell

Local developement environment for Magento 2 based on Lando and WSL2 (Windows 10)

Requirements

👉 Setup Lando - step by step

Here you will find the article on which this repo is based:

1. Install WSL 2 on Windows 10

Follow the official documentation to install and enable WSL 2.

2. Install Linux (Ubuntu or Debian) from the Microsoft Store

Then run it and create a Non-Root User (eg. 'jan'):

sudo adduser jan
sudo usermod -aG sudo jan
su -  jan

Set as default user on Linux start:

sudo nano /etc/wsl.conf

Create (if not exist) or edit this file:

[user]
default=jan

And save it.

3. Install Docker Desktop .exe on Windows

https://docs.docker.com/desktop/install/windows-install/

4. Install Lando inside your Linux distro (Ubuntu or Debian)

sudo apt install wget

Get url versions from github.com/lando/lando/releases:

wget https://github.com/lando/lando/releases/download/v3.20.8/lando-x64-v3.20.8.deb

sudo dpkg --ignore-depends=docker-ce --install lando-x64-v3.20.8.deb

After installing lando this way, you may need to edit the /var/lib/dpkg/status file:

sudo nano /var/lib/dpkg/status

Search (ctrl+w) for Lando and remove from dependencies: docker-ce

then save: ctrl+o

and exit: ctrl+x

5. Go to your Magento project and start Lando

cd ..
cd projects/magento-2.4.6/lando
lando start

👉 Magento 2.4.6 installation

Write your public and private access keys from Magento Marketplace into config/env file and state if you need Magento Sample Data by setting DEPLOY_SAMPLE_DATA to true or false.

To install clean Magento 2.4.6 instance run install.sh script

bash ./install.sh

Magento 2 will be installed in the www directory. After installation store will be available at https://magento246.lndo.site and admin panel at https://magento246.lndo.site/admin with user:
name: admin
password: admin123

PhpMyAdmin will be available at http://phpmyadmin.lndo.site
user: magento
password: magento

For Magento 2 console commands use:

lando bin/magento <command>

for example:

lando bin/magento cache:flush

👉 Commands

  • Start / build lando
lando start
  • Stop lando
lando stop
  • Rebuild lando app
lando rebuild
  • Destroy app (containers, databse, NOT FILES!)
lando destroy
  • Import database (supports .sql and sql.gz files)
lando db-import path/to/file.sql
  • Export database
lando db-export path/to/file.sql
  • Connect to container's shell
lando ssh
  • Run command in container's shell (you have to be in docroot directory)
lando ssh -c <command>
  • Enable Xdebug
lando xdebug-on
  • Disable Xdebug
lando xdebug-off
  • Node command
lando node <command>
  • NPM command
lando npm <command>
  • Grunt command
lando grunt <command>
  • Gulp command
lando gulp <command>
  • n98-magerun2 command (after instalation via lando composer require n98/magerun2-dist)
lando n98-magerun2 <command>

⭐ See also Azkarra - my Magento 2 theme optimized for Core Web Vitals and PageSpeed score!

👉 More info nad DEMO: https://github.com/dev-jq/Azkarra-Magento2-Theme-for-Core-Web-Vitals-and-PageSpeed