Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

Assignment3-Create A Website in AWS Without Using Amazon AMI

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Assignment3-Create A Website in AWS Without Using Amazon AMI

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

ITM711 Assignment-3: Create a Website in AWS without using Amazon

AMI
Demo Video: https://youtu.be/tFZH964__hs
(Individual Assignment)
By Nurul Huda
ALL SCREENSHOTS MUST BE FULL SCREEN FROM TOP LEFT CORNER TO THE BOTTOM RIGHT
CORNER OF YOUR SCREEN EVEN THOUGH THE SAMPLE SCREENSHOTS IN THIS DOCUMENT ARE
NOT SHOWING FULLSCREEN. DO NOT CROP ANY PART OF THE SCREEN.

Create an EC2 Linux instance

(Note: Though the demo video used an educate (student) account, you do not need to use an educate
account. You can use your AWS free tier account. Remember to remove all the AWS resources that you
used for doing any lab/assignment so that it does not cross the free tier usage limit.

1. Login to your account. In Amazon Management console, create an Ubuntu 20.04 Instance by using
your account. Make sure that Auto-Assign Public IP is enabled and at least 20GB disk space is
allocated.
2. For the Security Group, name it as ubuntuwebserverxxxx (where xxxx is the last 4 digits of your
student ID). Make sure you use SSH and can connect from anywhere. Before “Launch”, take a
screenshot showing your security group name.
<<Screenshot>>

3. At the launching the instance, create a new key pair and name it as ubuntuwebserverxxxx (where
xxxx is the last 4 digits of your student ID). Take a screenshot showing that the key pair was saved
and download the key pair file to your local computer.
<<Screenshot>>

Note to Mac user: Mac user's don't need to use PuTTY. The video
https://youtu.be/4SsXX8jq_dw (4 minutes to 8 minutes) shows how to connect to an EC2
instance from Mac Machine. Mac users can watch that 4 minutes part of the video as an
alternative to steps 3 to 6 below.
After connecting to the instance, the commands will be the same for Windows or mac users
as the commands are executed in the EC2 instance (not on Mac or Windows). So, everyone
can follow the same commands as shown in the initial demo video
(https://youtu.be/tFZH964__hs ) from 9 minutes time.

4. Launch the instance. While the instance is being created, use PuTTYgen to convert the .pem key pair
file to .ppk file. Name the .ppk key pair file as ubuntuwebserverxxxx.ppk (where xxxx is the last 4
digits of your student ID).

Copyright © 2018 Nurul Huda


5. Once the EC2 instance is ready, open connect dialogbox and take a screenshot showing the
connection properties of the EC2. Take a screenshot showing the connection property including the
public DNS name.

<<Screenshot>>

6. Use PuTTY to connect to the instance (use related part of the video help if needed). You should be at
the Ubuntu prompt.

Take a screenshot showing you are connected

<<Screenshot>>

7. At the prompt, use the following 2 commands to install Apache

sudo apt update

sudo apt install apache2

Copyright © 2018 Nurul Huda


Take a screenshot showing the command was successful. (If a screenshot doesn’t fit all output of all
commands that is fine.)

<<Screenshot>>

8. At the prompt, use the following 3 commands to always start up with the server boots.

sudo systemctl stop apache2.service

sudo systemctl start apache2.service

sudo systemctl enable apache2.service

Take a screenshot showing the command was successful.

<<Screenshot>>

Install MariaDB Database Server

9. At the prompt, use the following 4 commands to install MariaDB database and always start up with
the server boots.

sudo apt-get install mariadb-server mariadb-client

sudo systemctl stop mariadb.service

sudo systemctl start mariadb.service

sudo systemctl enable mariadb.service

Take a screenshot showing the command was successful.

<<Screenshot>>

10. At the prompt, use the following command and responses to create a root password and disallow
remote root access.

sudo mysql_secure_installation

When prompted, answer the questions below by following the guide.

 Enter current password for root (enter for none): Just press the Enter
 Set root password? [Y/N]: Y

Copyright © 2018 Nurul Huda


 New password: Enter password
 Re-enter new password: Repeat password
 Remove anonymous users? [Y/n]: Y
 Disallow root login remotely? [Y/n]: Y
 Remove test database and access to it? [Y/n]: Y
 Reload privilege tables now? [Y/n]: Y

Take a screenshot showing that the root password was created.

<<Screenshot>>

11. At the prompt, use the following command to restart MariaDB server

sudo systemctl restart mariadb.service

Take a screenshot showing the command was successful.

<<Screenshot>>

Install PHP 7.1 and Related Modules

12. At the prompt, use the following 4 commands to Install PHP 7.1 and Related Modules

sudo apt-get install software-properties-common

sudo add-apt-repository ppa:ondrej/php

sudo apt update

sudo apt install php7.1 libapache2-mod-php7.1 php7.1-common php7.1-mbstring


php7.1-xmlrpc php7.1-gd php7.1-xml php7.1-mysql php7.1-cli php7.1-mcrypt
php7.1-zip php7.1-curl

Take a screenshot showing the command was successful.

<<Screenshot>>

13. At the prompt, use the following command to keep a copy of php.ini file

Copyright © 2018 Nurul Huda


sudo cp /etc/php/7.1/apache2/php.ini /etc/php/7.1/apache2/phpini.bak

Take a screenshot showing that the command was successful.

<<Screenshot>>

14. At the prompt, use the following command to open php.ini file for editing

sudo nano /etc/php/7.1/apache2/php.ini

15. Find the following lines and set their values as shown

memory_limit = 256M

upload_max_filesize = 100M

max_execution_time = 360

16. Exit the nano editor by pressing Ctrl+x and at the prompt press Y to save and press enter again to
save in the file.

Create WordPress Database

17. At the prompt, use the following commands to create a WordPress database, user and password.
Take a screenshot after the 4th command showing the command was successful.

sudo mysql -u root –p

CREATE DATABASE wpdb;

CREATE USER 'wpdbuser'@'localhost' IDENTIFIED BY 'ITM711';

GRANT ALL ON wpdb.* TO 'wpdbuser'@'localhost' IDENTIFIED BY 'ITM711' WITH GRANT


OPTION;

FLUSH PRIVILEGES;

EXIT;

Copyright © 2018 Nurul Huda


<<Screenshot>>

Download WordPress Latest Release

18. At the prompt, use the following commands to download WordPress Latest Release, uncompressed
and set permissions

cd /tmp && wget https://wordpress.org/latest.tar.gz

tar -zxvf latest.tar.gz

sudo mv wordpress /var/www/html/wordpress

sudo chown -R www-data:www-data /var/www/html/wordpress/

sudo chmod -R 755 /var/www/html/wordpress/

Take a screenshot showing the command was successful.

<<Screenshot>>

Configure Apache2 HTTP Server

19. At the prompt, use the following commands to create a new configuration file called wordpress.conf

sudo nano /etc/apache2/sites-available/wordpress.conf

copy the following text in the file and replace yourpublicdnsname with your instance’s
publicdnsname.

<VirtualHost *:80>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/wordpress/
ServerName yourpublicdnsname
ServerAlias www.yourpublicdnsname

<Directory /var/www/html/wordpress/>
Options +FollowSymlinks
AllowOverride All
Require all granted
</Directory>

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

</VirtualHost>

Copyright © 2018 Nurul Huda


Take a screenshot showing your wordpress.conf file in the editor showing you put your instance’s
publicdnsname in the file.

<<Screenshot>>

20. Exit the nano editor by pressing Ctrl+x and at the prompt press Y to save and press enter again to
save in the file.
21. At the prompt, use the following commands to enable the WordPress and Rewrite Module and
Restart Apache2

sudo a2ensite wordpress.conf

sudo a2enmod rewrite

sudo systemctl restart apache2.service

Take a screenshot showing the command was successful.

<<Screenshot>>

22. At the prompt, use the following commands to run the commands below to create WordPress wp-
config.php file.

sudo mv /var/www/html/wordpress/wp-config-sample.php /var/www/html/wordpress/wp-


config.php

23. At the prompt, use the following commands to open WordPress configuration file.

sudo nano /var/www/html/wordpress/wp-config.php

Change the highlighted text as shown below.

// ** MySQL settings - You can get this info from your web host ** //

/** The name of the database for WordPress */

define('DB_NAME', 'wpdb');

/** MySQL database username */

define('DB_USER', 'wpdbuser');

/** MySQL database password */

Copyright © 2018 Nurul Huda


define('DB_PASSWORD', 'ITM711');

/** MySQL hostname */

define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */

define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */

define('DB_COLLATE', '');

24. Exit the nano editor by pressing Ctrl+x and at the prompt press Y to save and press enter again to
save in the file.
25. In AWS, edit inbound rules of your security group (EC2>Security Groups>your security group).

26. Allow HTTP and HTTPS connection from anywhere and save it.

Take a screenshot showing that HTTP and HTTPS were allowed for inbound connection from
anywhere.

<<Screenshot>>

Copyright © 2018 Nurul Huda


27. Open web browser and try to visit your webpage by using public DNS name of your EC2 instance. It
should start WordPress setup wizard.
Take a screenshot showing that the WordPress setup wizard started.

<<Screenshot>>

28. In the next screen, setup site title, username, password and email address. You will use this
username/password to make any changes in the webpages.

Copyright © 2018 Nurul Huda


29. Browse your website in a new tab by using your public DNS name and it should show your website
webpage. Take a screenshot showing the webpage.

<<Screenshot>>

30. Login to WordPress by using the account that you setup in WordPress installation wizard 30 and
modify the HelloWorld post and include your full name at the heading of the page. Browse your
website and it should show the webpage with your full name. Take a screenshot showing the
webpage.

<<Screenshot>>

31. Create a new post that includes your full name, student ID and any other bio information of your
choice. Browse your website and it should show the new post. Take a screenshot showing the new
post.

<<Screenshot>>

32. Shut down (stop) the EC2 instance. Take a screenshot showing the EC2 has been stopped.

<<Screenshot>>

Terminate the EC2 instance.

Copyright © 2018 Nurul Huda


33. Close AWS management console and log out of your AWS account.
34. Remove the screenshots that were originally in this document for instruction purpose and keep your
screenshots only. Submit this document with all your screenshots.

Reminder: Please make sure you removed all the AWS resources that you used for completing any
lab/assignment so that it does not cross the free tier usage limit. Check the EC2 Dashboard
(Resources) and Billing menu (under your account) to find out resources in use.

Credit for Ubuntu commands: https://websiteforstudents.com/install-wordpress-on-ubuntu-18-04-lts-beta-with-apache2-mariadb-and-php-7-1/

Copyright © 2018 Nurul Huda

You might also like