Title: How To Setup And Configure Latest Magento 2.X On Linux EC2

Configure Latest Magento 2.X,This manual explains the stairs to put in and configure modern day Magento 2.X on a Linux ec2 cloud server or a VPS. We can be doing the subsequent.

  1. Setting up LAMP Stack (Mysql model 5.6 or later)
  2. Setting up Database and consumer (CLI and PHPMyAdmin)
  3. Setting up Magento 2.Zero the use of composer.

I am using an Ubuntu 14.04 LTS server from Amazon ec2. This tutorial will paintings on any cloud or VPS having a Ubuntu server.

Configure Latest Magento 2.X,Setup LAMP Stack

  1. Update the Server
sudo apt-get replace -y

2. Install apache

sudo apt-get install apache2

03.Install MySQL server and the PHP module for MySQL. During installation, MySQL would set off for the password for the foundation user. Set a robust password.

sudo apt-get install mysql-server-5.6 php5-mysql

04. Create MySQL database directory using the following command.

sudo mysql_install_db

05. Run the MySQL secure installation command.

sudo mysql_secure_installation

The above command would prompt for the root password. Enter the root password and proceed with the options given in the output below.

Enter current password for root (enter for none):
 
Change the root password? [Y/n] n
 ... skipping.
 
Remove anonymous users? [Y/n] y
 ... Success!
 
Disallow root login remotely? [Y/n] y
 ... Success!
 
Remove test database and access to it? [Y/n] y
 
Reload privilege tables now? [Y/n] y
 ... Success!

6. Install PHP.

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

7. Open /etc/apache2/mods-enabled/dir.conf file using vi or nano editor.

sudo vi /etc/apache2/mods-enabled/dir.conf

The file would look like the following.

 DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm

Move index.php to first so that the file would look like the following.

DirectoryIndex index.php index.html index.cgi index.pl i index.xhtml index.htm

8. Restart apache server.

sudo service apache2 restart

9. To know all the PHP details, create a file named info.php

sudo vi /var/www/html/info.php

Copy the following contents on the info.php file.

<?php
phpinfo();
?>

Now, if you browse to http://<Server-IP>/php.info, you will be able to see all the PHP configuration details.

Configure Latest Magento 2.X,Install And Configure PhpMyAdmin

PhpMyAdmin is a wonderful software for dealing with databases thru GUI. Follow the steps carefully for putting in PhpMyAdmin.

  1. Install PhpMyAdmin
sudo apt-get install phpmyadmin -y

When it prompts for web server, press area bar and pick apache2 and press enter. For Configure database for PHPMyAdmin, press input. Password of the database’s administrative person, enter the basis password for MySQL that you created at some stage in MySQL set up. Enter the equal password for affirmation.

02.Enable PHP mcrypt module.

Sudo php5enmod mcrypt
 

3. Restart the web server.

sudo service apache2 restart

Now you can get admission to the PhpMyAdmin Web UI via touring the ec2 public IP address observed by way of PHPMyAdmin as shown under.

http://<server-IP>phpmyadmin

You can use the MySQL root credentials to log in to PHPMyAdmin account.

Create Magento User And Database

You can create MySQL user and Database the use of the command line as well via PhpMyAdmin. Using PHPMyAdmin is self-explanatory. If you need to use the command line for developing the user and database, you can follow the stairs given underneath.

1. Sign into MySQL client using the root user and password.

mysql -u root -p

2. Create database Magento.

CREATE DATABASE magento;

3. Create a magento_admin with a strong password. Replace “password” with your strong password.

CREATE USER magento_admin@localhost IDENTIFIED BY 'password';

04.Grant all privileges to magento_admin for Magento database. Replace password therefore.

GRANT ALL PRIVILEGES ON magento.* TO magento_admin@localhost IDENTIFIED BY 'password';

5. Flush all the privileges and exit the MySQL CLI.

FLUSH PRIVILEGES;
exit

Setting Up Magento

In this section, we can configure Magento using LAMP stack. Follow the stairs cautiously.

01.Create a document known as magento.Conf within the apache sites available folder.

sudo vi /etc/apache2/sites-available/magento.conf

Copy the following content on the file.

<VirtualHost *:80>
 DocumentRoot /var/www/html
 <Directory /var/www/html/>
 Options Indexes FollowSymLinks MultiViews
 AllowOverride All
 </Directory>
</VirtualHost>

2. Enable our new conf and disable the default conf using the following commands.

sudo a2ensite magento.conf
sudo a2dissite 000-default.conf

3. Reload the apache service.

sudo service apache2 reload

04.Open personal home page.Ini report to increase the memory_limit parameter to 512M (default 128M).

sudo vi /etc/php5/apache2/php.ini

Find memory_limit parameter and set it to 512M and save the file.

memory_limit = 512M

5. Install required PHP modules for Magento.

sudo apt-get -y install libcurl3 php5-curl php5-gd php5-mcrypt php5-intl php5-xsl

6. Enable rewrite, mcrypt module and restart the apache server.

sudo a2enmod rewrite
sudo php5enmod mcrypt
sudo service apache2 restart

Setup Magento 2.X

1. Install Composer.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

02.Create a Magento marketplace account and get public and private get entry to keys from your account. Refer this hyperlink for buying the private and non-private keys

03.Create an auth.Json report

sudo vi /root/.Composer/auth.Json

Copy the following content on to the file together with your public and private key.

{
"http-basic": {
      "repo.magento.com": {
         "username": "edd45269f04a6ca51cbbbed2fedab26b",
         "password": "ef88687a5cf5d109c5540ff401b0b903"
      }
   }
}

4. Get the latest Magento binaries using git.

If you don’t have git installed, install it using the following command.

sudo apt-get install git -y

Clone the magento2 community version code to Magento directory.

git clone -b 2.0 https://github.com/magento/magento2.git magento

5. Copy all files to /var/www/html directory using rysync.

sudo rsync -avP magento/. /var/www/html/

6. CD into /var/www/html folder and install all the required Magento modules using composer.

cd /var/www/html
composer install

7. Change the owner of /var/www/html to www-data.

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

Eight. Visit the general public IP of your server. You will see the Magento setup page as shown underneath.

magento initial setup

9. Click agree and setup. Click next for database settings.

magento 2 initial setup

10.Enter the database username , password and database name you have got created underneath MySQL configuration as shown beneath. Click next after getting into the information.

magento database configuration

11.Next web page, you can see the shop and admin web page deal with. You can customise the admin age route. If you have got a site call, you could map the domain call to the IP deal with.

magento 2 admin url confirations

From this point, you may click on next and fill in the information. In the remaining page, click on “Install” alternative. Once set up, you will get all of the details of your Magento site as proven under.

magento final installtion