Installing WordPress on AWS EC2 Ubuntu

Here are the basics of what we are about to do:
Pre-requisites

With a new ec2 ubuntu instance (I used a t3a.medium) which seem to support WordPress sites fairly well with a moderate amount of traffic – and I used a pre-allocated and associated “elastic IP” to the EC2 instance. Elastic IP are just Amazon’s way of saying a fixed IP for EC2.

  • Update ubuntu
  • Install apache
  • Install mysql
  • Install php
  • Create a mysql database, create a mysql user and grant mysql permissions to user
apt update -y
apt upgrade -y
reboot
apt install apache2 -y
systemctl status apache2
systemctl status
systemctl enable apache2
apt install mariadb-server mariadb-client
systemctl status mariadb
systemctl enable mariadb
mysql_secure_installation
systemctl restart mariadb

Install Apache2

apt install apache2 -y
systemctl status apache2
systemctl start apache2
systemctl enable apache2

Ok, from within mysql, create db, user, and grant permissions

mysql -u root -p
create database wordpress;
create user "yourWordPressUserName" identified by "yourPW";
grant all privileges on wordpress.* to "yourWordPressUserName";

Back to bash to install php and wordpress

apt install php php-mysql php-gd php-cli php-common
apt install wget unzip
wget https://wordpress.org/latest.zip
ls
unzip latest.zip
ls
cp -r wordpress/* /var/www/html/
cp -p wp-config-sample.php wp-config.php

Change the ownership of the stuff you just unzipped and moved

cat /etc/passwd
cat /etc/passwd | grep -i www
cd /var/www/html
chown www-data:www-data -R /var/www/html/
cd html
ls -al
rm index.html
systemctl restart mariadb

Now you can start your GUI based wordpress install

http://yourDomainOrIPAddress/

Scroll to Top