Skip to content

Lab 1.1: Introduction to Linux

Welcome to your first hands-on lab in the module!
This session is designed to give you a solid start with Linux fundamentals and basic Cloud VM interaction.


🎯 What You’ll Learn

Lab 1 Part 1 focuses on:

  • Part A: Connecting to your Virtual Machine (VM) in Google Cloud Platform
  • Part B: Running Linux commands via the Command Line Interface (CLI)

Note

Today’s lab session sets the foundation for your next 10 weeks of Cloud Computing work.
Please complete all the steps before the next class.


🧭 How to Approach This Lab

The labs are written as step-by-step tutorials β€” follow them carefully.

Before you begin

  • Watch the Week 0 videos on redeeming your coupon, creating a VM, and connecting with Visual Studio Code.
  • Use these labs as an interactive checklist β€” type every command yourself.

Learning by Doing

  • Avoid copy–paste. Type commands manually to understand what each one does.
  • Understanding the CLI (Command Line Interface) is one of the core skills of a computer scientist.
  • Don’t worry if you forget β€” you’ll practice the same commands repeatedly.

Optional but highly recommended

Create a GitHub Page or online logbook to note important commands and screenshots.
This will serve as your personal Linux cheat sheet.


πŸ’‘ Explore More

Want to explore more about the Linux CLI?

πŸ“˜ Download the Linux Pocket Guide (3rd Edition)

Warning

Avoid copying commands directly from PDFs β€” hidden characters (like smart quotes) can break terminal input.


🧩 Part A β€” Preparing Your Workspace

  1. Follow Week 0 instructions to redeem your coupon and create a new VM.
  2. Start your VM using the same configuration.

Info

You’ll use this VM throughout the lab series β€” treat it as your personal Cloud workstation.


βš™οΈ Part B β€” Deploying a Cloud Application

You’ll now learn basic Linux commands on your VM (Ubuntu 18.04) and deploy your first Apache web server.


🏁 Step 1 – Check Your Current Directory

pwd

Expected output:

/home/username

Note

pwd stands for print working directory β€” it shows where you are in the file system.


πŸ‘€ Step 2 – Create a New User

sudo adduser yoda

Follow the prompts to create a password and enter user details.

Warning

You won’t see your password as you type β€” this is normal in Linux.


⚑ Step 3 – Make yoda a Superuser

sudo usermod -aG sudo yoda

This gives yoda admin privileges.


πŸ” Step 4 – Switch User

sudo su yoda

You’re now logged in as yoda but still located in your previous home directory.
Move to your new one:

cd /home/yoda

🧹 Step 5 – Clear the Terminal

clear

πŸ“‚ Step 6 – List Files

ls

The folder is empty. Let’s create something.


🧱 Step 7 – Create a Folder and Navigate to It

mkdir jedi
cd jedi
pwd

Expected output:

/home/yoda/jedi

✏️ Step 8 – Install a Text Editor

sudo apt update
sudo apt install nano

Note

nano includes pico, a lightweight text editor we’ll use here.


🧾 Step 9 – Create and Edit a File

pico jedi/luke.txt

Paste or type:

Luke Skywalker was a Tatooine farmboy who rose from humble beginnings to become one of the greatest Jedi the galaxy has ever known.

Save: CTRL + S
Exit: CTRL + X


πŸ“‘ Step 10 – Create Another File

pico jedi/obi-wan.txt

Type:

A legendary Jedi Master, Obi-Wan Kenobi was a nobleman and gifted in the ways of the Force.

πŸ” Step 11 – View File List

ls -l jedi

Expected output:

total 8
-rw-rw-r-- 1 yoda yoda 131 Jan 9 11:25 luke.txt
-rw-rw-r-- 1 yoda yoda  92 Jan 9 11:30 obi-wan.txt

Tip

Each line shows file permissions, owner, and size.
Both files belong to yoda.


πŸ“‹ Step 12 – Copy and Remove Files

cp jedi/luke.txt jedi/luke_copy.txt
cp jedi/obi-wan.txt jedi/obi-wan-copy.txt
rm jedi/obi-wan-copy.txt

Use ls jedi to confirm changes.


🧰 Step 13 – Common Commands Recap

Command Purpose
pwd Show directory path
ls List files/folders
cd testfolder Navigate into a folder
cd .. Move up one level
mkdir Create new folder
pico filename Edit text file
cp a.txt b.txt Copy file
rm a.txt Delete file

πŸ—‚οΈ Step 14 – Copy a Folder

cp -r jedi jedi_backup

Check:

ls

Output:

jedi  jedi_backup

Then remove it:

rm -rf jedi_backup

🧩 Step 15 – Edit a File and View Its Contents

pico jedi/luke_copy.txt

Add at the top:

THIS IS A COPY

Now view it without opening the editor:

cat jedi/luke_copy.txt

βš’οΈ Step 16 – Install Apache Web Server

sudo apt install apache2

Info

You’ll be prompted for your password and to confirm with Y.

Once installed, open your VM’s External IP in your browser β†’
you should see the Apache2 Default Page.

apache-screenshot

The default page is stored at /var/www/html/index.html.


🌐 Step 17 – Create Your First Web Page

pico yoda-site.html

Paste:

<html>
  <head><title>This is a Yoda site!</title></head>
  <body>
    Hello World! I am Yoda! πŸ§™β€β™‚οΈ
    <p>
      <img src="https://cdn.quotesgram.com/img/71/36/1837595163-Yoda-The-Empire-Strikes-Back.jpg">
    </p>
  </body>
</html>

Save (CTRL S) β†’ Exit (CTRL X)


πŸ“¦ Step 18 – Deploy Your Web Page

Copy the file to the Apache web directory:

sudo cp yoda-site.html /var/www/html/

Now visit your VM’s URL:

http://<external-ip>/yoda-site.html

πŸŽ‰ Your Yoda site is live!


🏁 Summary

Command Purpose
cp -r folderA folderB Copy entire folders
rm -rf folder Delete a folder forcefully
cat file.txt View file contents
sudo apt install package Install software
sudo cp file /var/www/html/ Deploy web content

You Did It!

You’ve successfully completed Lab 1 Part 1.
You’ve learned how to: - Work with files and folders in Linux
- Create and edit text files
- Install software using the CLI
- Deploy a basic web page on Apache

Now continue to Lab 1 Part 2 πŸš€