Putting in WordPress on Amazon Net Providers (AWS)

This tutorial will stroll you thru putting in a contemporary copy of WordPress on an Amazon Net Providers (AWS) EC2 (Elastic Cloud Compute) server.

You should use this to create a growth, staging, or manufacturing machine of various sizes and configurations on AWS, every thing from a take a look at web site to a manufacturing web site for a enterprise.

Half 1: Create a server on Amazon Net Providers

We are going to run the newest Ubuntu Server as our working system on AWS.

There are various different suppliers that you could deploy on and the steps for making a server on every one are barely totally different.

After getting Safe Shell Service (SSH) entry to the machine operating Ubuntu that you just intend to put in WordPress on, the set up steps are the identical.

You can too do the identical factor with another cloud supplier, native Ubuntu (or by-product distribution) laptop computer, a neighborhood Digital Machine (VM), or another setup operating Ubuntu.

Step #1: Create a server on AWS

Create and check in to your AWS account. Then use the search field on the high and kind “ec2“. Then click the “EC2” hyperlink to go to Amazon’s EC2 server part. This can permit us to create a brand new server on your web site.


Click on on the “Instances” tab on the left aspect. Then click on the orange “Launch Instances” button within the high proper nook.

AWS Instances

Choose the “Ubuntu Server 20.04 LTS” picture in “64-bit (x86)” format by clicking the blue “Select” subsequent to it.

Select a server on AWS

You possibly can choose the occasion kind and alter many settings, however for a easy demo web site, you’ll be able to settle for the default settings for every thing till you get to Step 4.

Right here, add some additional storage. I added 100GB because the storage which needs to be superb for many websites. To remain within the free tier with new AWS accounts, add as much as 30GB.

Websites that want extra would do properly to look into Easy Storage Service (S3), Elastic Block Storage (EBS), Elastic File System (EFS), or different extra superior AWS choices to retailer giant quantities of information.

Option to add storage

Create a brand new Safety Group in Step 6 with the next parameters:

Configure security group

Listed below are the ultimate settings for assessment.

Review instance launch

As soon as you’re able to launch, click on “Launch” and transfer ahead to the following step.

Step #2: Create key pairs

You’ll be prompted to pick a key pair. That is the important thing that may permit you entry to your server.

Create an AWS key pair

We are going to create a brand new key pair and provides it a reputation, on this case “wp-key“:

Key pair name

Be sure to save this key and don’t lose it! You’ll lose entry to your server and something on it with out this key and have to start out over from scratch! Even AWS won’t be able that will help you. Put it aside someplace and make backups in a secure location.

Open key pair

Now that you just’ve created a key pair, click on “Launch Instances” to create the server.

Launch Instances

It’ll take a couple of minutes, however ultimately, you’ll see the server as “Running” within the “Instances” tab.

AWS server is running

You possibly can hook up with your server with both the DNS identify given to it by AWS or its public IP, if it has one (by default it does). Choose one. We are going to use this in Half 2 to connect with the server utilizing SSH and set up WordPress.

Connect via DNS

Half 2: Putting in WordPress

Now that you’ve a operating server, we might want to hook up with it.

Hook up with AWS with a terminal

open up a Terminal window (Terminal app on a Mac, any Linux Terminal app like Konsole, or use the putty GUI for Home windows) and ssh into your AWS server by operating:


The place SERVER-IP-OR-DNS-NAME is the IP or DNS identify assigned by AWS to your server and KEY-PAIR-FILE is the .pem key pair file you downloaded from AWS and saved securely someplace. An instance of this ssh command may be:

ssh -i wp-key.pem [email protected]

The primary time you hook up with the server from a machine, you’ll be requested if you wish to proceed connecting. Sort “yes” and hit enter to attach.

The authenticity of host 'ec2-54-183-89-52.us-west-1.compute.amazonaws.com (' cannot be established.
ECDSA key fingerprint is SHA256:FYzlGdwXH99bpLL5KwQbE9sHKaM5eaflEbje8/JaQoM.
Are you certain you need to proceed connecting (sure/no/[fingerprint])?

When you get this warning:

Permissions 0644 for 'wp-key.pem' are too open.
It's required that your personal key information are NOT accessible by others.
This personal key will probably be ignored.

Run this from the listing containing the .pem key earlier than operating the SSH command to alter the filesystem permissions and make the important thing readable solely by the present person.

chmod 600 wp-key.pem

You’ll get the Ubuntu welcome message much like the one under:

Welcome to Ubuntu 20.04.1 LTS (GNU/Linux 5.4.0-1029-aws x86_64)

 * Documentation:  https://assist.ubuntu.com
 * Administration:     https://panorama.canonical.com
 * Assist:        https://ubuntu.com/benefit

  System data as of Sat Jan  9 03:24:39 UTC 2021

  System load:  0.0               Processes:             101
  Utilization of /:   1.3% of 96.88GB   Customers logged in:       0
  Reminiscence utilization: 21%               IPv4 handle for eth0:
  Swap utilization:   0%

1 replace may be put in instantly.
0 of those updates are safety updates.
To see these extra updates run: apt listing --upgradable

The listing of accessible updates is greater than per week outdated.
To examine for brand new updates run: sudo apt replace

The applications included with the Ubuntu system are free software program;
the precise distribution phrases for every program are described within the
particular person information in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
relevant regulation.

To run a command as administrator (person "root"), use "sudo ".
See "man sudo_root" for particulars.

[email protected]:~$


sudo su

to get root entry.

Setup your system

Then replace and improve all of the packages on the system:

apt replace && apt improve -y

It’s going to take a while, however as soon as it’s performed, run this to put in the Apache net server, PHP, and different applications we are going to want:

apt set up libapache2-mod-php mariadb-server php7.4 php7.4-mysql wget

You must now have the ability to see the default Apache web page in the event you go to http://your-aws-domain-name:

Ubuntu Default page

To check that PHP is put in accurately, run the next:

cd /var/www/html
rm -f index.html
echo " index.php

Then reload your web site and it is best to see the same web page:

website show php version

Now we have now put in Linux (put in by AWS routinely for you), Apache as the net server (put in routinely whenever you put in PHP), PHP 7.4 because the backend net utility language, and MariaDB (an open supply model of MySQL) because the database. We’ll log into MySQL (or MariaDB, the names are interchangeable) subsequent:

mysql -uroot

This means logging in as the foundation person with no password. The primary time MySQL is put in, it gained’t have a password for the root person.

We are going to set one, then create a person to make use of for our WordPress database, and at last create the database itself and provides all the mandatory privileges to the person.

Run the next (notice don’t use “PASSWORD” as your password however substitute it with a safe password):

GRANT ALL PRIVILEGES ON wp.* TO 'wp'@'localhost';

Lastly, exit with “exit” or Management+D. Then restart the MySQL server in order that the foundation person now requires the password you set:

systemctl restart mysql.service

Then attempt to log into MySQL as root together with your new password:

mysql -uroot -pNEW-PASSWORD

Now that MySQL is able to go, the very last thing to do is to obtain WordPress, level Apache to it, and run the WordPress set up wizard.

As soon as that’s performed, we’ll have a completely working WordPress web site that can be utilized for growth, staging, or manufacturing functions (in the event you allow SSL with Certbot/Let’s Encrypt.

Set up WordPress

Begin by going again to our Apache HTML listing and eradicating our PHP take a look at script. Then obtain the WordPress tar file.

cd /var/www/html
rm -f index.php
wget https://wordpress.org/newest.tar.gz

As soon as the obtain is completed, untar the file, transfer the information from the wordpress listing to the present one, take away the wordpress listing and take away the tar file.

Lastly, make www-data, the person Apache runs underneath, the proprietor of all of the information so it has the flexibility to create uploads and different information. This fashion, we don’t want to alter any of the Apache webserver configurations.

tar xzvf newest.tar.gz
mv wordpress/* .
rmdir wordpress
rm -f newest.tar.gz
chown -R www-data:www-data *

If all went in keeping with plan, you’ll be greeted by the WordPress set up wizard whenever you reload your web site subsequent:

WordPress installation wizard

Subsequent fill within the information for the MySQL username / password you created above into the containers and depart the remainder alone. Our database is already referred to as “wordpress.”

Setup WordPress database

On the following display screen, you may be prompted to repeat some PHP code into your wp-config.php file if WordPress can not create the file itself. Copy the code onto your clipboard.

WP config file error

Then run:

nano wp-config.php

in your Terminal to create the WordPress configuration file. Then hit Management+O then Enter to avoid wasting. Then Management+X to exit. Click on the “Run Installation” button to put in WordPress.

As soon as the set up is completed, give your web site a reputation and create an admin person. Then click on “Install WordPress.” As soon as that’s performed, your web site is prepared!

WP config file error
WordPress installed successfully

You’ll have the ability to view your web site or log in on the /wp-admin URL. Congratulations, your new WordPress web site is prepared!

How To Delete An AWS Server

If it is a take a look at web site, otherwise you made a mistake, choose your server within the “Instances” EC2 tab, click on the “Instance State” drop-down and choose “Terminate.” Then verify.

This can terminate your server. There isn’t any undo, so be sure you again up something you want earlier than terminating.

Terminal instance
Terminal Instance button

To create a backup, choose the server, click on “Actions” -> “Image and Templates” -> “Create image“, then give the image a name and description on the next screen and click “Create image.”

Create a server backup
Create image backup

When you’ve created a picture (AMI), you’ll be able to restore it from the “AMIs” tab. Choose the picture, click on “Actions” -> “Launch” and also you’ll be introduced with the launch settings wizard.

You possibly can choose any kind of machine so it is a good technique to downgrade or improve your machine simply with out dropping something.

Restore AMI machine

Get pleasure from your new WordPress websites!


On this article, you discovered methods to set up WordPress on Amazon servers.

The Amazon servers are nice for any WordPress web site as a result of they’re quick, dependable, and scalable.

Depart us a remark and tell us you probably have any questions relating to the method.

Additionally, make sure that to subscribe to our YouTube channel and like our web page on Fb.

Leave a Reply

Your email address will not be published. Required fields are marked *