September 20, 2019 / Nirav Shah
<strong>Step 1: Install Apache2 HTTP Server on Ubuntu</strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Update your server</li>
<pre>sudo apt update</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/1.png” />
</ul>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Install Apache2 service </li>
<pre>sudo apt install apache2 -y</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/2.png” style=”margin-bottom: 10px;” />
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/3.png” />
</ul>
<strong>Step 2: Install MariaDB Database Server</strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Install MariaDB server</li>
<pre>sudo apt-get install mariadb-server mariadb-client</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/4.png” />
<li>Create secure login in the MariaDB </li>
<pre>sudo mysql_secure_installation</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/5.png” />
<li>Login to your MariaDB server </li>
<pre>sudo mysql -u root -p</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/6.png” style=”margin-bottom: 10px;” />
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/7.png” />
</ul>
<strong>Step 3: Install PHP 7.1 and Related Modules</strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Install PHP7.1 in the Ubuntu server </li>
<pre>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</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/8.png” />
</ul>
<strong>Step 4: Restart Apache2</strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Restart apache2 service </li>
<pre>sudo systemctl restart apache2.service</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/9.png” />
<li>Create a phpinfo page</li>
<pre>sudo vim /var/www/html/phpinfo.php</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/10.png” />
<pre> <? phpinfo( ); ?> </pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/11.png” style=”margin-bottom: 10px;” />
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/12.png” />
</ul>
<strong>Step 5: Create Magento 2 Database</strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Login to MariaDB </li>
<pre>sudo mysql -u root -p</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/13.png” />
<li>Create a database </li>
<pre>CREATE DATABASE magento2;</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/14.png” />
<li>Create a user </li>
<pre> CREATE USER ‘magento2user’@’localhost’ IDENTIFIED BY ‘new_password_here’;</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/14.png” />
<li>Grant all the needed permission </li>
<pre>GRANT ALL ON magento2.* TO ‘magento2user’@’localhost’ IDENTIFIED BY ‘user_password_here’ WITH GRANT OPTION;</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/15.png” />
<li>FLUSH PRIVILEGES </li>
<pre>FLUSH PRIVILEGES;</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/16.png” />
<li>Exit the MariaDB </li>
<pre>exit</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/17.png” />
</ul>
<strong>Step 6: Download Magento 2 Latest Release</strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Install curl </li>
<pre>sudo apt install curl git</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/18.png” />
<li>Get the composer </li>
<pre>curl -sS https://getcomposer.org/installer | sudo php — –install-dir=/usr/local/bin — filename=composer</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/19.png” />
<li>Go to your html directory </li>
<pre>cd /var/www/html</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/20.png” />
<li>Create the repository</li>
<pre>sudo composer create-project –repository=https://repo.magento.com/ magento/project-community-edition magento2</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/21.png” />
<li>Copy Paste your credentials </li>
<pre>Public key </br>Private key</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/22.png” />
</ul>
<strong>Step 7: Create the user </strong>
<ul class=”listing” style=”margin-left: 15px;margin-bottom: 20px;”>
<li>Go to your magento2 directory</li>
<pre>cd /var/www/html/magento2</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/23.png” />
<li>Create the user with the needed details </li>
<pre>sudo bin/magento setup:install –base-url=http://example.com/ –db-host=localhost –db- name=magento2 –db-user=magento2user –db-password=new_password_here –admin- firstname=Admin –admin-lastname=User –admin-email=admin@example.com –admin- user=admin –admin-password=admin123 –language=en_US –currency=USD — timezone=America/Chicago –use-rewrites=1</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/24.png” />
<li>Give the permission </li>
<pre>sudo chown -R www-data:www-data /var/www/html/magento2/</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/25.png” />
<pre>sudo chmod -R 755 /var/www/html/magento2/</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/26.png” />
<li>Edit the 000-default.conf file</li>
<pre>sudo vim /etc/apache2/sites-available/000-default.conf</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/27.png” />
<pre>DocumentRoot /var/www/html/magento2/
<Directory /var/www/html/magento2/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/28.png” />
<li>Rewite the module </li>
<pre>sudo a2enmod rewrite</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/29.png” />
<li>Restart the apache2</li>
<pre>systemctl restart apache2</pre>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/30.png” />
<li>Allset hit the hostname or URL</li>
<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2019/09/31.png” />
</ul>
<style type=”text/css”>
ul.listing li {
list-style-type: disc !important;
}
ul.listing-new li {
list-style-type: disc !important;
}
.blog-portion-one ul li.list-none {
list-style-type: none !important;
list-style: none !important;
}
.blog-portion-one ul li {
list-style: outside none none;
margin-bottom: 10px;
list-style-type: disc;
}
.listing img {
width:100%;
}
ul.awsul li {
list-style-type: square !important;
margin-left: 40px;
}
code, pre {
overflow: auto;
white-space: pre;
display: block;
padding: 1.5rem;
position: relative;
font-size: 15px;
line-height: 1.82857143;
color: #333;
word-wrap: normal;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
overflow-x: auto;
overflow-y: auto;
margin-top: 20px;
margin-bottom: 20px;
word-break: break-all;
margin: 0 0 10px;
}
</style>

Nirav Shah is the Director of Eternal Web Pvt Ltd, an AWS Advanced Consulting Partner and certified Odoo Partner based in the UK. With over a decade of experience in cloud computing, digital transformation, and ERP implementation, Nirav helps enterprises adopt the right technology to solve complex business challenges. He specialises in AWS infrastructure, Odoo ERP, and web development solutions for businesses across the UK and beyond.
Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.