Skip to content

Installing Magento: step-by-step guide

Published on 16 December 2025

Installing Magento: step-by-step guide

Magento is one of the most powerful e-commerce platforms, but installation is more complex than WordPress or PrestaShop. In this guide, we walk through all steps to successfully install Magento on your server.

Before you start: system requirements

Magento has specific server requirements. Check if your hosting meets these before you begin.

Magento 2.4.x requirements

PHP:

  • PHP 8.1 or 8.2 (recommended)
  • Extensions: curl, dom, gd, hash, iconv, intl, mbstring, openssl, pdo_mysql, simplexml, soap, xsl, zip

Database:

  • MySQL 8.0 or MariaDB 10.4+
  • InnoDB storage engine

Web server:

  • Apache 2.4 with mod_rewrite
  • OR Nginx 1.x

Memory:

  • Minimum 2GB RAM (4GB+ recommended)
  • PHP memory_limit minimum 2GB

Other:

  • Composer 2.x
  • Elasticsearch 7.x or OpenSearch 1.x
  • Redis (recommended for caching)

Hosting recommendations

For Magento, we recommend at least VPS hosting. Shared hosting is usually not suitable due to high resource requirements. See our Magento hosting comparison for specific recommendations.

Method 1: installation via Composer (recommended)

Composer is the standard method for Magento installation and updates.

Step 1: create Magento account

  1. Go to marketplace.magento.com
  2. Create a free account
  3. Go to My Profile > Access Keys
  4. Generate a new key pair (public + private)

Save these keys securely - you'll need them for installation and updates.

Step 2: create database

Create a database via phpMyAdmin or command line:

CREATE DATABASE magento2;
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'secure_password';
GRANT ALL ON magento2.* TO 'magento'@'localhost';
FLUSH PRIVILEGES;

Replace 'secure_password' with a strong password.

Step 3: download Magento via Composer

Navigate to your webroot and run:

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

Enter your Magento Marketplace credentials when prompted:

  • Username = public key
  • Password = private key

Step 4: set file permissions

cd magento2
find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
chown -R :www-data .
chmod u+x bin/magento

Step 5: install Magento

Run the installation wizard via command line:

bin/magento setup:install \
--base-url=https://yourdomain.com/ \
--db-host=localhost \
--db-name=magento2 \
--db-user=magento \
--db-password=secure_password \
--admin-firstname=Admin \
--admin-lastname=User \
--admin-email=admin@yourdomain.com \
--admin-user=admin \
--admin-password=admin123 \
--language=en_US \
--currency=EUR \
--timezone=Europe/Amsterdam \
--use-rewrites=1 \
--search-engine=elasticsearch7 \
--elasticsearch-host=localhost \
--elasticsearch-port=9200

Step 6: set up cron jobs

Magento requires cron for indexing, emails, and other tasks:

bin/magento cron:install

Step 7: set deployment mode

For production:

bin/magento deploy:mode:set production

After installation

Admin panel access

Your admin panel is available at:

https://yourdomain.com/admin_xxxxxx

Important first steps

  1. Set up Two-Factor Authentication - Required from Magento 2.4
  2. Configure cache
  3. Run indexers
  4. Install sample data (optional)

Performance optimization

  • Varnish cache for HTTP caching
  • Redis for session and cache storage
  • OPcache enabled

Common problems

  • "Memory exhausted" - Increase PHP memory_limit
  • Elasticsearch not available - Required for Magento 2.4+
  • White pages / 500 errors - Check logs

Need professional help?

Consider:

  • Managed Magento hosting
  • Magento partner
  • Freelance developer

See also:

magento setup magento 2 installatie magento handleiding

Ready to compare hosting?

Start comparing