Step-by-Step Tutorial: How to Setup Your Own e-Commerce Online Store using WooCommerce 3.4.5, Wordpress 4.9.8, and CentOS 1805 (LAMP) in Amazon AWS Cloud


Step-by-Step Tutorial: How to Setup Your Own e-Commerce Online Store using WooCommerce 3.4.5, Wordpress 4.9.8, and CentOS 1805 (LAMP) in Amazon AWS Cloud

Author: Mr. Turritopsis Dohrnii Teo En Ming
Country: Singapore
Date: 28th September 2018 Friday

Document Version: 1809.01

Abbreviations
=============

LAMP: Linux + Apache Web Server + MySQL/MariaDB + PHP

WAMP: Windows + Apache Web Server + MySQL/MariaDB + PHP

SECTION 1 CREATING YOUR CENTOS 7.5 (1805) LINUX INSTANCE
========================================================

001. Login to Amazon Web Services.

002. Click Services > Compute > EC2.

003. Click Network & Security > Key Pairs

004. Click Create Key Pair.

005. Enter your key pair name. Then click Create.

006. Be sure to download your private key in the form of a .PEM file. You will need to convert it to a .PPK file later.

007. Click Instances > Instances.

008. Click Launch Instance.

009. Click AWS Marketplace.

010. Search for CentOS.

011. Select CentOS 7 (x86_64) - with Updates HVM Amazon Machine Image (AMI).

012. Click Continue.

013. Select General Purpose, t2.micro, 1 vCPU, 1 GB RAM (FREE TIER ELIGIBLE).

014. Click Next: Configure Instance Details.

015. Select Network: <Your VPC network>

016. Select Subnet: <Your subnet>

017. Click Protect against accidental termination.

018. Click Next: Add Storage.

019. Click Next: Add Tags. Click Add tag.

020. Enter Key = Name and Value = Online Store.

021. Click Next: Configure Security Group

022. Click Select an existing security group.

023. Select VS_SG (Virtual Server Security Group).

024. Click Review and Launch. Click Launch.

025. Select a key pair. Click Launch Instances.

026. Click View Instances.

027. Click Network & Security > Elastic IPs.

028. Select an unused IPv4 address.

029. Click Actions > Associate address.

030. Select the Online Store instance.

031. Click Allow Elastic IP to be reassociated if already attached.

032. Click Associate. Click Close.

033. Login to CentOS 7.5 Linux using Putty.

SECTION 2 INSTALLING WORDPRESS 4.9.8
====================================

034. sudo yum install php php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml

Guide: How To Install MySQL / MariaDB on CentOS 7


035. sudo yum -y install mariadb-server mariadb

036. sudo yum install wget

Guide: Installing WordPress: Detailed Instructions



038. tar xfvz latest.tar.gz

039. sudo passwd root

040. su -

041. systemctl start mariadb

042. systemctl enable mariadb

043. mysql

044. MariaDB [(none)]> CREATE DATABASE wordpress;

045. MariaDB [(none)]> GRANT ALL PRIVILEGES ON wordpress.* TO "wordpress"@"localhost" IDENTIFIED BY "password";

046. MariaDB [(none)]> FLUSH PRIVILEGES;

047. MariaDB [(none)]> EXIT

048. cd /home/centos/wordpress

AFAIK Wordpress 4.9.8 cannot be installed in a subdirectory. If you encounter a HTTP error code 500 doing so, be sure to check the Apache Web Server error logs, that is, tail -f /var/log/httpd/error_log.

049. cp -R * /var/www/html

050. systemctl start httpd

051. systemctl enable httpd

052. sudo yum install nano

053. nano /etc/httpd/conf/httpd.conf

054. Append the following line

AddType application/x-httpd-php .php

055. systemctl restart httpd

Wordpress 4.9.8's PHP code won't execute on php-5.4.16, which is installed by default on CentOS 7.5. It will return a HTTP error code of 500. Install PHP-7.2.10 instead.

Guide: How to Install PHP 7 in CentOS 7




058. yum install yum-utils

You will need minimum PHP 7.2.

059. yum-config-manager --enable remi-php72

060. yum install php php-mcrypt php-cli php-gd php-curl php-mysql php-ldap php-zip php-fileinfo

061. php -v

PHP 7.2.10 is now installed.

062. systemctl stop httpd && systemctl start httpd

063. Go to http://<IP_address_of_eCommerce_Online_Store>

064. Click Let's go!

065. Fill in the following MySQL/MariaDB database connection information.

Database Name: wordpress

Username: wordpress

Password: password

Database Host: localhost

Table Prefix: wp_

066. Click Submit.

067. cd /var/www/html

068. nano wp-config.php

069. Copy and paste the contents of wp-config.php shown on the Wordpress installation screen on your browser.

070. Click Run the installation.

071. Fill in the following information.

Site Title: Teo En Ming Corporation Online Store

Username: admin

Password: password

Your email: user@example.com

Uncheck Discourage search engines from indexing this site

072. Click Install wordpress.

073. Click Login.

SECTION 3 INSTALLING WOOCOMMERCE 3.4.5
======================================

Follow the WooCommerce installation guide here:


074. Login to your new wordpress site.

075. Click Plugins > Add new.

076. Search for WooCommerce.

077. Click Install Now on WooCommerce by Automattic.

Installing FTP Server in CentOS 7.5.

Guide: How to Install and Configure vsftpd on CentOS 7


078. sudo yum -y install vsftpd

079. sudo nano /etc/vsftpd/vsftpd.conf

anonymous_enable=NO
local_enable=YES
write_enable=YES
chroot_local_user=YES

080. sudo systemctl restart vsftpd

081. sudo systemctl enable vsftpd

082. sudo passwd centos

Change National Security Agency (NSA)’s SELinux mode.

083. sudo nano /etc/selinux/config

SELINUX=permissive

084. reboot

085. su -

086. echo 'allow_writeable_chroot=YES' >> /etc/vsftpd/vsftpd.conf

087. systemctl restart vsftpd

088. Go back to WooCommerce installation page on your browser.

089. Fill in the Connection Information.

Hostname: <IP address of e-Commerce Online Store>

FTP Username: ftpuser

FTP Password: password

Connection type: FTP

090. Click Proceed.

Installation failed: Unable to locate WordPress content directory (wp-content).


091. cd /var/www/html








092. nano wp-config.php

Append the following lines

if(is_admin()) {
   add_filter('filesystem_method', create_function('$a', 'return "direct";' ));
   define( 'FS_CHMOD_DIR', 0751 );
}

093. Go back to WooCommerce installation page.

094. Fill in the Connection Information.

Hostname: <IP address of e-Commerce Online Store>

FTP Username: ftpuser

FTP Password: password

Connection type: FTP

095. Click Proceed.

WooCommerce will be installed.

096. Click Activate.

097. Click Run the Setup Wizard.

098. WooCommerce Store setup page:

Where is your store based? Singapore

Address: Singapore

City: Singapore

Postcode/ZIP: 123456

What currency do you accept payments in? Singapore dollar ($ / SGD)
What type of products do you plan to sell? I plan to sell both physical and digital products

Check I will also be selling products or services in person.

Check Help WooCommerce improve with usage tracking.

099. Click Let's go!

100. WooCommerce Payment page:

Stripe: Enabled

Click Create a new Stripe account for me

Paypal: Enabled

Click Accept payments without linking a PayPal account

Expand Offline Payments.

Check Payments: Enabled

Bank transfer (BACS) payments: Enabled

Cash on delivery: Enabled

101. Click Continue.

102. WooCommerce Shipping page:

Shipping Zone

Singapore: Flat Rate

Cost: $5

Locations not covered by your other zones: Flat Rate

Cost: $5

Weight unit: kg

Dimension unit: cm

103. Click Continue.

104. Recommended for All WooCommerce Stores page:

Storefront Theme: Enabled

MailChimp: Enabled

105. Click Continue.

106. Click Continue with Jetpack.

107. Create an account to set up Jetpack

Your email address: user@example.com

Choose a username: jetpackuser

Choose a password: password

108. WooCommerce Ready! page:

109. Click Create a Product

SECTION 4 INSTALLING MOD_SSL TO SERVE SECURE WEB PAGES
=========================================================

110. sudo yum -y install mod_ssl

110. sudo systemctl restart httpd

SSL is now available.


112. On the Dashboard, click Let's go!

113. Click Publish.

114. Setup is complete.

SECTION 5 CREATING DNS HOST RECORD
===================================

SECTION 5.1 CPANEL
==================

115. Login to your cpanel.

116. Click DNS Functions > Edit DNS Zone.

117. Choose a zone to edit. Click Edit.

118. On the Add New Entries Below this Line section, fill in the following information:


Select A record

IPv4 address: <IP address of e-Commerce Online Store>

119. Click Save.

120. Repeat Steps 116 to 119 for other DNS Zones.

121. Click DNS Functions > Synchronize DNS Records

122. Select Synchronize all zones to all servers

123. Click Synchronize.

Error: DNS Records failed to synchronize! I will need to investigate further why the cPanel virtual server failed to synchronize DNS records with the 2 name servers.

SECTION 5.2 WINDOWS SERVER 2019 ACTIVE DIRECTORY DNS SERVER
===========================================================

115. Login to your Windows Server 2019 Domain Controller.

116. Under Server Manager, click Tools > DNS.

117. Click Forward Lookup Zones > EXAMPLE.COM

118. Right click, select New Host (A or AAAA)...

Name (uses parent domain name if blank):

store

Fully qualified domain name (FQDN):


IP address: <IP address of e-Commerce Online Store>

119. Click Add Host. Click Done.

120. Right Click, select Reload. Click Yes.

SECTION 6 WORDPRESS Address Settings
====================================

6.1 Go to https://store.example.com/wp-admin and login.

6.2 Click Settings > General Settings.

WordPress Address (URL): https://store.example.com

Site Address (URL): https://store.example.com

6.3 Click Save Changes




SECTION 7 Purchase and Install SSL Certificate
======================================

7.1 Please remember to purchase and install SSL certificate in your Apache web server! There are free 90-day SSL certificates available.

All done!

I have just completed setting up my Teo En Ming Corporation Online Store. Have you done yours?

If all of these sound too technical and complicated for you, I may be able to help you in setting up your very own e-Commerce Online Store!


Comments

Popular posts from this blog

[24 Mar 2022 Thursday] Erectile Dysfunction and Viagra

Patching Linux Kernel 5.5.7 to Add Support for AUFS Filesystem