This guide installs Magento 2.4.8 on a self-hosted Linux server.
Current Version: 2.4.8 (released April 8, 2025)
⚠️ Important: Magento 2.4+ requires Elasticsearch or OpenSearch for product search. Redis and RabbitMQ are required for production deployments.
| Component | Requirement |
|---|---|
| PHP | 8.3 or 8.4 |
| Database | MySQL 8.4 or MariaDB 11.4 |
| Search Engine | OpenSearch 2.x or Elasticsearch 8.x (required) |
| Cache/Session | Redis (required for production) |
| Message Queue | RabbitMQ (required for production) |
| Web Server | Apache 2.4+ or Nginx 1.x |
| Memory | 4GB RAM minimum (8GB+ recommended) |
# Required PHP extensions for Magento 2
bcmath bz2 calendar curl ctype dom exif fileinfo filter ftp gd gettext gmp
intl mbstring mysqli oauth opcache posix soap sockets sodium sysvmsg sysvsem
sysvshm tokenizer xsl zip
Ubuntu/Debian:
apt update
apt install apache2 mariadb-server redis rabbitmq-server git unzip
# Install PHP 8.3 and required extensions
apt install php8.3 libapache2-mod-php8.3 php8.3-mysql php8.3-curl php8.3-gd \
php8.3-intl php8.3-mbstring php8.3-xml php8.3-soap php8.3-bcmath php8.3-zip \
php8.3-opcache php8.3-redis php-composer2
RHEL/Rocky Linux:
dnf install httpd mariadb-server redis rabbitmq-server git unzip
# Install PHP 8.3 and required extensions (requires EPEL/Remi repositories)
dnf install php php-mysqlnd php-curl php-gd php-intl php-mbstring php-xml \
php-soap php-bcmath php-zip php-opcache php-composer2
Magento 2.4+ requires OpenSearch or Elasticsearch. OpenSearch is recommended:
# Install OpenSearch (follow official OpenSearch installation guide)
# Or use Elasticsearch 8.x
# For development, you can use Docker:
docker run -d --name opensearch \
-p 9200:9200 -p 9600:9600 \
-e "discovery.type=single-node" \
opensearchproject/opensearch:2.11.0
# Start and enable Redis
systemctl start redis
systemctl enable redis
# Verify Redis is running
redis-cli ping # Should return: PONG
# Start and enable RabbitMQ
systemctl start rabbitmq-server
systemctl enable rabbitmq-server
# Create Magento user for RabbitMQ
rabbitmqctl add_user magento magento-password
rabbitmqctl set_permissions -p / magento ".*" ".*" ".*"
Create a database and user for Magento:
mysql -u root -p -e "CREATE DATABASE magento CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;"
mysql -u root -p -e "CREATE USER 'magento'@'localhost' IDENTIFIED BY 'strong-password-here';"
mysql -u root -p -e "GRANT ALL PRIVILEGES ON magento.* TO 'magento'@'localhost';"
mysql -u root -p -e "FLUSH PRIVILEGES;"
Option A: Composer (Recommended)
cd /var/www/html
composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2
You’ll need Adobe Commerce authentication keys (free account required):
Option B: Download Archive
cd /var/www/html
wget https://github.com/magento/magento2/archive/refs/tags/2.4.8.tar.gz
tar -xzf 2.4.8.tar.gz
mv magento2-2.4.8 magento2
chown -R www-data:www-data /var/www/html/magento2
find /var/www/html/magento2 -type d -exec chmod 755 {} \;
find /var/www/html/magento2 -type f -exec chmod 644 {} \;
chmod +x /var/www/html/magento2/bin/magento
Open http://YOUR-SERVER/magento2 in your browser and follow the installation wizard.
Provide:
localhost, port: 9200localhost, port: 6379localhost, port: 5672, username: magento, password: magento-passwordMagento 2 requires three cron jobs:
crontab -e -u www-data
Add:
* * * * * /usr/bin/php /var/www/html/magento2/bin/cron.php | grep -v "Ran jobs by schedule" >> /var/log/magento2/cron.log
* * * * * /bin/bash /var/www/html/magento2/update/cron.php >> /var/log/magento2/update.cron.log
* * * * * /bin/bash /var/www/html/magento2/bin/cron.sh >> /var/log/magento2/cron.sh.log
cd /var/www/html/magento2
php bin/magento deploy:mode:set production
php bin/magento setup:static-content:deploy -f
php bin/magento cache:enable
For production, always use HTTPS. Configure via Apache/Nginx or place behind a reverse proxy with Let’s Encrypt.
Prefer automation? See Magento 2 Ansible Setup for an example playbook.
Prefer containers? See Magento 2 Docker Setup.
Any questions?
Feel free to contact us. Find all contact information on our contact page.