Today, we’re going to teach you guys how to install Magento on AWS. Magento, as you might already know, is a leading eCommerce platform and is the #1 choice for many eCommerce entrepreneurs and businesses.
According to the Hostingtribunal, Magento currently powers 250,000+ live websites around the world.
On average, Magento is downloaded 5,000 times every day. And most importantly, merchants that use Magento grow 3 times faster than others.
Part of the reason for this is its powerful performance, high-scalability, and versatility. In simple words, the Magento platform gives you the ability to build your eCommerce store the way you want to with a vast opportunity to scale.
However, Magento alone cannot fulfill all the modern demands of the market. You also need to have the highest optimized hosting platform with best-in-industry infrastructure to host your Magento based eCommerce store.
And this is where Amazon Web Services (AWS) comes into the picture.
What is Amazon Web Services (AWS)?
Amazon web services is a highly flexible, reliable, and secure cloud hosting solution.
Launched in 2006, AWS emerged from the internal infrastructure of Amazon which was built to handle its own online retail operations.
In fact, AWS is the first company to introduce pay-as-you-go cloud computing solution that scales its storage, compute power, and throughput as needed.
It has been developed with the combination of the platform as a service (PaaS), infrastructure as a service (IaaS), and software as a service (SaaS) offerings.
As of today, AWS is the industry leader when it comes to cloud hosting.
And in this tutorial, we’re going to show you how to install Magento on AWS.
How to Install Magento on AWS: Step-by-Step Process?
To install Magento on Amazon Web Services (AWS), you need to:
- Setup a server on Amazon
- Install pre-requisite tools on the server
- Setup database
- Install and configure Magento on AWS
That being said, let’s get started.
Step #1 - Set up a Server on Amazon
First of all, go to https://aws.amazon.com/ and register an account.
After that, navigate to the AWS management console and you’ll be prompted with the following screen:
If you’re not able to see the above screen, try finding it in the “Find Services” section. You’ll definitely find it there.
Click on the “Launch Instance”.
Now, choose a machine with a default operating system from either Ubuntu, Linux, Windows, etc.
For this tutorial, we will choose the Ubuntu server. Although, you can also choose Windows or Linux. The configuration is almost similar.
All you need to make sure is that you match up with the Magento 2 system requirements, which is 2 GB RAM.
Now, the next step is to select type “t2 medium”.
Then, click on the Configure Instance details and you’ll be prompted with the following screen:
Next, it’s time to configure your machine.
Here, you only need to proceed further with additional storage options.
Although, the default storage size would be enough to get started. However, you can increase the size if you want to.
After that, click on the “Add Tags” and configure the security group button. This step may seem basic, but remember that it’s very crucial.
Now, it’s time to add rules about which countries across the globe will be able to access your server.
In other words, here we can put security rules or navigate the type and select all traffic.
Now, click on the “Review and Launch”.
As you click, you’ll have an opportunity to review your configuration and see the following screen.
Here, select key pair and enter a key, which will allow you to connect to your server machine securely.
Technically, there will be a public key that AWS stores and also a private key file that you’ll store.
So, download this key pair and store it securely with you as you won’t be able to access your server without it.
After that, click on the“Launch Instance” and verify if you can see things getting initialized.
Now, locate the “pencil write the icon” and click on it to write a name for your server.
Finally, you’ll be connected to your new server.
Now, install git if you haven’t already and download the key pair that you stored earlier.
Then, select the git bash and copy this line.
Also, make sure to paste it in the git bash as well.
And it’s done!
Now, press the “Enter” key on your keyboard and you’ll find your server.
Step #2 - Install Pre-Requisite Tools on the Server
The next step of the process is to install pre-requisite tools on your AWS server.
For this, execute the following code in the given order.
ls -al
The above code will display all the folders on your server.
sudo su
This code will redirect you to the home/Ubuntu folder. This basically means you’ve signed in as a root user.
apt-get update
The above code will update your server with all the latest tools.
sudo apt-get install apache2 php libapache2-mod-php mysql-server php-mysql php-dom php-simplexml php-curl php-intl php-xsl php-mbstring php-zip php-xml composer
This code will install Apache, PHP, MySQL server for database, and all the necessary tools required for Magento.
Now, press “Y” to finish the installation process.
After this, install PHP gd extension using the following code.
apt-get install php7.2-gd
Next, install PHP mcrypt extension with the following command.
apt-get install php7.2-mcrypt
Now, execute:
sudo a2enmod rewrite
Then, restart the Apache with the following command:
systemctl restart apache2
After that, navigate using the below 2 commands:
cd /etc/apache2/
sudo nano apache2.conf
Now, press ctrl+w and search indexes.
Then, replace None word with all as shown below:
Now, press ctrl+x, then press Y and hit Enter.
After that, restart the Apache again:
systemctl restart apache2.service
Then, go to the public root folder and clone Magento 2 from Github using following commands:
cd /var/www/html git clone https://github.com/Magento/Magento2.git cd Magento2
Now, install composer using the following command:
composer install
In case you’re prompted with an error like shown below:
Run the below commands to resolve it:
apt-get install php7.2-bcmath composer install
In case the composer is still not getting installed, execute the following commands:
sudo apt-get install php-soap composer install
Lastly, you will need to change the permissions of the directory so that Magento setup can install the necessary files:
chmod -R 755 /var/www/html/Magento2/ chmod -R 777 /var/www/html/Magento2/var/ chmod -R 777 /var/www/html/Magento2/pub/ chmod -R 777 /var/www/html/Magento2/app/etc chmod -R 777 /var/www/html/Magento2/generated sudo service Apache2 restart
Step #3 - Setup Database
The next step is to login into MySQL by executing the following command:
mysql -u root -p
Once you execute the command, it will ask you for a password.
Now, by default, it’s none so just hit the “Enter” button on your keyboard and you’ll be redirected to the MySQL terminal.
- show databases: shows your current table.
- create database Magento: it will create a database for Magento
- exit: it will exit from MySQL terminal
Step #4 - Install & Configure Magento on AWS
This is the last step of this tutorial and here we will finally install and configure Magento on AWS (Amazon Web Services).
Firstly, navigate to your IP address:
Then, copy and paste in your browser like xx.xxx.xxx.xx/Magento2/setup
Click on the “Agree and Setup Magento” button.
Next, you’ll see the following screen.
Now, it’s time to finally start installing Magento:
And that’s it!
Concluding Thoughts…
Congratulations!!
You’ve now finally learned how to install Magento on AWS.
We hope that you found this tutorial helpful. If you have any questions, please ask them in the comments below.
And if you need our professional assistance, feel free to contact us at any time.