Fully Automated Magento Install Script

As we’re a popular Magento hosting and Magento development company, we find ourselves installing Magento quite a lot throughout the day.

A few years ago we wrote an installation script, but rudely forgot to share it with the community. You can find it here

http://sys.sonassi.com/mage-install.sh (full)
OR
http://s.onas.si/?installmage (shortened)

The features

• Using the script is really easy
• Support for CE/EE
• Supports installation with/without sample data
• Chooses the correct sample data for the version of Magento you are using
• Automatically re-indexes after installation
• Automatically completes the full installer (with en_GB defaults)
• Automatically creates an admin account
• Supports CE 1.3/1.4/1.5/1.6 EE 1.10/1.11

Using the installer for Community Edition

  First log into your SSH account and execute,

wget -O mage-install.sh http://sys.sonassi.com/mage-install.sh

  Then execute the script, it takes a minimum of 5 arguments and 2 optional arguments.

Required arguments 

1. DB Host
2. DB User
3. DB Name
4. DB Pass
5. Magento version

Optional arguments (for auto install)

6. Store URL
7. Admin Email Address

  So for a full installation, that automatically installs Magento, adds sample data and completes the final install process, you would run.

mage-install.sh mydbhost myuser mydb "mypass" "1.6.2.0" "www.mystore.com" "info@mystore.com"

Which would show …

Do you really want to install in /home/mystore/public_html/ [y/N]: y
Do you want to install sample data? [y/N]: y

Starting installation, please wait ...
>> Downloading Magento 1.11 ... Done
>> Downloading sample data ... Done
>> Extracting files ... Done
>> Importing sample data ... Done
>> Setting up Mage ... Done
>> Cleaning up ... Done
>> Installing Magento ... SUCCESS
>> Re-indexing all indexes ... Done
>> Removing admin notifications ... Done

########################################

 INSTALLATION COMPLETE

 Admin Url     : www.mystore.comadmin
 Admin Username: info@mystore.com
 Admin Password: RfvDY-/l

########################################

Using the installer for Enterprise Edition

  If you wish to install Magento Enterprise edition – then you’ll need to download the tar.gz archive from your “My Account” section on MagentoCommerce.com.

  Upload the file to the base directory of where the installation will be

  Rename the tar.gz file to be latest-magento.tar.gz

  Continue with the instructions from CE above.

  • http://colin.mollenhour.com Colin Mollenhour

    Very nice, thanks for finally sharing. ;)

  • Martin_MME

    Thanks folks, I now have been able to build this into an automated remote Beanstalk & GIT deployment/version controlled process :smile: — I am now working successfully locally with a ‘git push’ command to perform automatic updates into dev/live on your hosting!

    The only (*very* minor gotchas/updates) to the build you may wish to update/add into post are:

    Changing line 123 of the default .htaccess file the script installs from #RewriteBase /magento/  to RewriteBase / — otherwise the intial link to /admin fails with a server error (/index.php/admin however works)

    Prompting for / adding:

    ############################################
    ## Case sensitivity fix for Magento 1.6.2.0
    SetEnvIf HTTPS On HTTPS=on

    to the .htaccess if you pick 1.6.2.0 as your build for the SSL loop issue.

    Thanks again folks – I can see this *really* helping workflow over here!

  • sonassi

    Hi Martin,

    It shouldn’t strictly need that line changing. Unless there are preceding RewriteRules inherited before the .htaccess declaration (ie. in the virtual host/server configuration itself) that modify the rewrite logic.

    By default, a rewrite base doesn’t need to be defined for the rewrite logic to work – but if other rewrite rules have been defined before Magento’s .htaccess, then you might need to uncomment this line. A prime example is with our shared hosting if you are using a sub-domain.

    But I’ll add an option for both anyway ;)

  • http://twitter.com/sparcksoft Kalen Jordan

    Sweet.  Do you guys support the ability to turn MAGE_IS_DEVELOPER_MODE on (and uncomment ini_set(‘display_errors’, 1) in index.php?  This is something I typically do in pretty much all my local / staging deployments.

    Thanks!

  • sonassi

    I assume you are asking if http://www.sonassihosting.com ‘s Magento shared hosting supports this. If so, yes, it does.

    As do all of our dedicated and Magento MicroCloud™ configrations

  • http://twitter.com/sparcksoft Kalen Jordan

    Sorry for the late reply, didn’t get any notification about this reply until I happened to make another Disqus comment on another site! :)

    Actually I was asking if this install script specifically supports that? I took a quick look through it and don’t think that I saw that piece.

    Thanks again for this contribution!

  • sonassi

    @twitter-427541571:disqus it won’t do that as standard (as not everyone wants it). We’ve kept it pretty stock, then you can make your own adjustments afterwards.