falco
By:
falco

Magento Droplet preconfigured with Sample-Data

July 22, 2015 5k views
One-Click Install Apps Applications Ubuntu

Dear DigitalOcean Team,

we would like to have a magento installation with preconfigured sample data (http://devdocs.magento.com/guides/m1x/install/installing_install.html#install-sample), as it is provided by magento. Do you have such one click application droplets available or would it be made available in the future?

If not, what would be the best procedure from your perspective to reach that goal?

Many thanks and regards,

Falco

btw, there is no tag "Magento" available below.

2 comments
  • hi falco!
    is your scripts create new admin user word fine?
    i installed Magento 1.9 with sample data 1.9.1.0 but didn’t have any admin login. can you help me?
    thank you!

  • Hi lekten. Yes it worked fine for me.
    Cheers,
    falco

4 Answers

Hi! When you create a droplet, you can select the one click Magento image. Take a look at How To Use the Magento One-Click Install Image for more info on how to use it.

To install the sample data, log in to your droplet as root and download the sample data archive:

mkdir ~/magento_sample_data
cd ~/magento_sample_data
wget http://www.magentocommerce.com/downloads/assets/1.9.0.0/magento-sample-data-1.9.0.0.tar.bz2

Then, extract it and copy the files to the magento instance:

tar xjvf magento-sample-data-1.9.0.0.tar.bz2
cd magento-sample-data-1.9.0.0
cp -r media/* /var/www/html/magento/media/
cp -r skin/* /var/www/html/magento/skin/

Finally, you'll need to import the mysql dump that's provided with the sample data. However, you will first need to delete the existing database as the sample data cannot be installed on an existing setup.

mysql -Bse 'drop database magento;'
mysql -Bse 'create database magento;'
mysql magento < magento_sample_data_for_1.9.0.0.sql

To clean up, simply delete the magentosampledata directory:

rm -r ~/magento_sample_data

You can now browse to your droplet's IP address to access the demo magento store.

DigitalOcean's Magento One-Click application provides a quick start to building a Magento storefront on top of a LAMP stack. This tutorial will guide you through the steps to finish configuring your site, including setting your domain name and installing an SSL certificate.
  • Thanks a lot! Worked like a charm!

  • Dumping the db will cause the admin-user to be deleted as well. The sample data does not have a admin user, therefore, you'll need to create a new admin-user. I did it by executing following scripts:

    INSERT INTO admin_user 
    SELECT
    NULL user_id,
    "Admin" firstname,
    "Super" lastname,
    "admin@invalid.test.com" email,
    "admin" username,
    MD5('lalilu') password,
    NOW( ) created,
    NULL modified,
    NULL logdate,
    0 lognum,
    0 reload_acl_flag,
    1 is_active,
    (SELECT MAX(extra) FROM admin_user WHERE extra IS NOT NULL) extra,
    NULL rp_token,
    NOW() rp_token_created_at,
    0 failures_num,
    NULL first_failure,
    NULL lock_expires;
    
    INSERT into admin_role
    SELECT
    NULL role_id,
    (SELECT role_id FROM admin_role WHERE role_name = 'Administrators') parent_id,
    2 tree_level,
    0 sort_order,
    'U' role_type,
    (SELECT user_id FROM admin_user WHERE username = 'admin') user_id,
    'admin' role_name,
    NULL gws_is_all,
    NULL gws_websites,
    NULL gws_store_groups;
    

Setting File and Directory Ownership and Privileges

cd /var/www/html/magento
chown -R www-data .
find . -type d -exec chmod 700 {} \;
find . -type f -exec chmod 600 {} \;
  • Why? causes executable files to become unexecutable. like cron.sh for instance or other important files.

Have another answer? Share your knowledge.