Create WordPress Website

– Launch an Amazon Linux 2 instance
– Ssh into the instance
– Make sure the instance is up to date ” sudo yum update -y”
– Install docker ” sudo yum install docker -y”
– Start docker ” sudo systemctl start docker ”
– Verify docker version ” docker –version”
– Give ec2-user permissions to run docker commands ” usermod -aG docker ec2-user”
– Add the following just to be sure ” chmod 666 /var/run/docker.sock”
– Install Docker compose:
sudo curl -L “https://github.com/docker/compose/releases/download/1.28.6/docker-compose-$(uname -s)-$(uname -m)” -o /usr/local/bin/docker-compose
– Add executable permissions “sudo chmod +x /usr/local/bin/docker-compose”
– Verify installation “$ docker-compose –version”
– Create a wordpress directory ” mkdir /home/ec2-user/wordpress/”
– Switch to the directory ” cd /home/ec2-user/wordpress/ ”
– Create a docker-compose file ” docker-compose.yaml ”
– Edit the yaml file using vi ” sudo vi ”
– Add the following:

version: ‘3.7’

volumes:
wp-data:
networks:
wp-back:

services:

db:
image: mysql:latest
volumes:
– wp-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: Imraandb
MYSQL_DATABASE: wordpress
MYSQL_USER: wp-user
MYSQL_PASSWORD: Imraandb
ports:
– 8889:3306
networks:
– wp-back

wordpress:
depends_on:
– db
image: wordpress:latest
ports:
– 80:80
– 443:443
environment:
WORDPRESS_DB_HOST: db
WORDPRESS_DB_USER: wp-user
WORDPRESS_DB_PASSWORD: Imraandb
volumes:
– ./:/var/www/html
container_name: wordpress-site
networks:
– wp-back

– Save and exit
– In the wordpress directory, run the following command ” docker-compose up -d ”
– Once done, copy and paste your public ip into a browser

No token or token has expired.