SYS 360 Lab 5 1: LAMP Stack in AWS Part 1 - JadenGil/Jaden-Tech-Journal GitHub Wiki
Preparing LAMP server:
To start things off we will make a security group and key pair using the same steps in previous labs
Then we will create a new instance that must be running Amazon Linux 2 as an AMI:
Make sure to use the security group and keypair that we just made!
Once the instance is launched we want to SSH into the machine via CMD:
We want to make sure that everything is up to date so run a quick sudo yum update -y
Then we want to Install the lamp-mariadb10.2-php7.2 and php7.2 Amazon Linux Extras repositories which we can do with the command sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2
Then we want to install the Apache web server, MariaDB, and PHP software packages with the command sudo yum install -y httpd mariadb-server
We can check the versions of these software using yum info software name
Then we want to start and enable httpd:
With httpd now enabled and started we can go to the public IP of our LAMP instance and the apache test page should load:
Allowing ec2-user Permissions:
Using the command in this screenshot we can elevate ec2-user to a root user:
Then we will exit the SSH session and immediately SSH back in. With that done, you should see that ec2-user is now in the admin group:
Now that the user is admin we will want to change ownership of /var/www
:
With those commands executed ec2-user and any future members of the Apache group we made can add, delete, and edit files in the Apache document root
Deliverable 1:
Testing the LAMP Server:
In CMD run the command echo "<?php phpinfo(); ?>" > /var/www/html/phpinfo.php
Now if we add /phpinfo.php
to our URL we will be shown the PHP information page
Deliverable 2:
Now we can delete the phpinfo file from the directory: