Setting up a Magento site on your Local Machine

Posted on Tue, September 24, 2013 in Greatest Hits, Web Design, by Mark Middleton

Setting Up a Magento Site on your Local Machine

Setting up Magento (Community or Enterprise) for local development can be a little tricky, but with these tips you can be up and running in no time

Here’s what we will cover:

Installation of MAMP MAMP (not MAMP Pro) is a free one-click installation of Apache, MySQL and PHP for Mac OS X Configuring your Computer’s Hosts File Configuring Apache Setting up your MySQL Database Importing and updating Magento

MAMP

MAMP = Macintosh, Apache, Mysql and PHP 

http://www.mamp.info/en/mamp

MAMP is a single program which installs the LAMP stack on your local machine. By default, it sets your document root to be in the MAMP folder inside your Applications folder. If this annoys you as much as me, it is easy enough to move your doc root folder to any place you like (such as your Sites folder set up in OS X)

Step 1: download and install the MAMP binary

http://www.mamp.info/en/downloads

This single binary contains MAMP and MAMP Pro. I personally use MAMP, but Pro adds a couple of handy features for managing domain names (which we will do manually in this tutorial). For this tutorial, we will only install MAMP and leave Pro out of the mix. To only install MAMP, make sure to click “customize” on the “installation type” step and uncheck “MAMP Pro”

 

Step 2: decide on your local domain name, and update your hosts file

Magento does not take kindly to working from an IP address. Most of our team has a single “local” second level domain, and use a different hostname for each client site they are working on. For example: acme.local, where “local” is the domain, and “acme” is the client. We can set up *.local in our computer’s hosts file, and configure apache for each subdomain. An alternate route is to create a custom domain name for each client (no purchase of a domain name is necessary, as these are only resolved locally). www.acmelocal.com can be configured as a local domain for this specific client. For this tutorial, let us use the first option: acme.local Updating your hosts file Your hosts file tells your entire computer system to override specific domains. It must be edited by your root user account. An easy way to do that is with your terminal. Applications → Utilities → Terminal Once in Terminal, as an admin edit your hosts file by typing:

sudo nano ⁄etc⁄hosts 

you will be prompted for your admin password, entering it will open your hosts file for editing. add the following line to your hosts file:

127.0.0.1 acme.local 

This simply says to your computer that whenever it wants to find acme.local, to route everything to 127.0.0.1 which is the default local ip address for Apache. CTRL-X to exit, which will prompt you to save the file, type “Y” and click enter to confirm it will write over your hosts file at ⁄etc⁄hosts

Step 3: Updating Apache Config

Now, we must tell Apache where to find files for acme.local when your browser routes to that address First, make a folder in your htdocs directory: ⁄Applications⁄MAMP⁄htdocs⁄acme.local⁄ From terminal, edit your Apache Config

sudo nano /Applications/MAMP/conf/apache/httpd conf 

Tell Us About Your Project

Invalid phone number