Install Magento 2 using Composer on AWS Ubuntu 16.04 | 18.04

Install Magento 2 using Composer on AWS Ubuntu 16.04 | 18.04

September 20, 2019 / Nirav Shah

Step 1: Install Apache2 HTTP Server on Ubuntu

  • Update your server
  • sudo apt update

  • Install Apache2 service
  • sudo apt install apache2 -y

Step 2: Install MariaDB Database Server

  • Install MariaDB server
  • sudo apt-get install mariadb-server mariadb-client

  • Create secure login in the MariaDB
  • sudo mysql_secure_installation

  • Login to your MariaDB server
  • sudo mysql -u root -p

Step 3: Install PHP 7.1 and Related Modules

  • Install PHP7.1 in the Ubuntu server
  • sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-gmp php7.1-curl php7.1-soap php7.1-bcmath php7.1-intl php7.1-mbstring php7.1-xmlrpc php7.1-mcrypt php7.1-mysql php7.1-gd php7.1-xml php7.1-cli php7.1-zip

Step 4: Restart Apache2

  • Restart apache2 service
  • sudo systemctl restart apache2.service

  • Create a phpinfo page
  • sudo vim /var/www/html/phpinfo.php

     <? phpinfo( ); ?> 

Step 5: Create Magento 2 Database

  • Login to MariaDB
  • sudo mysql -u root -p

  • Create a database
  • CREATE DATABASE magento2;

  • Create a user
  •  CREATE USER 'magento2user'@'localhost' IDENTIFIED BY 'new_password_here';

  • Grant all the needed permission
  • GRANT ALL ON magento2.* TO 'magento2user'@'localhost' IDENTIFIED BY 'user_password_here' WITH GRANT OPTION;


  • Exit the MariaDB
  • exit

Step 6: Download Magento 2 Latest Release

  • Install curl
  • sudo apt install curl git

  • Get the composer
  • curl -sS | sudo php -- --install-dir=/usr/local/bin -- filename=composer

  • Go to your html directory
  • cd /var/www/html

  • Create the repository
  • sudo composer create-project --repository= magento/project-community-edition magento2

  • Copy Paste your credentials
  • Public key 
    Private key

Step 7: Create the user

  • Go to your magento2 directory
  • cd /var/www/html/magento2

  • Create the user with the needed details
  • sudo bin/magento setup:install --base-url= --db-host=localhost –db-	name=magento2 --db-user=magento2user --db-password=new_password_here –admin-	firstname=Admin --admin-lastname=User –admin- user=admin --admin-password=admin123 --language=en_US --currency=USD --	timezone=America/Chicago --use-rewrites=1

  • Give the permission
  • sudo chown -R www-data:www-data /var/www/html/magento2/

    sudo chmod -R 755 /var/www/html/magento2/

  • Edit the 000-default.conf file
  • sudo vim /etc/apache2/sites-available/000-default.conf

    DocumentRoot /var/www/html/magento2/
    <Directory /var/www/html/magento2/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

  • Rewite the module
  • sudo a2enmod rewrite

  • Restart the apache2
  • systemctl restart apache2

  • Allset hit the hostname or URL

Talk to AWS Certified Consultant

    Spread Love By Sharing:

    Let Us Talk About Your AWS Development Requirements

    Have queries about your AWS project ideas and concepts? Please drop in your project details to discuss with our AWS experts, professionals and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project