Pages

Thursday 9 July 2020

Installing wordpress on AWS EC2 Instance


Steps to Install apache server
On EC2 instance, Change the user to root using:
sudo su
To install the Apache Web Server, type: 
yum install httpd
Start the Apache Web Server: 
service httpd start
Steps to Install PHP7
Execute the following statement to install PHP.

1.      sudo yum update
2.      rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
3.      rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
4.      sudo yum install php70w
5.      sudo yum install php70w-mysql
sudo service httpd start

Steps to Install MySQL
Execute the following statement to install PHP.
  1. sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
  2. sudo yum localinstall mysql57-community-release-el7-11.noarch.rpm 
  3. sudo yum install mysql-community-server
  4. sudo systemctl start mysqld.service
  5. sudo grep 'temporary password' /var/log/mysqld.log (Copy the generated password for the future use)
  6. mysql_secure_installation
Answer the wizard questions as follows:
 • Enter current password for root: Press return for none
 • Change Root Password: Y
 • New Password: Enter your new password
 • Remove anonymous user: Y
 • Disallow root login remotely: Y
 • Remove test database and access to it: Y
 • Reload privilege tables now: Y
Login to MySQL using following command:
mysql -u root -p
Execute following query in the SQL terminal:
Create Database website;
Steps to Install WordPress
To install WordPress, type:
cd /var/www/html
sudo wget 
http://wordpress.org/latest.tar.gz
sudo tar -xzvf latest.tar.gz
This will uncompress WordPress in its own “wordpress” directory. I like having WordPress in a separate directory, but would rather rename it to “website”. Use following command to rename the directory.

sudo mv wordpress website

Create the WordPress wp-config.php file:

cd website
mv wp-config-sample.php wp-config.php
vi wp-config.php
  • Type i to start insert mode.
  • Modify the database connection parameters as follows:
define(‘DB_NAME’, ‘website);
define(‘DB_USER’, ‘root’);
define(‘DB_PASSWORD’, ‘YOUR_PASSWORD’);
define(‘DB_HOST’, ‘localhost’);
  • Type:wq to write the file and quit vi
Open the WordPress configuration using <youip>/website/wp-admin.