Open main menu

CDOT Wiki β

OPS705 Lab 2 (2207)

Revision as of 12:50, 29 July 2020 by Chris.johnson (talk | contribs) (Part 1: Creating A CentOS VM From An Image)

LAB PREPARATION

Purpose / Objectives of Lab 2

In this lab, you will learn how to create Windows and Linux virtual machines using a pre-built image, how to remotely connect to each, and basic management of these VMs from the Azure web interface. These two VMs will be used extensively in your later labs. This lab assumes you have completed Lab 1 successfully. Refer back to that lab for reminders on the basics of the Azure Dashboard interface.

While you are working through this lab, it is highly recommended that you write notes down in your OPS705 Lab Logbook. These are general notes and commands to help you remember how to do this lab. Each lab has its own page in the logbook. You may use this logbook during all quizzes, so fill it out accordingly!

If you encounter technical issues, please contact your professor via e-mail or in your section's Microsoft Teams group.

Minimum Requirements

Before beginning, you must have:

  1. Successfully completed Lab 1
  2. Your Seneca Azure login credentials
  3. Your OPS705 Lab Logbook
  4. An Internet connection is helpful (If you don't have one... How are you here?)

INVESTIGATION 1: Managing a Windows Server 2016 VM in Azure

In this investigation, you'll create, configure, and manage a Windows Server 2016 Virtual Machine using Microsoft Azure and a pre-built image. This means no tedious and time-consuming Windows installation! You'll also login to the VM remotely, using Microsoft's Remote Desktop Protocol to share its desktop.

Part 1: Creating A Windows VM From An Image

 
Figure 1. Finding All Services from the Azure interface menu.
 
Figure 2. Creating a new Virtual machine.
 
Figure 3. A partial view of the Basics tab on the VM creation page.

To create your Windows Server 2016 Virtual machine, perform the following steps:

  1. Login to the Microsoft Azure Portal.
  2. Click on the menu bar icon, and select All Services. (Refer to Figure 1.)
  3. In the Search All text box, type Virtual Machines.
  4. Click on the Virtual machines result.
  5. Once inside the Virtual Machines page, click the + Add v button.
  6. Select Virtual machine from the drop-down menu.
  7. In the new Create a new virtual machine page, make sure you're in the Basics tab.
  8. In the Subscription drop-down menu, select OPS705.2207.
  9. In the Resource group drop-down menu, select OPS705.2207.NAA. Do not create a new group!
  10. Under Virtual machine name, use yourSenecaUsername-winserv. For example: cjohnson30-winserv
  11. Leave Region and Availability options at their defaults.
  12. In the Image drop-down menu, choose 'Windows Server 2016 Datacenter
  13. Azure Spot instance: No
  14. Under Size: Standard_DS1_v2 - 1 vcpus, 3.5 GiB memory
  15. In the Username field, use your Seneca username.
  16. In the Password field, choose a good password, then confirm it in the next field. Do not use your Seneca e-mail password!
  17. For Public inbound ports, select Allow selected ports.
  18. In the Select inbound ports drop-down menu, make sure the RDP (3389) item is selected.
  19. Under Already have a Windows Server license?, select No.
  20. At the top of the page, select the Tags tab.
  21. In the Name field, insert SenecaID.
  22. In the Value field, insert your Seneca username.
  23. Click on the Review + create tab.
  24. Review your settings against the directions in this section.
  25. When ready, click the Create button at the bottom left of the screen.
  26. You are now in the Overview screen while Azure creates your personal virtual machine. This may take a few minutes.
  27. When it finishes, you should see a Your deployment is complete. message near the top of the page. Congratulations!
  28. Click on the Go to resource button at the bottom left of the page and move on to the next section of the lab.

Part 2: Accessing Your Windows VM Remotely Using RDP

 
Figure 4. The Remote Desktop Connection application on Windows.

In this section, we'll discover how to remotely connect to the Windows Server's desktop environment over the Internet from your computer.

  1. In the Overview tab for the Virtual Machine created in Part 1, look for the Public IP address entry. This is the address you will use to connect later in this section. Write it down.
  2. If you're on a Windows PC: Open the Remote Desktop Connection application. It comes pre-installed with the OS.
  3. If you're on a Mac: Download the Microsoft Remote Desktop app from the Mac App Store here.
  4. Open the Remote Desktop application.
  5. In the Computer field, enter the IP address you wrote down from step 1.
  6. In the User name field, enter your Seneca username.
  7. Click the Connect button.
  8. Type the password you used when creating the VM in Part 1.
  9. Accept the certificate warning. (Click yes.)
  10. You should see a login progress screen, and a Windows Server desktop after a few moments.
  11. Congratulations! You've set up a Windows Server VM and logged in remotely.
  12. Do not skip Part 3 at this stage! Otherwise, you'll be bleeding funds by leaving the VM running.

Part 3: Shutting Down Windows Safely

 
Figure 5. The Overview page for the winserv VM. Notice its status as Stopped.

This section is fairly simple. Whenever possible,always shut down your VMs properly. Don't automatically go to the Azure VM Overview and click Stop. This is how you lose data and corrupt systems.

  1. Remotely connect to the Windows Server desktop (if you haven't already).
  2. Click on the Windows Start icon, and select the Power icon.
  3. Select 'Shut down, and choose a reason. It doesn't matter which at this point in the course.
  4. Your VM will now shutdown. You will lose your remote connection.
  5. Switch back to your browser, and in Azure, load Virtual machines > winserv > Overview, and verify its Status is set to Stopped. You may need to refresh the page a few times.
  6. You've successfully and properly shut down your Windows VM!
  7. Bonus: For shortcut glory, in the Windows VM, use the Winkey+R combo, and type shutdown /p in the Run dialog box instead of using the Start menu.

INVESTIGATION 2: Managing a CentOS Linux VM in Azure

In this investigation, we'll create, configure, and manage a CentOS Minimal Virtual Machine using Microsoft Azure. This is a command line only OS, so you'll be using SSH to remotely connect to the VM and issue basic commands. This VM will be used extensively in Lab 3.

Part 1: Creating A CentOS VM From An Image

 
Figure 6. Searching for a CentOS 8 Minimal image.

To create your CentOS VM, follow the steps from Investigation 1, Part 1, but with the following settings:

In the Basics tab:

  1. Virtual machine name: yourSenecaUsername-linux
  2. Image: CentOS 8 Minimal (You'll need to search for it using the Browse all public and private images link. See Figure 6)
  3. Region: Default setting
  4. Availability options: Default setting
  5. Azure spot instance: No
  6. Size: Basic_A0 - 1vcpus, 0.75 GiB memory
  7. Authentication type: Password
  8. Username: yourSenecaUsername
  9. Password: Same password you used for your Windows Server
  10. Public inbound ports: Allow selected ports
  11. Select inbound ports: SSH (22)

In the Tags tab:

  1. Name: SenecaID
  2. Value: yourSenecaUsername

In the Review + create tab:

  1. Click Create

When deployment is complete, click on the Go to resource tab to verify its status and find the VM's IP address. Write it down.

Part 2: Accessing Your CentOS VM Remotely Using SSH

 
Figure 7. The initial PuTTY screen on Windows.

We will be accessing our new Linux VM remotely using SSH, which is a command-line (CLI) only protocol. We'll be diving into CLI in more detail during our next lab.

Requirements: An SSH Client

  1. Windows: Download the PuTTY client here.
  2. macOS/Linux: Use the built-in Terminal application.

On Windows Using PuTTY:

  1. Open PuTTY
  2. In the Host Name (or IP address) field: Insert your IP address from Part 1. (Refer to Figure 7)
  3. Leave all other fields as their defaults.
  4. Click on the Open button.
  5. Click Yes on the security alert.
  6. In the login as: prompt, type your SenecaUsername, the press Enter.
  7. In the password field, type the password you gave when creating the VM. (You won't see anything as you type here; that's normal.)
  8. If login is successful, you should see a prompt like this: [cjohnson30@cjohnson30-linux ~]$
  9. To prove you've completed this section, run the following: echo "My name is insertFullName, and I've completed the CentOS investigation!" > ~/lab2.txt
  10. To quit, type exit. Don't do this, yet! Move to Part 3.

On macOS/Linux Using Terminal:

  1. From the command line, type ssh yourSenecaUsername@ipaddress, press Enter.
  2. When prompted for a password, use the one you gave when you created the VM. (You won't see anything as you type here; that's normal.)
  3. If login is successful, you should see a prompt like this: [cjohnson30@cjohnson30-linux ~]$
  4. To prove you've completed this section, run the following: echo "My name is insertFullName, and I've completed the CentOS investigation!" > ~/lab2.txt
  5. To quit, type exit. Don't do this, yet! Move to Part 3.

Part 3: Shutting Down CentOS Safely

As with the Windows Server VM, shutting down safely is paramount for keeping your data and OS safe.

From the command line:

  1. Type: sudo systemctl poweroff
  2. Enter your password when asked.

In Azure's Overview of your CentOS VM:

  1. Ensure its Status is set to Stopped

That's it!

INVESTIGATION 3: Managing Your VMs Directly Through Azure's UI

In this quick investigation, we'll walk through how to directly manage virtual machines from the Azure Dashboard interface on a basic level. This is useful for starting up VMs, shutting them down when unresponsive, and deleting them when you're finished. (Warning: Do not delete either VM created in this lab!)

Part 1: Powering On / Restarting A Virtual Machine

Part 2: Powering Off A Virtual Machine

Part 3: Deleting A Virtual Machine

Part 4: A Note About Resource Usage

Lab Submission

Once complete, you'll submit your work through your section's Blackboard course. See below for what is required.

Lab Check Script

Online Submission Requirements