Learn how to install Magento, the leading e-commerce platform, on Debian 12 with Nginx and Elasticsearch.
Prerequisites
Before diving into the installation process, make sure you have the following prerequisites in place:
- A server running Debian 12.
- Root access or a user account with sudo privileges.
- Basic knowledge of Linux commands.
Now that we have everything set up, let's get started!
Step 1: Update System Packages
To ensure that our system is up-to-date with all the latest packages, run the following command:
Step 2: Install Required Dependencies
Magento has certain dependencies that need to be installed beforehand. Execute these commands one by one:
Step 3: Download and Extract Magento Files
In this step, we will download and extract Magento files onto our server using wget command:
Step 4: Configure Nginx for Magento Site
We need to configure Nginx as a webserver for our Magento site. Create a new Nginx configuration file using the following command:
Add the following content to the file:
Save and close the file by pressing Ctrl + X, followed by Y and then Enter.
To enable this configuration, create a symbolic link of this file in /etc/nginx/sites-enabled/ directory:
Verify if there are any syntax errors in the Nginx configuration files with:
If everything looks good, restart Nginx for changes to take effect:
Step 5: Set Up Magento Database
Now, we need to create a MySQL database for our Magento site. Run these commands one by one:
Step 6: Install Magento via Web Interface
Open your favorite web browser and navigate to http://your_domain.com/. You will be greeted with the Magento installation page. Follow the on-screen instructions to complete the installation process.
Step 7: Configure Elasticsearch for Magento
Magento utilizes Elasticsearch for advanced search functionality. To install and configure Elasticsearch, execute these commands:
Add the following content to the file:
Save and close the file by pressing Ctrl + X, followed by Y and then Enter.
Enable and start Elasticsearch service:
Congratulations! You have successfully installed Magento eCommerce Suite on Debian 12 with Nginx and Elasticsearch. You can now access your Magento website by navigating to your domain in a web browser. Remember to follow best practices for securing your server and regularly update your Magento installation to ensure a smooth and secure e-commerce experience for your customers.

COMMENTS