How to Install Magento Open Source on a VPS

Magento Open Source (formerly Magento Community Edition) is a powerful, highly customizable e-commerce platform suited for larger catalogs and more complex store requirements than simpler platforms typically handle well.

Important: Magento Has Substantial Resource Requirements

Unlike simpler platforms, Magento is genuinely resource-intensive — a minimum of 4 vCPU and 8 GB RAM is realistic for a production store, more for larger catalogs; underprovisioning leads to a frustratingly slow admin panel and storefront.

Prerequisites

  • Ubuntu 22.04/24.04 VPS meeting the resource requirements above
  • Nginx, PHP 8.1+ with required extensions, MySQL/MariaDB, and Elasticsearch/OpenSearch (Magento's required search backend)
  • Composer for dependency management

Step 1 — Install Required PHP Extensions

sudo apt install php8.2-bcmath php8.2-curl php8.2-gd php8.2-intl php8.2-mbstring php8.2-soap php8.2-xml php8.2-zip php8.2-mysql -y

Step 2 — Install OpenSearch (Magento's Search Backend)

Magento requires Elasticsearch or OpenSearch for catalog search — consult Magento's official documentation for the currently supported version, since compatibility requirements change between Magento releases.

Step 3 — Create the Database

sudo mysql
CREATE DATABASE magento;
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';
FLUSH PRIVILEGES;

Step 4 — Obtain Magento via Composer

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

Requires Magento Marketplace authentication keys, obtained from your Magento account — used in place of a username/password when prompted.

Step 5 — Set Correct Permissions

cd /var/www/magento
sudo chown -R www-data:www-data .
find var generated vendor pub/static pub/media app/etc -type f -exec chmod 664 {} \;
find var generated vendor pub/static pub/media app/etc -type d -exec chmod 775 {} \;

Step 6 — Run the Installation

bin/magento setup:install \
  --base-url=https://yourdomain.com \
  --db-host=localhost \
  --db-name=magento \
  --db-user=magento \
  --db-password=CHANGE_ME_STRONG_PASSWORD \
  --admin-firstname=Admin \
  --admin-lastname=User \
  [email protected] \
  --admin-user=admin \
  --admin-password=CHANGE_ME_STRONG_PASSWORD \
  --language=en_US \
  --currency=USD \
  --timezone=America/New_York \
  --use-rewrites=1 \
  --search-engine=opensearch \
  --opensearch-host=localhost \
  --opensearch-port=9200

Step 7 — Configure Nginx

Magento provides a sample Nginx configuration in nginx.conf.sample within the installation — adapt it for your specific domain and paths.

Step 8 — Set Production Mode

bin/magento deploy:mode:set production

Compiles static assets ahead of time for better production performance — skip developer mode for any live store.

Step 9 — Set Up Cron Jobs (Required)

bin/magento cron:install

Magento relies heavily on scheduled cron tasks for indexing, cache cleaning, and other maintenance — the platform won't function correctly without this configured.

Common Errors

Admin panel is extremely slow — almost always a resource/caching issue; verify Redis is configured for both cache and session storage (Magento supports this natively) and that the server meets minimum specs.

"Composer could not authenticate" — verify your Magento Marketplace authentication keys are correctly entered when prompted.

Continue Reading

Browse more articles in E-commerce Platform Deployment.

  • magento installation, magento vps, magento open source, magento setup
  • 0 Korisnici koji smatraju članak korisnim
Je li Vam ovaj odgovor pomogao?

Vezani članci

How to Deploy WooCommerce on a VPS (Complete Guide)

WooCommerce turns WordPress into a full e-commerce platform — the most widely used option...

How to Install PrestaShop on a VPS

PrestaShop is an open-source e-commerce platform offering a good balance between feature depth...

How to Install OpenCart on a VPS

OpenCart is a lightweight, straightforward open-source e-commerce platform — a good fit for...

How to Optimize a VPS for High-Traffic E-commerce

E-commerce stores face unique performance challenges — dynamic cart/checkout pages that...

How to Set Up SSL and PCI Compliance Basics for an Online Store

Handling payment card data comes with real compliance obligations. This guide covers the...