Install optional sample data

This topic discusses how to install optional Magento sample data. Sample data simulates an active Magento store, including customers, products, and other data.

Get started

To get started:
  1. Log in to your local development machine, or switch to, the Magento file system owner.
  2. Change to a directory to which the Magento file system owner has write access, such as the web server docroot.
  3. Log in to your project:

    magento-cloud login
    
  4. List your projects:

    magento-cloud project:list
    
  5. If necessary, clone a project.

    magento-cloud project:get <project ID>
    

    Typically, you should clone the project in the web server’s docroot or a Virtual Host docroot.

  6. Change to a project directory.

    For example, cd /var/www/html/magento2

  7. List environments in the project:

    magento-cloud environment:list
    

    magento-cloud environment:list displays environment hierarchies whereas git branch displays does not. If you have any nested environments, use magento-cloud environment:list.

  8. Fetch origin branches:

    git fetch origin
    
  9. Check out an environment:

    magento-cloud environment:checkout <environment ID>
    

    To create a new environment, use magento-cloud environment:branch <environment name> <parent environment ID>

  10. Pull updated code:

    git pull origin <environment ID>
    
  11. Create a snapshot of the environment.

    magento-cloud snapshot:create -e <environment ID>
    

Install sample data

To install sample data:

  1. If you have not done so already, check out the environment in which to install sample data.
  2. Enter the following commands at a terminal prompt:

    <Magento root dir>/bin/magento sampledata:deploy
    
  3. Wait for components to update.
  4. Upgrade the database and schema:

    <Magento root dir>/bin/magento setup:upgrade
    
  5. Commit and push the changes:

    git add -A && git commit -m "Install sample data"
    git push origin <branch name>
    
  6. Wait for the project to deploy.
  7. Verify the installation was successful by going to your storefront main page.

    The URL displays on the command line under the heading Environment routes: after the project deploys.

  8. Take a snapshot of your environment:

    magento-cloud snapshot:create -e <environment ID>