Older tutorials — including the first version of this post — installed Magento with XAMPP and a virtual host. That no longer works well: Magento 2.4.x requires OpenSearch, specific PHP extensions and versions, and benefits from Redis or Valkey, Varnish and RabbitMQ. The reliable way to run Magento locally today is Docker, using a tool built for Magento.

Choose a Docker Tool

ToolGood for
DDEVQuick start, works on macOS, Windows (WSL2) and Linux, broad community
WardenMagento-focused environments with Varnish, RabbitMQ and OpenSearch options
docker-magento (markshust)Magento-specific scripts and helpers

We use DDEV below. On Windows, run everything inside WSL2 for good file system performance.

Step 1: Get Magento Access Keys

Magento packages are downloaded from repo.magento.com. Create access keys in your Adobe Commerce Marketplace account (My Profile → Access Keys). The public key is the Composer username and the private key is the password.

Step 2: Create the Project With DDEV

mkdir magento249 && cd magento249
ddev config --project-type=magento2 --docroot=pub --upload-dirs=media --disable-settings-management --php-version=8.4
ddev add-on get ddev/ddev-opensearch
ddev start

ddev composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition:2.4.9 .

Composer asks for your Magento access keys the first time. Check the add-on and database versions against the official 2.4.9 system requirements and adjust DDEV's database setting if needed.

Step 3: Install Magento

ddev magento setup:install \
  --base-url="https://magento249.ddev.site/" \
  --db-host=db --db-name=db --db-user=db --db-password=db \
  --search-engine=opensearch --opensearch-host=opensearch --opensearch-port=9200 \
  --admin-firstname=Admin --admin-lastname=User \
  --admin-email=admin@example.com --admin-user=admin --admin-password='Admin12345!' \
  --language=en_GB --currency=GBP --timezone=Europe/London \
  --use-rewrites=1 --backend-frontname=admin

ddev magento deploy:mode:set developer
ddev magento module:disable Magento_TwoFactorAuth Magento_AdminAdobeImsTwoFactorAuth
ddev magento cache:flush
Only disable two-factor authentication on local development environments. Keep it enabled on staging and production.

Step 4: Add Sample Data (Optional)

ddev magento sampledata:deploy
ddev magento setup:upgrade
ddev magento indexer:reindex

Step 5: Add Redis or Valkey and Mailpit

DDEV includes Mailpit for catching outgoing email. Add a Redis add-on and configure Magento's cache and sessions to use it, so your local setup behaves like production:

ddev add-on get ddev/ddev-redis
ddev restart
ddev magento setup:config:set --cache-backend=redis --cache-backend-redis-server=redis --cache-backend-redis-db=0
ddev magento setup:config:set --session-save=redis --session-save-redis-host=redis --session-save-redis-db=2

Step 6: Install Hyvä (Optional)

With the free Hyvä Theme you can develop a modern storefront locally. Follow our Hyvä installation guide; Node.js is available inside DDEV containers for the Tailwind build.

Useful Commands

TaskCommand
Open the storeddev launch
Open the adminddev launch /admin
Run bin/magentoddev magento <command>
Import a database dumpddev import-db --file=dump.sql.gz
View emailsddev mailpit
Enable Xdebugddev xdebug on

Importing a Copy of Production

To debug a real store locally, import a recent database dump with ddev import-db, then update base URLs with bin/magento config:set web/unsecure/base_url and web/secure/base_url for your local domain. Always anonymise customer data first — tools such as n98-magerun2's database dump stripping options can exclude or anonymise sensitive tables. Copy only the media you need, or use a placeholder image module, to keep the environment small.

Frequently Asked Questions

Can I still install Magento 2 with XAMPP?

It is possible with effort, but XAMPP does not include OpenSearch and its PHP setup often does not match Magento's requirements. Docker-based tools are far more reliable.

How much RAM do I need for Magento locally?

Plan for at least 8 GB available to Docker, and 16 GB on the machine for a comfortable experience with OpenSearch running.

Should my local environment match production?

Yes. Use the same PHP, database, OpenSearch and cache versions as production to avoid surprises at deployment.

🚀

Need a working dev environment for your team?

We set up Docker environments that mirror production for Magento and Hyvä teams.

Magento Installation Service
MS
About the author

Written by the Magento Services engineering team — Magento 2, Adobe Commerce and Hyvä specialists since 2014. We write about problems we solve on real client stores.