---
title: "Install Magento Open Source 2.4.9 on Ubuntu 26.04 · CloudSat"
description: "Install Magento Open Source 2.4.9 on Ubuntu 26.04: PHP 8.5, MySQL 8.4, OpenSearch 3, Nginx and Composer access keys, then production mode, cron and HTTPS."
url: https://cloudsat.io/learn/install-magento-open-source-on-ubuntu
updated: 2026-11-18T12:00:00Z
source: CloudSat (https://cloudsat.io/). Prices in USD.
---

[Self-hosting](https://cloudsat.io/learn/topic/self-hosting)

# Install Magento Open Source 2.4.9 on Ubuntu 26.04

Install Magento Open Source 2.4.9 on Ubuntu 26.04: PHP 8.5, MySQL 8.4, OpenSearch 3, Nginx and Composer access keys, then production mode, cron and HTTPS.

CloudSat team November 18, 2026 7 min read

Magento Open Source is the free edition of Adobe Commerce, and it asks more of a server than most PHP applications: a dedicated search engine, a cron job that runs every minute, and a build step before the store goes live. Version 2.4.9, released on May 12, 2026, is current and supported until May 31, 2029. This guide installs it on a single Ubuntu 26.04 LTS server with Nginx, PHP 8.5, MySQL 8.4 and OpenSearch 3.

## What 2.4.9 expects

| Component | Adobe's tested version for 2.4.9 | On Ubuntu 26.04 |
| --- | --- | --- |
| PHP | 8.5 (Composer accepts 8.3 to 8.5) | 8.5 |
| Database | MySQL 8.4 or MariaDB 12.3 | MySQL 8.4 (MariaDB 11.8 is packaged too) |
| Search engine | OpenSearch 3; Elasticsearch is no longer listed | From OpenSearch's own repository |
| Composer | 2.10 | From getcomposer.org |
| Web server | Nginx 1.30 | Nginx 1.28 |
| Cache and sessions | Valkey 9, optional | Add later |
| Page cache, queues | Varnish 8 and RabbitMQ 4.3, optional | Add later |

Ubuntu's Nginx is one release behind Adobe's list; nginx.org's own repository carries the newer stable branch if you want an exact match. Adobe notes that Magento can need up to 2 GB of memory for some operations, and MySQL and OpenSearch want their own share, so plan on 8 GB for a live store on one server. On CloudSat, an 8 GB Cloud VPS costs $21.18/mo, and [Magento hosting](https://cloudsat.io/magento-server-hosting) has more on running a store.

## Prepare the server

Point a DNS record such as `shop.example.com` at the server, then install the web stack and the PHP extensions Magento uses. The unversioned `php-*` packages follow Ubuntu's default PHP, which is 8.5 on 26.04:

```bash
sudo apt update && sudo apt upgrade -y
sudo apt install -y nginx mysql-server unzip \
  php-fpm php-cli php-bcmath php-curl php-gd php-intl php-mbstring \
  php-mysql php-soap php-xml php-zip
php -v
```

Composer and Magento's build commands need more memory than PHP's command-line default. Adobe recommends 1 GB for compiling and deploying static files and 2 GB for debugging:

```ini
; /etc/php/8.5/cli/conf.d/90-magento.ini
memory_limit = 2G
```

Create a user that will own the files and run every `bin/magento` command, in the web server's group so Nginx and PHP-FPM can read what it writes:

```bash
sudo adduser --disabled-password --gecos "" magento
sudo usermod -aG www-data magento
sudo install -d -o magento -g www-data /var/www/magento
```

## Create the database

On Ubuntu, MySQL's root account logs in through the local socket, so `sudo mysql` needs no password:

```bash
sudo mysql <<'SQL'
CREATE DATABASE magento;
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'replace-with-a-long-password';
GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';
SQL
```

## Install OpenSearch 3, reachable only locally

OpenSearch is not in Ubuntu's archive. Add its repository and signing key, then install it with the security plugin disabled:

```bash
sudo install -d -m 0755 /etc/apt/keyrings
curl -fsSL https://artifacts.opensearch.org/publickeys/opensearch-release.pgp | sudo gpg --dearmor -o /etc/apt/keyrings/opensearch.gpg
echo "deb [signed-by=/etc/apt/keyrings/opensearch.gpg] https://artifacts.opensearch.org/releases/bundle/opensearch/3.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-3.x.list
sudo apt update
sudo env DISABLE_SECURITY_PLUGIN=true apt-get install -y opensearch
```

OpenSearch's documentation reserves that switch for setups where its own security is not needed. Here it is acceptable for one reason: the service will only listen on `127.0.0.1`, so nothing outside the server can reach it. Never open port 9200 in a firewall with security disabled. In `/etc/opensearch/opensearch.yml`, set:

```yaml
network.host: 127.0.0.1
discovery.type: single-node
```

Confirm that `grep -n '^plugins.security.disabled' /etc/opensearch/opensearch.yml` prints `plugins.security.disabled: true`, and add that line if it does not. For the heap, OpenSearch suggests about half the memory on a dedicated machine; on a shared store server, set a fixed 1 GB in `/etc/opensearch/jvm.options` with `-Xms1g` and `-Xmx1g`. Then start it and check that it answers:

```bash
sudo systemctl enable --now opensearch
curl -s http://127.0.0.1:9200
```

## Get Composer and your access keys

Adobe's repository requires authentication. In the Commerce Marketplace, open **My Profile > Access Keys** and create a key pair: the public key is your Composer username, the private key your password. Install Composer itself from getcomposer.org, comparing the installer's hash with the one on its download page:

```bash
cd /tmp
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
```

Then create the project as the `magento` user. Composer asks for the keys and offers to save them in that user's `auth.json`:

```bash
sudo -u magento -H composer create-project --repository-url=https://repo.magento.com/ \
  magento/project-community-edition=2.4.9 /var/www/magento
```

Set the permissions Magento's own documentation prescribes, so the web server group can write where Magento needs it to:

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

## Run the installer

The search engine flag matters: Adobe's reference still lists an Elasticsearch value as the default, so name OpenSearch explicitly. Pick a custom admin path and an administrator name other than `admin`:

```bash
cd /var/www/magento
sudo -u magento bin/magento setup:install \
  --base-url=http://shop.example.com/ \
  --db-host=localhost --db-name=magento --db-user=magento \
  --db-password='replace-with-a-long-password' \
  --admin-firstname=Shop --admin-lastname=Owner --admin-email=owner@example.com \
  --admin-user=shopowner --admin-password='replace-with-a-long-passphrase-7' \
  --language=en_US --currency=USD --timezone=America/New_York --use-rewrites=1 \
  --search-engine=opensearch --opensearch-host=127.0.0.1 --opensearch-port=9200 \
  --backend-frontname=manage_7f3k
```

The last lines of output print the admin URI. Write it down with the password.

## Configure Nginx

Magento ships a tested Nginx configuration as `nginx.conf.sample` in its root. Include it rather than writing your own. In `/etc/nginx/sites-available/magento`:

```nginx
upstream fastcgi_backend {
    server unix:/run/php/php8.5-fpm.sock;
}

server {
    listen 80;
    server_name shop.example.com;
    set $MAGE_ROOT /var/www/magento;
    include /var/www/magento/nginx.conf.sample;
}
```

```bash
sudo ln -s /etc/nginx/sites-available/magento /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
sudo nginx -t && sudo systemctl reload nginx
```

## HTTPS, production mode and cron

```bash
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d shop.example.com

cd /var/www/magento
sudo -u magento bin/magento setup:store-config:set --base-url="https://shop.example.com/" \
  --base-url-secure="https://shop.example.com/" --use-secure=1 --use-secure-admin=1
sudo -u magento bin/magento deploy:mode:set production
sudo -u magento bin/magento cron:install
sudo -u magento bin/magento deploy:mode:show
```

Production mode compiles code and deploys static files, which takes a few minutes. `cron:install` adds a crontab entry for the `magento` user that runs `bin/magento cron:run` every minute; indexers, emails and scheduled tasks depend on it.

Two-factor authentication for the admin is on by default, and administrators must set it up before their first login. Magento sends the setup link by email, so outgoing mail has to work first; [Send email from your server](https://cloudsat.io/docs/sending-email) covers relays and port 25.

## Mage-OS, the community distribution

Mage-OS is a community-run distribution of the same code under the same OSL-3.0 and AFL-3.0 licenses. Its 4.0.0 release is based on Magento Open Source 2.4.9, and its documented install has no access-key step:

```bash
sudo -u magento -H composer create-project --repository-url=https://repo.mage-os.org/ \
  mage-os/project-community-edition /var/www/magento
```

Extensions bought on the Commerce Marketplace still come from Adobe's repository and still need keys.

## When the install stops

Most failures on a fresh server come from a handful of causes, and the message usually names the layer:

| Symptom | Check first |
| --- | --- |
| The installer cannot connect to the search engine | `curl -s http://127.0.0.1:9200` and `systemctl status opensearch`; the heap setting is the usual reason it will not start |
| Composer stops with an authentication error | The key pair in the `magento` user's `auth.json`: public key as username, private key as password |
| The admin path returns a 404 | `sudo -u magento bin/magento info:adminuri` prints the real path |
| The storefront loads without styles | Static files were not deployed or are not readable; rerun production mode and the permission commands |
| Indexers stay invalid | Cron is not running; check `crontab -l -u magento` and `var/log/magento.cron.log` |
| Error 1419 about the SUPER privilege when indexers switch to "Update by schedule" | MySQL's binary logging blocks trigger creation; set `log_bin_trust_function_creators = 1` in MySQL's configuration |

Read `var/log/system.log` and `var/log/exception.log` in the Magento directory before changing anything else; they record what the browser only shows as a generic error page.

## Support dates to plan around

| Release | End of support |
| --- | --- |
| 2.4.6 | Standard support ended August 11, 2026 |
| 2.4.7 | May 31, 2027 |
| 2.4.8 | May 31, 2028 |
| 2.4.9 | May 31, 2029 |

Security patch releases carry a `-p` suffix, such as 2.4.8-p5, and arrive for every supported line at the same time.

## FAQ

### Can I use MariaDB instead of MySQL?

Adobe lists MariaDB 12.3 for 2.4.9. Ubuntu 26.04 packages MariaDB 11.8, which Adobe lists for 2.4.8 but not for 2.4.9, so either use MySQL 8.4 from Ubuntu as above or install MariaDB 12.3 from MariaDB's own repository.

### Does Magento still work with Elasticsearch?

Not on 2.4.9, whose requirements list only OpenSearch. Elasticsearch 7.17 itself reached end of support on January 15, 2026. Move search to OpenSearch before upgrading an older store.

### Should I add Valkey and Varnish right away?

Get the store working first. Valkey for cache and sessions, then Varnish for full-page caching, are the next steps once traffic grows, and both run comfortably on the same server at first.

**Run it on CloudSat.** Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. [See plans](https://cloudsat.io/plans) or [deploy a server](https://dash.cloudsat.io/console/deploy).

## Keep reading

[All guides in Self-hosting](https://cloudsat.io/learn/topic/self-hosting)

- [Install WordPress on a VPS with Nginx and MariaDB](https://cloudsat.io/learn/install-wordpress-on-a-vps-with-nginx): Self-hosting Install WordPress on a VPS with Nginx and MariaDB 7 min read
- [Fix 502, 504 and 505 errors behind an Nginx reverse proxy](https://cloudsat.io/learn/fix-502-504-and-505-errors-behind-nginx): DevOps Fix 502, 504 and 505 errors behind an Nginx reverse proxy 7 min read
- [Speed up WordPress on your own server](https://cloudsat.io/learn/speed-up-wordpress-on-your-own-server): Self-hosting Speed up WordPress on your own server 7 min read
- [Self-hosted online store software compared](https://cloudsat.io/learn/self-hosted-shop-software-compared): Self-hosting Self-hosted online store software compared 7 min read
