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:
- Web Server: Apache 2.4 or Nginx 1.x
- Database: MySQL 8.0 or MariaDB 10.4
- PHP: 8.1 or above
- 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
- Visit the Magento Open Source Download Page.
- Download the Magento 2.5 (or latest) package as a zip file or via Composer.
- Extract the downloaded files to your web server's document root.
Step 3: Create a Database for Magento
- Access your database management tool (like phpMyAdmin).
- Create a new database with a name such as
magento2_db
. - Ensure the database uses UTF-8 encoding.
Step 4: Configure PHP
Edit your php.ini
file and make the following changes:
- Set
memory_limit
to2G
. - Set
max_execution_time
to1800
. - Enable the necessary PHP extensions:
intl
,xsl
,mbstring
,gd
,openssl
,pdo_mysql
, andsoap
.
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
-
Open your web browser and navigate to
http://localhost/magento2foldername
. -
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.
-
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:
- Installing Magento on Cloudways
- Installing Magento on GoDaddy
- How to Install Magento on Cloud Hosting
- Installing Magento on AWS
- Magento Installation Tutorial on Linode
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.