We’re here to help and answer any question you might have. We look forward to hearing from you.

Setting up a Linux account is a fundamental step for users who want to harness the power of Linux-based operating systems. By creating a Linux account, you gain access to a world of open-source software, robust security features, and the ability to customize your computing environment
lucee
wordpress logo
aws

WORDPRESS SETUP ON AWS - LINUX

DAStek logo

What will you do

  1. Installing Apache , PHP , Mysql Server for WordPress
  2. Installing latest WordPress on Linux Server
  3. Configure MySQL database for WordPress
  4. Configure WordPress Security Key
  5. Creating Apache Virtual Host for WordPress

Requirements

  1. AWS Account: You need an active AWS account.
  2. EC2 Instance: Launch an EC2 instance with AWS Linux.
  3. Security Group: Configure inbound traffic rules for ports 22, 80, and 443.
  4. Apache Web Server: Install and configure Apache on the EC2 instance.
  5. MySQL Database: Set up and configure MySQL for storing WordPress data.

Step 1: Launch an Amazon EC2 instance with the AWS Linux AMI.

Step 2: Connect to the instance using SSH.

Step 3: Update the instance and install necessary packages by running the following commands:

Command 1sudo yum update -y
Command 2sudo yum install -y httpd24 php74 mysql57-server php74-mysqlnd

Step 4: Start the Apache web server by running the following commands:

Command 1sudo service httpd start

Step 5: Enable the Apache web server to start automatically on system boot by running the following command:

Command 1sudo chkconfig httpd on

Step 6: Start the MySQL server by running the following command:

Command 1sudo service mysqld start

Step 7: Secure the MySQL installation by running the following command:

Command 1sudo mysql_secure_installation

Step 8: Install WordPress by downloading the latest version from the official website and extracting the files to the web root directory:

Command 1cd /var/www/html
Command 2sudo wget https://wordpress.org/latest.tar.gz
Command 3sudo tar -xzf latest.tar.gz
Command 4sudo mv wordpress/* .
Command 5sudo rmdir wordpress
Command 6sudo rm latest.tar.gz

Step 9: Create a MySQL database and user for WordPress:

Command 1sudo mysql -u root -p
Command 2
CREATE DATABASE wordpress; CREATE USER ‘wordpressuser’@’localhost’ IDENTIFIED BY ‘password’; GRANT ALL PRIVILEGES ON wordpress.* TO ‘wordpressuser’@’localhost’;
Command 3FLUSH PRIVILEGES;
Command EXIT;

Step 10: Configure WordPress by copying the sample configuration file and editing it with the MySQL database details:

Command 1cd /var/www/html
Command 2sudo cp wp-config-sample.php
Command 3wp-config.php sudo vi wp-config.php

Edit the following lines:

Command 1define(‘DB_NAME’, ‘wordpress’);
Command 2define(‘DB_USER’, ‘wordpressuser’);
Command 3define(‘DB_PASSWORD’, ‘password’);
Command 4define(‘DB_HOST’, ‘localhost’);

Step 11: Modify the .htaccess file to hide index.php from URLs:

Command 1cd /var/www/html
Command 2sudo vi .htaccess

Add the following code:

 # BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Step 12: Restart the Apache web server by running the following command:

Command 1sudo yum install vsftpd restart

Step 13: Set up FTP access to the server by installing vsftpd:

Command 1sudo service httpd restart

Step14: Enable FTP access by editing the configuration file:

Command 1sudo vi /etc/vsftpd/vsftpd.conf

Add the following lines at the end of the file:

 write_enable=YES
local_umask=022
chroot_local_user=YES
user_sub_token=$USER
local_root=/var/www/html/$USER
pasv_min_port=1024
pasv_max_port=1048
pasv_address=<YOUR_PUBLIC_IP_ADDRESS>

Step 15: Create an FTP user for each WordPress user by running the following command:

Command 1sudo useradd -d /var/www/html/ -s /sbin/nologin
Command 2sudo passwd

Step 16: Test FTP access by connecting to the server using an FTP client

Command 1sudo useradd -d /var/www/html/ -s /sbin/nologin
Command 2sudo passwd

To open PHPMyAdmin, follow these steps:

Step 1: Install PHPMyAdmin using the following command:

Command 1sudo yum install phpMyAdmin

Step2: Configure PHPMyAdmin by editing the Apache configuration file:

Command 1sudo vi /etc/httpd/conf.d/phpMyAdmin.conf

Comment out the existing lines and add the following lines:

 Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
<Directory /usr/share/phpMyAdmin/>
AddDefaultCharset UTF-8
<IfModule mod_authz_core.c>
# Apache 2.4
<RequireAny>
Require all granted
Require ip <YOUR_IP_ADDRESS>
Require ip ::1
</RequireAny>
</IfModule>
<IfModule !mod_authz_core.c>
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from <YOUR_IP_ADDRESS>
Allow from ::1
</IfModule>
</Directory>
Note: Replace `YOUR_IP_ADDRESS` with your public IP address.

Step 3: Restart the Apache web server by running the following command:

Command 1sudo service httpd restart

Step 4: Access PHPMyAdmin

By navigating to `http://<YOUR_PUBLIC_IP_ADDRESS>/phpMyAdmin`

Step 5: Log in using the MySQL database credentials you created earlier.

Command 1sudo yum install phpMyAdmin

Trust and Worth

Our Customers

We are having a diversified portfolio and serving customers in the domains namely Sports Management, Online Laundry System, Matrimonial, US Mortgage, EdTech and so on.

Would you like to start a project with us?

DAStek team would be happy to hear from you and would love to turn your ‘Imaginations to Reality’.