Install and Configure Magento2 in Linux

This week I give a presentation on Magento2. I show that how to install configure and work with Magento2. Magento is the fastest growing, powerful and flexible E-Commerce platform today. It allows you to run and control a transectional website for goods and services online. There are many benefits of Magento as compare to other platforms of e-commerce. It is open source product, free to use, self-hosted, deeply coustomizable and an abundance of community help.
Here a question arise that why we use Magento, why not use other paltforms like WooCommerce. The reason is that it is more flexible to work with compare to other platforms like shopify and wooCommerce. MAgento has its own site for questions. If you have any question or query you just go to Stak Exchenge (official site of magento for users) and ask your question. Due to security issues we use Magento because it especially build for E-Commerce websists. It is also has multistore capability and scalability. There are top world brands that are using Magento which are Nike , Ford , Nespresso , Samsung , Lenovo , Coca Cola and many other top companies.
So now let’s start to install and configure Magento2 in Linux on Localhost web browser. At very begining you must install apache2 web-server of any other web-browser like nginx. To install Web-Server and MySQL server open your teminal and type following command:

 sudo apt update && sudo apt install phpmyadmin

It will ask you to give password for phpmyadmin which will be the password for your databases as well. After installing the apache2 now you have to install php extentions, which will necessary for Magento installation other wise Magento will not be installed properly. To install extentions run the command:

sudo apt install php7.0-fpm php7.0-mcrypt php7.0-curl php7.0-cli php7.0-mysql php7.0-gd php7.0-xsl php7.0-json php7.0-intl php-pear php7.0-dev php7.0-common php7.0-mbstring php7.0-zip php-soap libcurl3 curl -y

Now to install the Magento2 go to magento.com and download the Full Release with Sample Data zip or tar file. Now go to your html directory.

cd /var/www/html

Create a directory for Magento data having name magento.

sudo mkdir magento

Now change the mod of magento directory.

sudo chmod -R 755 ./magento

Now extract the files of Magento which we download before, in magento directory which we create in html directory. Now change the ownership of magento directory. – Run the command on the root directory of magento:

sudo chown -R www-data:www-data /var/www/html/magento/

Now install apache2 module which is libapache2-mod-php. This package provides the PHP module for the Apache 2 webserver. To install this module run the following command:

sudo apt install php libapache2-mod-php

Now go to phpmyadmin and create new database having name magento.

After creating database now you have to edit some files of php.

Edit the following files:

    /etc/php/7.0/fpm/php.ini
    /etc/php/7.0/cli/php.ini
    /etc/php/7.0/apache2/php.ini

The things that you have to change are:

    max_execution_time = 1800
    max_input_time = 6000
    memory_limit = 1024M
    post_max_size = 128M
    upload_max_filesize = 32M

Now you have to enable mod_rewrite for apache2. In order to use mod_rewrite type the following command:

sudo a2enmod rewrite

Now run following command to edit config file:

sudo vi /etc/apache2/sites-available/000-default.conf

Insert following lines into the file.

    <Directory /var/www/html>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </ Directory>
    

Now restart your apache Web-Server by using following command.

service apache2 restart

Now configuration is done now go to your browser and type:

localhost magento

If the installation is properly done this window will appear:

__0

Click on Agree and Setup Magento next window that will appear will show the extentions of php that we install before. If  the extentions is not properly installed this window will appear.

-0

If the extentions are properly installed this window will appear.

0

Click on Next. In next window you have to give your database username and password of your database that we create before. Make sure that the name of your database and Magento  directory must be same.

2

Click on Next.

3

In this window you have to give the address of  admin and store address. In my case both are on localhost. Click on Next.

4

In this window you have to give store time zone, store default language and your store default currency. Click on Next.

5

In this window you have to give the information of your store Admin. In my case the username of Admin is admin and give admin password and email. Click on Next.

6

Now click on Install Now to install Magento.

7

It will takes a little time. When the installation is completed new success window will appear. In success window there will be address of your store and Admin address. Now go to you browser and type:

localhost/magento

This is the Frontend of Magento. This will look like this.

local.png

Now open new tab and type:

localhost/magento/admin

This is the link of Admin of store. It will ask you to login:
admin.png

After login a dashbord will appear that will be the backend of your store.
dashbord.png

You can manage your store on this dashboard. You can add new products delete old products add new categories and many other tasks.                                                                      If you go to CATALOG and then categories a new window will appear which look like this.

catalog.png

All the data of your store is placed here. You divide products in categories form and add new categories .                                                                                                                                       If you go to CATALOG and then products a new window will appear which look like this.

new.png

You can add new products by clicking on Add Product. Also you can edit the detail of previous products or delete previous products. If somebody order a product this order will be displayed in this dashboard. Many other tasks that you can perform here.

3 thoughts on “Install and Configure Magento2 in Linux

  1. You may want to recheck your commands, i don’t think there is any space in www-data:www-data. Also proof-read your article before publishing it!
    Overall it’s Great! (y)

    Like

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.