Getting started with Magento can feel a bit overwhelming at first—there are a lot of moving parts, and one small mistake can slow everything down. But the good news is, once you understand the setup process, it’s actually very manageable.
In this guide, we’ll walk through how to install Magento on Ubuntu 26.04 step by step, in a way that’s beginner-friendly and practical. No unnecessary complexity, no confusing jargon—just a clear path from a fresh server to a working Magento store.
By the end of this, you’ll have Magento up and running, along with a solid understanding of the tools involved, so you’re not just copying commands—you actually know what’s happening behind the scenes.
Commands
User setup
=================================================================================
–system \
–shell /bin/bash \
–gecos ‘Magento user’ \
–group \
–home /opt/magento \
magento
# passwd magento# usermod -aG sudo magento
# gpasswd -a www-data magento# su - magentoInstall PHP + extensions
$ sudo apt install php-cmath,gd,common,curl,fpm,intl,mbstring,mysql,soap,xml,zip,cli}
PHP configuration
$ sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php/8.4/fpm/php.ini
$ sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/" /etc/php/8.4/fpm/php.ini
$ sudo sed -i "s/short_open_tag = .*/short_open_tag = On/" /etc/php/8.4/fpm/php.ini
$ sudo sed -i "s/max_execution_time = .*/max_execution_time = 3600/" /etc/php/8.4/fpm/php.ini
==================================================================================
$ sudo nano /etc/php/8.4/fpm/pool.d/magento.conf
==================================================================================
[magento]
user = magento
group = magento
listen = /run/php/magento.sock
listen.owner = magento
listen.group = magento
pm = ondemand
pm.max_children = 50
pm.start_servers = 10
pm.min_spare_servers = 5
pm.max_spare_servers = 10
===============================================================================
$ sudo systemctl restart php8.4-fpm
Install Nginx
$ sudo apt install nginx -y
$ sudo nano /etc/nginx/sites-enabled/magento.conf
=============================================================================
upstream fastcgi_backend {
server unix:/run/php/magento.sock;
}
server {
server_name yourdomain.com;
listen 80;
set $MAGE_ROOT /opt/magento/website;
set $MAGE_MODE production;
access_log /var/log/nginx/magento-access.log;
error_log /var/log/nginx/magento-error.log;
include /opt/magento/website/nginx.conf.sample;
}
=================================================================================
Install OpenSearch
$ sudo apt install curl gnupg2
$ curl -o- https://artifacts.opensearch.org/publickeys/opensearch.pgp | sudo gpg --dearmor --batch --yes -o /usr/share/keyrings/opensearch-keyring
$ echo "deb [signed-by=/usr/share/keyrings/opensearch-keyring] https://artifacts.opensearch.org/releases/bundle/opensearch/2.x/apt stable main" | sudo tee /etc/apt/sources.list.d/opensearch-2.x.list
$ sudo apt update
==================================================================================
$ sudo apt list -a opensearch
$ sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD='m0d1fyth15' apt install opensearch=2.19.4
$ sudo nano /etc/opensearch/opensearch.yml
plugins.security.disabled: true
$ sudo systemctl enable --now opensearch
$ curl -X GET localhost:9200
Install MySQL
$ sudo apt install mysql-server
$ sudo mysql
mysql> CREATE USER 'magento'@'localhost' IDENTIFIED BY 'm0d1fyth15';
mysql> CREATE DATABASE magentodb;
mysql> GRANT ALL PRIVILEGES ON magentodb.* TO 'magento'@'localhost';
mysql> FLUSH PRIVILEGES;
mysql> \q
Install Composer
$ curl -sS https://getcomposer.org/installer -o composer-setup.php
$ sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
$ composer -V
Download Magento
$ composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.8-p3 /opt/magento/website
================================================================================
$ cd /opt/magento/website
$ bin/magento setup:install \
–base-url=http://yourdomain.com \
–db-host=localhost \
–db-name=magentodb \
–db-user=magento \
–db-password=m0d1fyth15 \
–admin-firstname=Magento \
–admin-lastname=Admin \
–admin-email=admin@yourdomain.com \
–admin-user=admin \
–admin-password=m0d1fyth15 \
–language=en_US \
–currency=USD \
–timezone=America/Chicago \
–use-rewrites=1 \
–search-engine=opensearch
=================================================================================
Disable 2FA (optional)
$ php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth
$ php bin/magento module:disable Magento_TwoFactorAuth
$ php bin/magento setup:di:compile
$ php bin/magento cache:clean
Set up cron
$ php bin/magento cron:install
Video:



