Magento is one of the most popular e-commerce platforms worldwide. Installing Magento on Linux servers can seem challenging, but with this comprehensive guide, you’ll have Magento up and running on Debian, Ubuntu, or CentOS in no time.
Table of Contents
Prerequisites
Before installing Magento, ensure you have:
-
A server running Debian 12/Ubuntu 22.04/CentOS 9
-
Root or sudo privileges
-
At least 2GB RAM (4GB recommended for production)
-
LAMP or LEMP stack installed
Magento requires PHP 8.1+, MySQL 8+ or MariaDB 10.4+, and Composer.
Step 1: Update Your System
Keep your system packages up to date.
Debian/Ubuntu:
CentOS:
Step 2: Install Apache/Nginx Web Server
For Apache (recommended):
Debian/Ubuntu:
CentOS:
For Nginx:
Replace apache2/httpd with nginx in the commands above.
Step 3: Install PHP and Required Extensions
Magento requires specific PHP extensions.
Debian/Ubuntu:
CentOS:
Check PHP version:
Step 4: Install MariaDB or MySQL
Debian/Ubuntu:
CentOS:
Secure the installation:
Step 5: Configure Database for Magento
Log in to MariaDB/MySQL:
Create a database and user for Magento:
Step 6: Download and Install Composer
Magento requires Composer to manage dependencies.
Step 7: Download Magento
Navigate to your web root (e.g., /var/www/html) and download Magento:
Magento requires authentication keys from your Magento account.
Step 8: Configure Apache/Nginx for Magento
Apache Virtual Host example:
Enable mod_rewrite and restart Apache:
Step 9: Set Proper Permissions
Magento requires specific file permissions:
For CentOS, replace www-data with apache.
Step 10: Install Magento via Command Line
Run Magento setup:
Step 11: Access Magento Admin Panel
Once installation is complete, access Magento:
Log in with the credentials you created during installation.
Conclusion
Congratulations! You have successfully installed Magento on Debian, Ubuntu, or CentOS. With proper configuration and secure permissions, your Magento store is ready for customization and product setup.