In this exercise, we are going to create a Linux instance (VM) on Compute Engine, connect to it via SSH, install Apache, and connect the demo website via its external IP address.
-
In the GCP web console, navigate to the screen where you can create an instance.
-
Bring up the menu to configure and create a new instance.
-
Name the instance
test-apache-1
. -
Set the zone to your closest geographical location.
-
Set machine type to
f1-micro
. -
Set Boot Disk to
Ubuntu 16.04 LTS
. -
Allow HTTP traffic, then create the instance.
-
After instance is created, SSH into instance via the web console.
-
Update repositories, and install Apache.
-
Connect to your instance via external IP address in web browser.
-
Shut down the instance via terminal command.
-
Delete your instance.
-
In the GCP web console, navigate to the screen where you can create an instance.
From the top left menu, navigate under Compute to Compute Engine.
- Bring up the menu to configure and create a new instance.
If you have no other instances created, simply click the blue Create button.
- Name the instance
test-apache-1
.
Type instance name in the 'Name' field. Notice the naming restrictions.
- Set the zone to your closest geographical location.
From the 'Zone' dropdown menu, choose a zone from the nearest region to your location.
- Set machine type to
f1-micro
.
From the 'Machine type' dropdown menu, choose the first option '
f1-micro
'.
- Set Boot Disk to
Ubuntu 16.04 LTS
.
Under 'Boot disk', click 'Change'. Choose '
Ubuntu 16.04 LTS
' from the list of OS Images, then click the blue 'Select' button at the bottom.
- Allow HTTP traffic, then create the instance.
Under 'Firewall', select the checkboxes for 'Allow HTTP traffic'. Then click the blue 'Create' button at the bottom.
- After instance is created, SSH into instance via the web console.
Back in the instance list screen, click on 'SSH' underneath the 'Connect' field on the right side.
- Update repositories, and install Apache.
From the terminal window:
sudo apt-get update
Then:
sudo apt-get install apache2
Type 'Y' to continue installation. Keep terminal window open and go back to instance list on web console.
- Connect to your instance via external IP address in web browser.
From the instances list, either click the IP address under 'External IP', or type the IP address in a new browser tab. The default Apache page should appear.
Close the Apache tab.
- Shut down the instance via terminal command.
Back in the terminal window, enter
sudo shutdown
- Delete your instance.
From the instances list page, click the checkbox by our instance, and click the DELETE button.