Magento is one of the leading e-commerce platform in the world. Most of the big brands in the world use Magento for their e-business because of its flexibility, reliability and open-source nature.
Many of the leading online businesses and even small retail businesses have started to migrate to Magento 2 from other ecommerce platforms because of its wide range of inbuilt functionalities, high scalability and continuous growth in development.
With release of Magento 2 in 2015 it took the online market share of platform to around 30% of total market. Magento 2 is now considered to be dominating all other ecommerce platforms with its powerful features like improved performance with NGINX, Redis, Varnish support, inbuilt Full Page, Cache CSS preprocessing, CSS and JS Minification, Code generation, Requirejs for improved JS and User-friendly Checkout.
Have you been thinking to start your own store with new Magento 2 but don’t know anything about it? To get you started here is a step by step guide on how to download and install Magento 2 with sample data on your server:
Before we start on the download you need to make sure that your server configuration meets Magento 2 requirements listed below.
– Apache 2.2 or 2.4
– PHP 5.6.5 or higher
– MySQL 5.6 or higher
You need to also make sure that you have server access as System Owner to run SSH commands. You can check this with your hosting provider
As its self-explanatory this is the easy way to download and install Magento 2. Go to Magento Resources and find the section with title “Magento Release with Sample Data”. Then select the latest version and the archive format (zip, tar.gz,tar.bz2) you want to download the Magento 2 setup and click on download button to which will provide you the setup with sample data or without sample data as per your needs
Now login to your server and extract the package in the web server docroot using one of the following commands based on the archive format you downloaded:
Now the next thing left is toinstall the Magento2 by using the Web Setup Wizard
Another option is to use composer with meta package downloaded from Magento directly on the web server. Composer is a dependency management tool for PHP.For this you will require SSH access of your web server. Before starting with this you need to make sure that your web server has Composer installed.
Follow below steps:
1. First you will require authentication keys from Magento Marketplace with Magento account to login. After login you can go to “My Access Keys” and then provide info of “Name” and you can generate a new set of keys. This way extensions from marketplace which you may purchase in future will be available for you viaMagento admin.
2. Next you need to create a project through composer which will contain list of components required for installation.
3. Login to your web server with SSH access and go to docroot. Enter below command on terminal:
composer create-project --repository-url=https://repo.magento.com/magento/project-community-edition
4. It will prompt you for authorization keys. The public key will be your username and the private key will be your password which you got from Magento Marketplace.
5. After that install the Magento 2 by using the Web Setup Wizard which installs Magento 2 without sample data.
6. Now to install the sample data go to your web server docroot again, open terminal and enter below commands one by one:
php bin/magento sampledata:deploy
php bin/magento setup:upgrade
7. These commands update Magentocomposer.json file and installs the sample data.
8. Now if you got this message after that command – “Please re-run Magento compile command” then use below command in terminal to refresh Magento architecture and it may take some time to complete the process:
php bin/magento setup::di:compile
The last option to download and install Magento is fromthe Magento 2 GitHub repository using either SSH or HTTPS protocols. For this we need to clone the Magento 2 repository on your web server.
Follow below steps:
1. Visit this page in web browser the MagentoGitHub repository.
2. On right side click on SSH under clone URL field and click Copy to clipboard button like shown below.
3. Now go to your web server docroot directory and paste the url with below command in termical:
git clone firstname.lastname@example.org:magento/magento2.git
4. After cloning the repository go to the directory where Magento 2 is cloned and you have to run below command which updates package dependencies and can take a few minutes to complete:
5. After that install the Magento2 by using the Web Setup Wizard which installs Magento without sample data.
6. Now to continue with installationof sample data go to your web server docroot again, open terminal and enter below command and wait for the repository to be cloned:
git clone email@example.com:magento/magento2-sample-data.git
7. After clone is complete, navigate to /dev/tools directory in the cloned magento sample data directory and run below command:
php –f build-sample-data.php -- --ce-source=”<your Magento CE install directory>”
8. We are almost done. Just open terminal and enter below commands one by one to refresh Magento 2 architecture:
Once the sample data is deployed, it will be installed automatically when you install or upgrade your Magento instance either by using the Magento Setup Wizard or from the command line.
If you face any issue during the installation and require any expert help, our Magento 2 development team would be happy to assist.
Have any questions? Write in the comments section below.
Send us your project notes