How to Install Magento 2.4.8 on Ubuntu 24.04
[Updated: March 17, 2026]
This tutorial covers a full Magento 2.4.8 installation on Ubuntu 24.04 LTS. You will configure PHP 8.3, NGINX, MariaDB 11.4, and OpenSearch before downloading Magento via Composer.
Key Takeaways
Install Magento 2.4.8 on Ubuntu 24.04 = Set up PHP 8.3, NGINX, MariaDB 11.4, OpenSearch 2.x, and Composer 2.9.3+, then download and configure Magento via the command line. The full setup takes about 30 minutes on a fresh server.
Perfect for: Developers setting up new Magento stores, DevOps teams provisioning servers, agencies deploying client projects.
Not ideal for: Non-technical store owners (consider managed hosting), Windows users, production environments without prior testing.
Magento 2.4.8 System Requirements
Before you start, verify your server meets these requirements. Magento 2.4.8 introduced major changes to its technology stack, including PHP 8.4 support and OpenSearch 3 compatibility.
| Component | Required Version | Notes |
|---|---|---|
| Operating System | Ubuntu 24.04 LTS | Ubuntu 22.04 also supported |
| PHP | 8.3 or 8.4 | PHP 8.1 and 8.2 no longer supported |
| Web Server | NGINX 1.24+ or Apache 2.4 | Ubuntu 24.04 default is 1.24. NGINX recommended for performance |
| Database | MariaDB 11.4 or MySQL 8.4 LTS | MariaDB 11.4 is new for 2.4.8 |
| Search Engine | OpenSearch 2.19+ or Elasticsearch 8.x | OpenSearch is the primary recommendation |
| Composer | 2.9.3+ | Major jump from older Magento releases |
| RAM | 2 GB minimum | 4 GB+ recommended for production |
| SSL | Required | Let's Encrypt (free) or commercial |
For a complete breakdown of server specs and performance benchmarks, see our Magento hosting requirements guide.
Source: Adobe Experience League — System Requirements
Prerequisites
Before you begin the Magento 2 installation, confirm you have:
- Ubuntu 24.04 LTS server with root SSH access (or a user with sudo privileges)
- A domain name pointed to your server's IP address
- An Adobe Marketplace account with authentication keys
To create your authentication keys:
- Go to marketplace.magento.com and sign in
- Navigate to My Profile then Access Keys
- Click Create a New Access Key
- Save the Public Key (username) and Private Key (password) for later
Step 1: Update Ubuntu 24.04
Log in to your server via SSH.
ssh your_user@your_server_ip
Verify you are running Ubuntu 24.04.
lsb_release -a
Expected output:
Distributor ID: Ubuntu
Description: Ubuntu 24.04 LTS
Release: 24.04
Codename: noble
Update all packages to their latest versions.
sudo apt update && sudo apt upgrade -y
Step 2: Install PHP 8.3
Ubuntu 24.04 includes PHP 8.3 in its default repositories. Install PHP 8.3 with all modules required by Magento 2.4.8, including OPcache for performance.
sudo apt install php8.3-{bcmath,cli,common,curl,fpm,gd,intl,mbstring,mysql,opcache,soap,xml,xsl,zip} -y
Adjust PHP settings to meet Magento's requirements.
sudo sed -i "s/memory_limit = .*/memory_limit = 768M/" /etc/php/8.3/fpm/php.ini
sudo sed -i "s/upload_max_filesize = .*/upload_max_filesize = 128M/" /etc/php/8.3/fpm/php.ini
sudo sed -i "s/zlib.output_compression = .*/zlib.output_compression = on/" /etc/php/8.3/fpm/php.ini
sudo sed -i "s/max_execution_time = .*/max_execution_time = 18000/" /etc/php/8.3/fpm/php.ini
For production stores with extensions and heavy traffic, Adobe recommends increasing memory_limit to 2048M.
Restart PHP-FPM to apply the changes.
sudo systemctl restart php8.3-fpm
Verify the installation.
php -v
Step 3: Install NGINX
NGINX delivers better performance than Apache for Magento stores under high traffic. For a detailed comparison, read our NGINX vs Apache for Magento analysis.
Install NGINX from the default repositories.
sudo apt install nginx -y
Create an NGINX server block for your Magento site.
sudo nano /etc/nginx/sites-enabled/magento.conf
Add the following configuration.
upstream fastcgi_backend {
server unix:/run/php/php8.3-fpm.sock;
}
server {
server_name yourdomain.com;
listen 80;
set $MAGE_ROOT /var/www/magento2;
set $MAGE_MODE production;
access_log /var/log/nginx/magento2-access.log;
error_log /var/log/nginx/magento2-error.log;
include /var/www/magento2/nginx.conf.sample;
}
Replace yourdomain.com with your actual domain name and save the file. Do not test or reload NGINX yet. The nginx.conf.sample file will be created when Magento is downloaded in Step 7.
Step 4: Install MariaDB 11.4
Magento 2.4.8 requires MariaDB 11.4 or MySQL 8.4 LTS. MariaDB 11.4 is not in the default Ubuntu 24.04 repositories. Use the official MariaDB repository setup script to add the correct repository for your system.
sudo apt install curl -y
curl -LsS https://r.mariadb.com/downloads/mariadb_repo_setup | sudo bash -s -- --mariadb-server-version=11.4
The script auto-detects Ubuntu 24.04 (Noble) and configures the signing key and repository.
Install MariaDB 11.4.
sudo apt update
sudo apt install mariadb-server -y
Secure the installation.
sudo mariadb-secure-installation
Follow the prompts to set a root password and remove test databases.
Log in and create a database for Magento.
sudo mariadb
Run the following SQL commands.
CREATE USER 'magento'@'localhost' IDENTIFIED BY 'your_strong_password';
CREATE DATABASE magentodb;
GRANT ALL PRIVILEGES ON magentodb.* TO 'magento'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Replace your_strong_password with a secure password.
Step 5: Install OpenSearch
Magento 2.4.8 uses OpenSearch as its primary search engine. This replaces the Elasticsearch dependency from earlier Magento versions.
Import the OpenSearch GPG key and add the repository.
sudo 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
Install OpenSearch.
sudo apt update
sudo env OPENSEARCH_INITIAL_ADMIN_PASSWORD='YourStrongPass123!' apt install opensearch -y
Configure OpenSearch for single-node operation. Edit the configuration file.
sudo nano /etc/opensearch/opensearch.yml
Add or modify these settings.
discovery.type: single-node
plugins.security.disabled: true
network.host: 127.0.0.1
Start and enable OpenSearch.
sudo systemctl enable opensearch
sudo systemctl start opensearch
Verify that OpenSearch is running.
curl -X GET "localhost:9200"
You should see a JSON response with the OpenSearch version number.
Step 6: Install Composer
Magento 2.4.8 requires Composer 2.9.3 or higher. Use Composer to manage all Magento dependencies and download the application.
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
rm composer-setup.php
Verify the version.
composer -V
Confirm the output shows version 2.9.3 or higher.
Step 7: Download and Install Magento 2.4.8
Download Magento 2.4.8 via Composer. You will need your Adobe Marketplace authentication keys from the Prerequisites section.
sudo mkdir -p /var/www/magento2
sudo chown $USER:$USER /var/www/magento2
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition=2.4.8 /var/www/magento2
When prompted, enter your authentication keys:
- Username: Your Public Key
- Password: Your Private Key
The download will take a few minutes depending on your server's bandwidth.
Navigate to the Magento directory and run the Magento setup command.
cd /var/www/magento2
bin/magento setup:install \
--base-url=http://yourdomain.com \
--db-host=localhost \
--db-name=magentodb \
--db-user=magento \
--db-password=your_strong_password \
--admin-firstname=Admin \
--admin-lastname=Admin \
--admin-email=admin@yourdomain.com \
--admin-user=admin \
--admin-password=Admin123! \
--language=en_US \
--currency=USD \
--timezone=America/Chicago \
--use-rewrites=1 \
--search-engine=opensearch \
--opensearch-host=localhost \
--opensearch-port=9200
Replace the placeholder values with your actual domain, database credentials, and admin details.
After a successful Magento installation, you will see:
[SUCCESS]: Magento installation complete.
[SUCCESS]: Magento Admin URI: /admin_1a2b3c
Save the admin URI. You need it to access the Magento admin panel.
Set the correct file permissions.
sudo chown -R www-data:www-data /var/www/magento2
sudo find /var/www/magento2 -type d -exec chmod 755 {} \;
sudo find /var/www/magento2 -type f -exec chmod 644 {} \;
Now that Magento is installed and the nginx.conf.sample exists, test and activate the NGINX configuration from Step 3.
sudo nginx -t
sudo systemctl reload nginx
Two-factor authentication is enabled by default. To disable it during initial setup:
sudo -u www-data bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth
sudo -u www-data bin/magento cache:flush
Step 8: Set Up Cron Jobs
Magento uses cron jobs for scheduled tasks like indexing, email sending, and sitemap generation.
sudo -u www-data bin/magento cron:install
Verify the cron jobs were added.
sudo -u www-data crontab -l
Step 9: Install SSL Certificate
Every production Magento store requires HTTPS. Install Certbot for NGINX to get a free SSL certificate from Let's Encrypt.
sudo apt install certbot python3-certbot-nginx -y
Request an SSL certificate for your domain.
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com
Select option 2 when prompted to redirect all HTTP traffic to HTTPS.
Test the NGINX configuration and reload.
sudo nginx -t
sudo systemctl reload nginx
Update the Magento base URLs to use HTTPS.
cd /var/www/magento2
sudo -u www-data bin/magento setup:store-config:set --base-url="https://yourdomain.com/"
sudo -u www-data bin/magento setup:store-config:set --base-url-secure="https://yourdomain.com/"
sudo -u www-data bin/magento cache:flush
Your Magento 2.4.8 store is now accessible at https://yourdomain.com. Access the admin panel at https://yourdomain.com/admin_1a2b3c (using the URI from Step 7).
Post-Installation Configuration
After the base Magento 2 installation is complete, consider these steps for production readiness.
Enable Production Mode
Switch from developer to production mode for better performance.
sudo -u www-data bin/magento deploy:mode:set production
Configure Redis
Redis improves cache and session handling. Follow our Redis cache setup guide for a complete walkthrough.
Reindex and Clear Cache
sudo -u www-data bin/magento indexer:reindex
sudo -u www-data bin/magento cache:clean
FAQ
How do you download and install Magento 2?
Download Magento 2 using Composer with the command composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition. You need an Adobe Marketplace account with access keys. After downloading, run bin/magento setup:install with your database and admin credentials.
Is Magento 2 free?
Magento Open Source (Community Edition) is free to download and use. Adobe Commerce (Enterprise Edition) requires a commercial license with pricing that depends on your gross merchandise value. This tutorial covers the Magento Open Source installation.
What are the prerequisites for Magento 2.4.8 installation?
You need Ubuntu 24.04 LTS (or 22.04), PHP 8.3 or 8.4, MariaDB 11.4 (or MySQL 8.4 LTS), OpenSearch 2.19+, NGINX (or Apache 2.4), Composer 2.9.3+, and at least 2 GB of RAM. An SSL certificate is required for production stores.
Can I install Magento 2.4.8 on Ubuntu 22.04?
Yes. Ubuntu 22.04 LTS is still supported. You will need to install PHP 8.3 from the Ondrej PPA (ppa:ondrej/php) since Ubuntu 22.04 ships with PHP 8.1 by default. All other installation steps remain the same.
Why does Magento 2.4.8 use OpenSearch instead of Elasticsearch?
Adobe has been moving toward OpenSearch as the default search engine since Magento 2.4.6. OpenSearch is a community-driven fork of Elasticsearch that remains open source. Magento 2.4.8 supports both OpenSearch 2.19+ (and 3.x) and Elasticsearch 8.x, but OpenSearch is the recommended option.
What PHP version does Magento 2.4.8 require?
Magento 2.4.8 supports PHP 8.3 and PHP 8.4. PHP 8.1 and 8.2 are no longer compatible with this release. PHP 8.3 is the recommended version for stability.
How much RAM does Magento 2 need?
The minimum is 2 GB of RAM. For production stores with extensions, custom themes, and regular traffic, plan for 4 GB or more. High-traffic stores benefit from 8 GB or higher combined with Redis and Varnish caching.
Can I use MySQL instead of MariaDB?
Yes. Magento 2.4.8 supports MySQL 8.0 and MySQL 8.4 LTS alongside MariaDB 11.4. Replace the MariaDB installation step with MySQL. The database and user creation commands are identical.
How do I install sample data?
After the Magento installation, run sudo -u www-data bin/magento sampledata:deploy followed by sudo -u www-data bin/magento setup:upgrade. Sample data provides test products, categories, and CMS pages for development environments.
What if the Magento installation fails?
Check the log files in the var/log/ directory for error details. Common issues include incorrect file permissions, missing PHP extensions, and wrong database credentials. Run bin/magento setup:install --help to verify all required parameters.
Conclusion
You now have a working Magento 2.4.8 store running on Ubuntu 24.04 with the current 2026 technology stack: PHP 8.3, MariaDB 11.4, OpenSearch, and NGINX.
For production stores, invest time in performance tuning. Add Redis for caching, configure Varnish for full-page cache, and follow our speed optimization tips to reduce load times.
If server management is not your focus, managed Magento hosting handles the entire infrastructure, including security patches, scaling, and monitoring, so you can focus on growing your store.