2 min read

How to Install Magento 2 on a Local Server in 2025?

how to install magento 2 on a local server in 2025?

How to Install Magento 2 on a Local Server in 2025

Setting up Magento 2 on a local server is an excellent way for developers and businesses to experiment and test changes before implementing them in a live environment.

With Magento 2's robust e-commerce capabilities, this guide will help you seamlessly install it on your local machine in 2025.

Prerequisites

Before you start the installation process, ensure your system meets the following requirements:

  1. Web Server: Apache 2.4 or Nginx 1.x
  2. Database: MySQL 8.0 or MariaDB 10.4
  3. PHP: 8.1 or above
  4. Composer: Latest version

Step-by-Step Installation Guide

Step 1: Set Up Your Local Environment

Firstly, ensure you have a local server solution like XAMPP, WAMP, or MAMP installed on your machine. These packages provide the necessary Apache, PHP, and MySQL server software.

Step 2: Download Magento 2

  1. Visit the Magento Open Source Download Page.
  2. Download the Magento 2.5 (or latest) package as a zip file or via Composer.
  3. Extract the downloaded files to your web server's document root.

Step 3: Create a Database for Magento

  1. Access your database management tool (like phpMyAdmin).
  2. Create a new database with a name such as magento2_db.
  3. Ensure the database uses UTF-8 encoding.

Step 4: Configure PHP

Edit your php.ini file and make the following changes:

  • Set memory_limit to 2G.
  • Set max_execution_time to 1800.
  • Enable the necessary PHP extensions: intl, xsl, mbstring, gd, openssl, pdo_mysql, and soap.

Step 5: Install Composer Dependencies

Navigate to the root directory where you extracted Magento 2 and run:

composer install

This command will download all necessary Magento 2 dependencies.

Step 6: Magento Installation Wizard

  1. Open your web browser and navigate to http://localhost/magento2foldername.

  2. Follow the Magento Web Setup Wizard:

    • Agree to Terms and Conditions.
    • Verify System Readiness.
    • Add Database Details: Use the database name, username, and password from Step 3.
    • Configure Web Access: Set your base URL correctly.
    • Custom Settings: Configure the default currency, timezone, and language.
  3. Complete the installation process.

Step 7: Finalize Setup

  • After installation, clear the cache by running:
    php bin/magento cache:clean
    php bin/magento cache:flush
    
  • Reindex the data:
    php bin/magento indexer:reindex
    

Additional Resources

For more advanced installations and tutorials, check these resources:

Conclusion

By following these steps, you will have a local Magento 2 installation up and running in no time. Whether you’re developing new features, extensions, or themes, a local environment is essential for safe and effective Magento development. Stay updated with new versions and community tips for the best Magento experience.


This article provides a comprehensive guide to installing Magento 2 on a local server, complete with prerequisite checks and step-by-step instructions. Internal and external links give readers additional resources for their specific hosting needs.