Magento is one of the leading e-commerce platforms 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 the release of Magento 2 in 2015, it took the online market share of the platform to around 30% of the 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 the 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 also need to ensure 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 the 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 the download button 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 to install Magento 2 by using the Web Setup Wizard.
Another option is to use composer with a 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 to your web server. Before starting with this you need to make sure that your web server has Composer installed.
Follow the below steps:
1. First you will require authentication keys from Magento Marketplace with a Magento account to log in. 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 the marketplace which you may purchase in the future will be available for you via Magento admin.
2. Next you need to create a project through composer which will contain the list of components required for installation.
3. log in to your web server with SSH access and go to docroot. Enter the below command on the 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 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 the terminal, and enter the below commands one by one:
php bin/magento sampledata:deploy
php bin/magento setup:upgrade
7. These commands update the 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 the below command in the 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 from the Magento 2 GitHub repository using SSH or HTTPS protocols. For this, we need to clone the Magento 2 repository on your web server.
Follow the below steps:
1. Visit this page in the web browser of the Magento GitHub repository.
2. On the right side click on SSH under the clone URL field and click the Copy to clipboard button as shown below.
3. Now go to your web server docroot directory and paste the URL with the below command in the terminal:
git clone firstname.lastname@example.org:magento/magento2.git
4. After cloning the repository go to the directory where Magento 2 is closed and you have to run the below command which updates package dependencies and can take a few minutes to complete:
5. After that install Magento2 by using the Web Setup Wizard which installs Magento without sample data.
6. Now to continue with the installation of sample data go to your web server docroot again, open the terminal and enter the below command and wait for the repository to be cloned:
git clone email@example.com:magento/magento2-sample-data.git
7. After the clone is complete, navigate to the /dev/tools directory in the cloned Magento sample data directory and run the below command:
php –f build-sample-data.php -- --ce-source=”<your Magento CE install directory>”
8. We are almost done. Just open the terminal and enter the 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 issues during the installation and require any expert help, our Magento 2 development team would be happy to assist.
Send us your project notes