Setting up a local instance for Mautic development in Windows with Ubuntu (WSL)

Learn how to install from scratch, including dependencies.
Reading time

3 min

A creative photograph in the aesthetic style of the 1980s with blue and pink tones, depicting a vintage Windows computer setup. The Windows computer has a glowing screen showing abstract code, and the desk is cluttered with retro technology like floppy disks and old keyboards. The room is dimly lit with neon blue and pink lights casting dramatic shadows.
In this article, I'll cover:

Requirements

  • Computer with Windows 10 or 11
  • Internet access
  • WSL extension installed in VS Code
  • VS Code configured to use LF line endings

Steps

  1. Open the Windows Terminal
  2. Install Ubuntu using wsl --install
  3. Restart your computer to finish installing the system
  4. Open the Windows Terminal again and select Ubuntu from the dropdown
  5. Enter the new username and password for the system when prompted
  6. Install the necessary packages with this single command (Docker and DDEV)
    • sudo apt-get update && sudo apt-get install -y mkcert ca-certificates curl gnupg && sudo install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg && sudo chmod a+r /etc/apt/keyrings/docker.gpg && echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list/dev/null && sudo apt-get update && sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && sudo usermod -aG docker $USER && sudo sh -c 'echo ""' && sudo install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://pkg.ddev.com/apt/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/ddev.gpg/dev/null && sudo chmod a+r /etc/apt/keyrings/ddev.gpg && sudo sh -c 'echo ""' && echo "deb [signed-by=/etc/apt/keyrings/ddev.gpg] https://pkg.ddev.com/apt/ * *" | sudo tee /etc/apt/sources.list.d/ddev.list >/dev/null && sudo sh -c 'echo ""' && sudo apt update && sudo apt install -y ddev && mkcert -install && logout
    • Log in again
    • Activate docker using sudo systemctl start docker && sudo systemctl enable docker
  7. Open GitHub Desktop and clone the Mautic repository into the Ubuntu home folder
  8. Go back to the Windows Terminal, in the Ubuntu option
    • Use cd /mautic to get to the directory
    • Set up DDEV using ddev config
    • Give a name to the installation or press Enter to use “mautic”
    • Press Enter again at the next prompt
    • When asked for the project type, press Enter
    • Finally start DDEV with ddev start
  9. Access the Mautic installation at https://mautic.ddev.site/ (slow) or use the IP provided by the terminal (faster)

Troubleshooting

If any error occurred during the DDEV set up, you’ll be prompted to do a regular Mautic installation.

  1. Perform the installation
    • Click Next on the first screen
    • In Database Host, Name, Username and Password, fill in all with db
    • Click Next
    • Create your username and password and finish
    • Log in
DDEV indicates that the address is already in use, what do I do?

Run the command docker stop $(docker ps -a -q) to stop all active containers.

An error appears when accessing the link

Run the commands in the terminal, inside the folder:

ddev ssh
composer install && npm install
It stopped working and the app no longer opens, how can I solve it?

In Windows terminal, use the command wsl --unregister Ubuntu.

Then do a clean install. It will work again (it’s better than racking your brains trying to fix it).

I deleted the folder to clone again, but GitHub says it is being used

Close VS Code before trying to clone again.