Installing Magento with sample data and table prefix

As we all know, the documentation for Magento is pretty poor. Now, how do you install a fresh Magento 1.7.0.2 webshop, with a prefix on the sample data? You need to prefix the sample data as well, or they will no be available.

Why prefix?

Simple. Any hacker will try and use default settings. So, having a user called 'admin', an admin folder called 'admin' or default tablenames just makes your installation just that little bit easier to hack into. Of course, this is security by obscurity, which means that it should not be all you depend upon.

Installing Magento

  1. Download the latest stable full release from ww.magentocommerce.com/download
  2. Download the latest sample data from the same page. Don't worry if its release number lags behind that of the full release.
  3. Set up your server
  4. Create a new database
  5. Now download this file to prefix the sample data with the desired prefix: https://gist.github.com/joostvanveen/5984679
  6. Edit the prefix and path/to/sample-data.sql in that file and run it in your browser.
  7. Take the newly created SQL file with prefixes and import into your database.
  8. Copy the Magento install files into your webroot.
  9. Copy the sample data media folder into your webroot.
  10. Change some folder permissions:
    cd /into/your/project/webroot
    chmod o+w var var/.htaccess app/etc
    chmod -R o+w media
  11. Run the installer.
  12. In step 2, make sure to specify the same prefix you used in magento-sample-data-prefix-script.php