Here is how you manually install WordPress on a Ubuntu AWS instance. And pointing your WordPress database to a MYSQL RDS.
Sign into your AWS account –> RDS –> “Create Database”
– Choose “Standard Create”
– Engine Option: “MYSQL”
– Version: <The latest version 5>
– (For now, choose the “Free Tier” template)
– Give the database an identifier (doesn’t necessarily have to be your DB name)
– Provide an Master username/password
– Allocate a certain storage size
– Expand “Additional connectivity configuration”
– Make the database publicly available (yes)
– Create a new Security Group named “MYSQL” and assign it the port 3306
– Expand “Additional configuration”
– For “Initial database name”: “wordpress”
Sign into your AWS account –> EC2 –> “Launch Instance”
For now we’ll just use a t2.micro free instance
When it prompts you to choose an AMI, search for “Ubuntu” in the “Community AMIs” tab. Select the AMI “ubuntu/images/hvm-ssd/ubuntu-xenial-16.04”
Use the default selections, but when you get to “Storage” increase it to “25gb” (just to use the max free tier size options)
Create a “Name” tag, then give it a value
Create a Security Group named “WordPress” and add “HTTP” open anywhere. Add “HTTPS” open anywhere. Then add your home IP address to the security group.
If you already have a security group then choose that existing security group.
Either create a new key/pair, or choose an existing one that you can log into the instance with.
Wait for the instance to stand up.
Go to your security groups, select the “MYSQL” security group –> “Incoming” –> Edit the 3306 port source to the internal IP of the instance you just created.
SSH into it: ssh -i <PATH TO YOUR KEYPAIR PEM> ubuntu@<PUBLIC IP ADDRESS>
Run these commands:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install mysql-server mysql-client
sudo apt-get install apache2 apache2-doc apache2-utils libexpat1 ssl-cert
sudo apt-get install php7.3 php7.3-mysql php7.3-mbstring php7.3-soap
sudo apt-get install phpmyadmin
Download the latest WordPress tarball:
cd /var/www/html
sudo wget http://wordpress.org/latest.tar.gz
sudo tar -zxvf latest.tar.gz
sudo mv wordpress/* .
sudo rm -f index.html
Configure the wp-config.php file:
sudo cp wp-config-sample.php wp-config.php
Update the database info with your RDS info in the “wp-config.php” file
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', '<RDS DB Name>' );
/** MySQL database username */
define( 'DB_USER', '<Master Username>' );
/** MySQL database password */
define( 'DB_PASSWORD', '<Master Password>' );
/** MySQL hostname */
define( 'DB_HOST', '<RDS Endpoint>:3306' );
Save the file
Give your wordpress files the proper permissions for Apache to access them
sudo chown www-data:www-data -R /var/www/html
Update the php.ini file for the following settings:
sudo vi /etc/php/7.3/apache2/php.ini
memory_limit = 512M
post_max_size = 128M
upload_max_filesize = 256M
Uncomment the soap extension line in php.ini:
extension=soap
Enable “mod rewrite”: sudo a2enmod rewrite
Edit /etc/apache2/apache2.conf – to enable “AllowOverride”
<Directory />
Options FollowSymLinks
#AllowOverride None
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
#AllowOverride None
AllowOverride All
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
#AllowOverride None
AllowOverride All
Require all granted
</Directory>
Restart Apache2: sudo service apache2 restart
Now try to access your WordPress in the browser: http://<EC2 Instance Public IP>/wp-admin
This should take you to a WordPress page where you need to create the administrator account. Set up your credentials then log into your account.