Install Magento 2 Localhost

Hey developers,

  1. How To Install Magento2 In Localhost Ubuntu
  2. How To Install Magento2 In Localhost Wamp
  3. Setup Magento 2 On Localhost
  4. How To Install Magento 2 Theme In Localhost

It’s December and which event are you looking forward this month? For me, it’s the release of the beta version for Magento 2.0. I’m so eager to get it because “Magento2 will mark a turning point for how Magento works and will extend its place in the market!” (Mark Lavelle, VP Product and General Manager of Mid-Market & Magento at eBay). Wow, sound great!

While waiting for the beta version, we should waste no time and get started with the alpha one that I think its installation steps won’t change much. The guide is a little bit long but it’s surely worth your time reading 🙂

How to install Magento 2 on localhost XAMPP with composer

  • After fetching all the dependencies, it will generate autoload files and you are ready to install Magento 2 on localhost. Create an empty database with correct permissions in phpmyadmin. Enter your Magento 2 url in browser and hit Enter. Click on “Agree and Setup Magento”.
  • Create a folder. Let's call it magento2. Navigate to that folder. (don't forget the dot at the end. It's important) If you want the sample data installed edit the file composer.json as recommended in here in.

Download magento and sample data. Using a browser, download the latest full released archive file.

1. Install xampp

Before we can let Magento 2 store goes live we need to test and build it on local host first, the most stable localhost software to install Magento 2 is XAMPP and WAMP. In this tutorial, I will show you how to install Magento 2 on localhost XAMPP.

The first thing is you need to download localhost XAMPP software to your computer, this is the link from its homepage:

Access here to install Locahost XAMPP software.

Edit the file: php.ini to enable extensions as below:

;extension=php_openssl.dll extension=php_openssl.dll
;extension=php_intl.dll extension=php_intl.dll

About how to install XAMPP, I don’t want to make this post too long so I don’t mention it here. It is very easy and I sure that all of you have already installed this software on your computer as a developer.

How To Install Magento2 In Localhost Ubuntu

The next thing is installing composer!

2. Install composer:

Composer is the new thing in Magento 2, with composer,

Install composer via this link

Download file Composer-Setup.exe and install on localhost

Run the file Composer-Setup.exe


⇒ Choose Next to continue

⇒ Choose Next to continue

Choose the path where php.exe is located with xampp is C:xamppphpphp.exe and click on Next

⇒ Select Install

Then, please wait.

If this error happens, you can use Task Manager to close Window Explorer. Choose Retry to continue.

The composer installation process will end with the following window:

Run Window Explorer again:

3. Install Magento 2.0

Install Magento 2 Localhost

In this post, I use Magento 2.0 code from

Copy the source code to htdocs folder of localhost. Then, right click and choose Composer Installation for the file setupcomposer.json

The cmd screen displays. You should wait for a while.

Log in to mysql to create database

Run the link: localhost/magento20/ on the browser to start installing Magento 2.0

Installation runs. Follow step by step in this process:

Step 1: Check server

When Readiness Check step is completed, choose Next

Fill in the information of server and database in step 2. After that, click on Next to continue

Step 3: Provide your website link and go on

In step 4: Customize your store. You can edit your time zone, currency and language before going to the 5th step.

Step 5 requires you to Create Admin Account. Fill in the information, then move to the last one

Choose Install in step 6, you will see the following screen

It will take some minutes to finish installation. The window will be shown as below when everything is done

Install Magento 2.0 on online server

1. Copy the source code to server

2. Run puty to install composer

i. Move to setup folder

Cd folder_magento/setup

ii. Download composer

curl -sS php

iii. Run composer

php composer.phar install

3. Run Magento link. It’s the same as installing on localhost.

I hope that you’ll find this guide useful. If you have any problems or just want to share your thoughts about Magento 2.0, please contact us and we will discuss together.

We will update Magento tutorials regularly, especially about Magento 2. Let’s subscribe to our blog to be the first one catch up with the latest news by leaving your email below.


We use Composer to manage Magento components and their dependencies. Using Composer to get the Magento software metapackage provides the following advantages:

  • Reuse third-party libraries without bundling them with source code
  • Reduce extension conflicts and compatibility issues by using a component-based architecture with robust dependency management
  • Adhere to PHP-Framework Interoperability Group (FIG) standards
  • Repackage Magento Open Source with other components
  • Use the Magento software in a production environment

You can also download an archive file for a specific version of Magento in either ZIP or TAR format. Installing Magento from an archive lacks the advantages of using Composer. Contributing developers should use the git-based installation method.


Before you continue, you must do the following:

  • Complete all prerequisite tasks.
  • Install Composer.
  • Get authentication keys to the Magento Composer repository.

Log in as file system owner

Learn about ownership, permissions, and the Magento file system owner in our Overview of ownership and permissions topic.

To switch to the Magento file system owner:

  1. Log in to the Magento server as, or switch to, a user with permissions to write to the Magento file system. See switch to the Magento file system owner.

    If you use the bash shell, you can use the following syntax to switch to the Magento file system owner and enter the command at the same time:

    If the Magento file system owner does not allow logins, you can do the following:

  2. To run Magento commands from any directory, add <magento_root>/bin to your system PATH.

    Because shells have differing syntax, consult a reference like

    Sample bash shell for CentOS:

    Optionally, you can run the commands in the following ways:

    • cd <magento_root>/bin and run them as ./magento <command name>
    • <magento_root>/bin/magento <command name>
    • <magento_root> is a subdirectory of your web server docroot.

In addition to the command arguments discussed here, see Common arguments.

Get the metapackage

To get the Magento metapackage:

  1. Log in to your Magento server as, or switch to, the Magento file system owner.
  2. Change to the web server docroot directory or a directory that you have configured as a virtual host docroot.
  3. Create a new Composer project using the Magento Open Source or Magento Commerce metapackage.

    Magento Open Source

    Magento Commerce

    When prompted, enter your Magento authentication keys. Public and private keys are created and configured in your Magento Marketplace.

    If you encounter errors, such as Could not find package.. or matching package found, make sure there are no typos in your command. If you still encounter errors, you may not be authorized to download Magento Commerce. Contact Magento support for help.

    See Troubleshooting for help with more errors.

    Magento Commerce customers can access 2.4.x and 2.3.x patches two weeks before the General Availability (GA) date. Pre-release packages are available through Composer only. You cannot access pre-releases on the Magento Portal or GitHub until GA. If you cannot find these packages in Composer, contact Magento Support.

Example - Minor release

Minor releases contain new features, quality fixes, and security fixes. Use Composer to specify a minor release. For example, to specify the Magento Commerce 2.4.0 metapackage:

Example - Quality patch

Quality patches primarily contain functional and security fixes. However, they can also sometimes contain new, backward-compatible features. Use Composer to download a quality patch. For example, to specify the Magento Commerce 2.3.4 metapackage:

Example - Security patch

Security patches contain security fixes only. They are designed to make the upgrade process faster and easier.

Security patches use the Composer naming convention 2.3.2-px. Use Composer to specify a patch. For example, to download the Magento Commerce 2.3.2-p1 metapackage:

Set file permissions

You must set read-write permissions for the web server group before you install the Magento software. This is necessary so that the command line can write files to the Magento file system.

Install Magento

You must use the command line to install Magento.

Eve echoes chromebook. This example assumes that the Magento install directory is named magento2ee, the db-host is on the same machine (localhost), and that the db-name, db-user, and db-password are all magento:

You can customize the Admin URI with the --backend-frontname option. However, we recommend omitting this option and allowing the installation command to automatically generate a random URI. A random URI is harder for hackers or malicious software to exploit. The URI displays in your console when installation is complete.

Setup magento 2 on localhost

For a full description of the CLI install options, refer to Install the Magento software from the command line.

Command summary

To display a complete list of commands, enter:

To get help for a particular command, enter:

For example,

The following table summarizes the available commands. Commands are shown in summary form only. For more information about a command, click the link in the Command column.

magento setup:installInstalls the Magento softwareNone
magento setup:uninstallRemoves the Magento software.Magento software installed
magento setup:upgradeUpdates the Magento software.Deployment configuration
magento maintenance:{enable/disable}Enables or disables maintenance mode (in maintenance mode, only exempt IP addresses can access the Magento Admin or storefront).Magento software installed
magento setup:config:setCreates or updates the deployment configuration.None
magento module:{enable/disable}Enable or disable modules.None
magento setup:store-config:setSets storefront-related options, such as base URL, language, timezone, and so on.Deployment configuration
Database (simplest way is to use magento setup:upgrade)
magento setup:db-schema:upgradeUpdates the Magento database schema.Deployment configuration
magento setup:db-data:upgradeUpdates the Magento database data.Deployment configuration
magento setup:db:statusChecks if the database is up-to-date with the code.Deployment configuration
magento admin:user:createCreates a Magento administrator.All of the following:
Deployment configuration
Enable at minimum the Magento_User and Magento_Authorization modules
Database (simplest way is to use magento setup:upgrade)
magento listLists all available commands.None
magento helpProvides help for the specified command.None

How To Install Magento2 In Localhost Wamp

Common arguments

The following arguments are common to all commands. These commands can be run either before or after the Magento software is installed:

Setup Magento 2 On Localhost

Long versionShort versionMeaning
--help-hGet help for any command. For example, ./magento help setup:install or ./magento help setup:config:set.
--quiet-qQuiet mode; no output.
--no-interaction-nNo interactive questions.
--verbose=1,2,3-v, -vv, -vvvVerbosity level. For example, --verbose=3 or -vvv displays debug verbosity, which is the most verbose output. Default is --verbose=1 or -v.
--version-VDisplay this application version
--ansin/aForce ANSI output
--no-ansin/aDisable ANSI output

How To Install Magento 2 Theme In Localhost

Hooray! You’ve completed the quick install. Need more advanced help? Check out our Advanced install guide.