September 24, 2013

Setting up a Magento site on your Local Machine

Setting Up a Magento Site on your Local Machine

Setting up Magento (Community or Enterprise Solutions) 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:

[code] sudo nano ⁄etc⁄hosts [/code] 

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:

[code] 127.0.0.1 acme.local [/code] 

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

[code] sudo nano /Applications/MAMP/conf/apache/httpd . conf [/code] 

Magento is one of our core solutions‚ find more Magento advice and tips on our blog here.

Paul Weinert
Author

Paul Weinert is our founder, managing principal and spirit animal. He’s one of those odd people you meet that was born in Portland, grew up here and still lives here for some reason. If you had two words to describe Paul after meeting him, we’d bet you’d use “charmingly quirky”.

Paul started GRAYBOX in February 2009, and for the first four years, GRAYBOX had a blend of a contract staffing firm and a traditional agency. GRAYBOX then hired our first employees in 2012 and has been growing ever since. Professionally, Paul has a background in internet business consulting, working especially with mid-market ecommerce, healthcare, and tech companies. He worked as a user experience designer, web developer and internet marketer. Nowadays, Paul serves as our company visionary, team mentor and head of executive leadership — Paul is extremely proud of the entire team and the company. He’s constantly humbled by the team’s awesomeness and the caring community that’s sprung up from his initial ideas.

Beyond GRAYBOX, Paul is married, has two young boys and lives in NE Portland. He’s also an active foster parent, mentors other local entrepreneurs, and volunteers on local non-profit boards. Businesswise, aside from GRAYBOX, Paul has started a few other businesses and is an active investor in the local startup scene.

For the sheer joy of it, let’s play 2 truths and a lie:

  1. Paul firmly believes that any activity would be better if on a boat.
  2. Other than this whole Internet thing, Paul has basically no other skills or expertise in anything.
  3. Paul is rare unicorn, actually born and raised in Portland.