How to Install WordPress in AWS EC2: Step-by-Step Guide for Beginners
If you want to create a website and do not have the budget for expensive hosting then AWS EC2 T2.micro service is for you. This article will give you detailed information about How to Install WordPress in AWS EC2(Free for 12 months).
We give you step by step guide with all the necessary scripts (code) that guide you to How to Install WordPress in AWS EC2. This script is not only for the AWS cloud you can use this on any cloud server to host your WordPress site but the cloud is based on the Ubuntu/Linux operating system. Below is the full Ec2 instance WordPress tutorial:
Step 1: Create a Free AWS account
In this section of How to Install WordPress in AWS EC2, we will teach you how to create an Aws account, Below are all the steps:
- Go to the AWS website or click here. (It redirects you to the home page)
- Click on Create a Free Account.
- Sing up as a root user and enter all details that ask like email, phone number, address, and more.
- After successfully creating an account, log in to the AWS account.
Step 2: Launch the EC2 instance
In this section of How to Install WordPress in AWS EC2, we give you step by step guide to launching an AWS EC2 instance:
- After logging in to the AWS account, Search ec2 in the search bar and click.
- You get the EC2 dashboard on your screen.
- Click on Instances.
- After that Click on Launch Instances.
- Name you virtual machine you want like your Website name or anything you like.
- Scroll down and select Ubuntu and the latest version of Amazon Machine Image (AMI).
- After that select instance type. (note that select T2.mirco if you want to host your WordPress website for free other is paid).
- Create a Keypair that helps to log into the server via the SHH client(Putty or other).
- Create a security group.
- Configure storage as you want but in T2.micro you get up to 30 GB free, so select 30 GB.
- After all these steps click on Launch Instance (it takes a few min to launch and run).
- The last step is to make sure your instance is running by checking the instance state.
Step 3: Allocated Elastic IP and Associated with Running Instance
In this section of How to Install WordPress in AWS EC2, we Allocated Elastic IP to over EC2 Instance:
- Go To Ec2 Dash Board and click on Elastic IP
- Click on the Allocate Elastic IP address button.
- By default select “Amazon’s pool of IPv4 addresses” and click on Allocate.
- After that, your Elastic IP is created.
- To associate with our Running Instance select Elastic IP and click on Action.
- You get a drop-down menu and select an Associated Elastic IP address.
- After that Select Running Instance and Click on Associate.
- Your Elastic IP is associated with your running instance.
Step 4: Connect to our Instance
In this section of How to Install WordPress in AWS EC2, we connect over the server to the terminal:
- Go to the EC2 Dashboard and click on Instace.
- Select the instance you created and click on the connect button.
- You are redirected to SHH scroll down and click on Connect (I’m using AWS’s terminal but you can also use Putty and other SHH clients). (note: in this article, we have not covered other SHH Clients)
- Now you are on your server, you see below type of screen.
Step 5: Install WordPress on EC2 with the LAMP method (Linux+Apache+MySql+PHP)
In this section of How to Install WordPress in AWS EC2, we install all necessary servers on EC2:
- After connecting with the server first, update the server with the below command:
- sudo apt update
Let’s Install Apache2 server:
- sudo apt install apache2
- After that press “y”
- Copy your Instance Public IP and Pest on the search bar and check whether Apache2 is successfully installed or not.
Let’s Install MySQL:
- sudo apt update && sudo apt install mysql-server
- sudo service mysql status
- Refresh the page or Press Q to exit
Let’s create a MySQL Database User:
- sudo mysql
- CREATE USER ‘user’@’localhost’ IDENTIFIED BY ‘EnterPassword’; (User: As you want) (EnterPassword: Your Passwords)
- GRANT ALL PRIVILEGES ON * . * TO ‘user’@’localhost’;
- FLUSH PRIVILEGES;
- Exit
Let us create a MySQL Database:
- sudo mysql
- create database Name; (Name: as per your choice)
- Exit
Let’s Install the PHP and phpmyadmin:
- sudo apt update && sudo apt install php libapache2-mod-php php-mysql
- sudo apt update && sudo apt install phpmyadmin
- sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
- sudo a2enconf phpmyadmin.conf
- sudo systemctl reload apache2
Let’s Inatall Zip/Unzip:
- sudo apt-get update
- sudo apt-get install zip unzip
Let’s Install WordPress:
- cd /var/www/html/wordpress
- sudo wget https://wordpress.org/latest.zip
- sudo unzip latest.zip
- cd wordpress
- sudo mv * ..
- sudo rm -r wordpress
- sudo rm latest.zip
- sudo chown -R www-data:www-data /var/www/html/
- sudo chmod -R 755 /var/www/html/
WordPress Configuration
Let us Point our Domain to EC2 IP
- Log in to your domain provider.
- Open the DNS Management Setting
- Create or modify A Record and Cname.
- Wait for a few minutes for the DNS confirmation.
- After that, you can access your WordPress site using your domain name.
After all these steps, go to your IP and pest search bar and get the WordPress installation page. So finally we successfully installed WordPress on AWS EC2 and hosted the website for free.
For more, you can watch this YouTube Video:
Note: We use Cloudflare for DNS management and SSL but you also configure a free SSL certificate by using Scrip. If you want let us know we will provide you as soon as possible.
FAQs
Is AWS EC2 free to use?
AWS Ec2 is free for 12 months.
Can I host website for free?
Yes, you can host your website for free via the AWS EC2 free tier.
Can I Host my WordPress website for free?
Yes, You can host your WordPress website for free at the AWS Ec2 free tier.
Conclusion
So finally we covered all the information about How to Install WordPress in AWS EC2 and installed our WordPress to AWS EC2. Please share this article with needy once who want to learn How to Install WordPress on AWS EC2. If you find any problem in the following step please comment below we will try to solve it as soon as possible. Thank You for visiting Primemedianews.com!