Install Software Three Ways#
To complete this lab you’ll install software that implements three different servers.
Install Apache using apt
#
Using apt
on the command line to install software is easy!
$ sudo apt install apache2
Update main.tf
to enable TCP port 80 through the firewall:
ports = ["22", "80"]
Verify that you have Apache running by visiting:
http://my-ip-address/
Take a screenshot
Create a Node.js App#
These lab instructions are derived from the official Node.js getting started page. In order to run a Node.js application you have to install the nodejs
package.
$ sudo apt install nodejs
Nodejs doesn’t do anything by itself. You have to create a server program for it to run. There’s an example server in the public repository. On your VM check out the repo using git:
$ git clone https://github.com/mike-matera/cis-91.git
Change to the example directory and run the server:
$ cd cis-91/hello-nodejs
$ node app.js
Update main.tf
to enable TCP port 3000 through the firewall:
ports = ["22", "80", "3000"]
Don’t forget to apply!
Verify that you have your Node.js app running by visiting:
http://my-ip-address:3000/
Take a screenshot
Create a Python app with Flask#
Flask is a framework for making server side programs with Python. These instructions are derived from the Flask Quickstart. Python is installed by default on Ubuntu but the flask
library is not. Start by installing flask using the pip
python package manager.
First install pip
:
$ sudo apt install python3-pip
Now use pip
to install flask
:
$ pip3 install flask
$ source ~/.bashrc
Important: Access the flask command.
Installing flask
with pip
requires that you modify the $PATH
variable. You must log out and back in to update the PATH. You only have to do this once.
There’s an example flask application in the class repository. You can use the copy you cloned in the previous step.
$ cd cis-91/hello-python
$ flask run -h 0.0.0.0 -p 5000
Update main.tf
to enable TCP port 3000 through the firewall:
ports = ["22", "80", "3000", "5000"]
Don’t forget to apply!
Verify that you have your Flask app running by visiting:
http://my-ip-address:5000/
Take a screenshot
Turn In#
Turn in the three screenshots of your servers on Canvas.
Danger
Don’t forget to terraform destroy
your resources so you don’t get charged!