In my last big post on Magento deployment there were a number of simple little tidbits that on their own may be useful to people who might not be ready to jump headlong into the sort of project structure I described.
So with that in mind I thought I’d pull out the first of the useful tips, this time installing Magento 1.5 on MAMP (OSX) all via the command-line, it saves time and is nicely repeatable for scripting. Plus OSX is a unix system, why not make use of it!
In this little guide we’ll be installing Magento into your webserver’s document root. If that doesn’t mean anything to you, it may be worth checking out a couple of my earlier MAMP guides.
I wrote two related guides a while back that you may also find useful, for setting up MAMP based Magento development environments. Firstly a guide to installing MAMP on a Mac and secondly a way to set up virtual hosts on MAMP.
Update: Before we go any further, I included steps for downloading that use wget, which as Talesh quite rightly noted is not included with Mac OSX by default. I suggest you get wget on Mac OSX using Homebrew but there are other ways too.
Alternatively you can use curl to grab the file like this:
curl http://www.magentocommerce.com/downloads/assets/188.8.131.52/magento-184.108.40.206.tar.gz > magento-220.127.116.11.tar.gz
Ok, so we’re ready to begin. These commands should be copy-pastable, if anything goes wrong let me know.
cd ~/Downloads # If you do not have wget installed (see above) you can use curl. wget http://www.magentocommerce.com/downloads/assets/18.104.22.168/magento-22.214.171.124.tar.gz tar xzf magento-126.96.36.199.tar.gz #This assumes your document root is ~/Documents/web mv magento ~/Documents/web/magento/188.8.131.52
Now we create the database, again we can do this on the commandline, to save time fluffing around with phpMyadmin.
# Your password is probably still 'root', unless you changed it. /Applications/MAMP/Library/bin/mysql -uroot -p -e "create database magento1501" # Put your own ulta secure password in place of 'password' below /Applications/MAMP/Library/bin/mysql -uroot -p -e "grant all on magento1501.* to magento1501@'localhost' identified by 'password'"
Now we run the actual Magento install on the commandline. It pays to set the permissions before installing.
cd ~/Documents/web/magento/184.108.40.206 chmod -R o+w media var chmod o+w app/etc
This next command runs the actual install. There are several things you need to change to match. others are optional, for example timezone, currency and locale can all be changed later in the admin, but for a local development environment the defaults are probably fine. The admin email/username/password, database details and base url are all important. Screwing these up will render the install broken – happily it won’t take you long to re-run the above commands and start over if that happens, right?
/Applications/MAMP/bin/php5/bin/php -f install.php -- --license_agreement_accepted "yes" --locale "en_US" --timezone "America/Los_Angeles" --default_currency "USD" --db_host "localhost" --db_name "magento1501" --db_user "magento1501" --db_pass "password" --url "http://127.0.0.1:8888/magento/220.127.116.11/" --use_rewrites "yes" --use_secure "no" --secure_base_url "" --use_secure_admin "no" --admin_firstname "max" --admin_lastname "power" --admin_email "firstname.lastname@example.org" --admin_username "admin" --admin_password "password"
If it worked you’ll see something like
SUCCESS: 183748... with a big long hash code. Now you should be able to see the default Magento start page here: http://127.0.0.1:8888/magento/18.104.22.168/ and log in to the admin panel at /admin.
Let me know if you have any troubles with getting these commands to work. I ran through them myself doing an install and everything was just fine, but if your environment is set up differently there could be some subtle issues.