Open main menu

CDOT Wiki β

Changes

OPS705 Lab 2 (2207)

2,824 bytes added, 23:50, 11 January 2021
m
Chris.johnson moved page OPS705 Lab 2 to OPS705 Lab 2 (2207) without leaving a redirect: Old version, archived.
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 [[OPS705_Lab_1 | 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 your notes during all quizzestests, 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.
Before beginning, you must have:
# Successfully completed [[OPS705_Lab_1 | Lab 1]]
# Watched the Week 2 video lecture
# Read through the Week 2 slides, and have them handy as a reference for concepts
# Your Seneca Azure login credentials
# Your [[File:OPS705_Lab_Logbook | OPS705 Lab Logbook]]# An Internet connection is helpful (If you don't have one... How are you here?)linked mobile device for 2FA
= INVESTIGATION 1: Managing a Windows Server 2016 VM in Azure =
== Part 1: Creating A Windows VM From An Image ==
[[Image:Ops705_lab2_fig1Ops705_lab2_fig5.png|thumb|right|250px300px|Figure 1. Finding ''All Services'' from the Azure interface menu.]][[Image:Ops705_lab2_fig3.png|thumb|right|250px|Figure 2. Creating a new Virtual machine.]][[Image:Ops705_lab2_fig5.png|thumb|right|250px|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:
# Login Navigate to the [https://portal.azure.com Microsoft Azure Portal].# Click on the menu bar icon, and select ''All ServicesDevTest Labs > OPS705 > My virtual machines''. (Refer to Figure 1.)# In the ''Search All'' text box, type '''Virtual Machines'''.# Click on the '''Virtual machines''' result.# Once inside the Virtual Machines page, click the '''+ Add v''' button.# Select Wait for the ''Virtual machineChoose a base'' from the drop-down menulisting to populate. This may take a few moments.# In the new ''Create a new virtual machine'' pagesearch field, make sure youtype: 're in the ''Windows Server 2016 Datacenter'Basics''' tab.# In Select the item titled ''Subscription'Windows Server 2016 Datacenter' drop-down menu, select '''OPS705.2207'exactly''. Be careful here! There are many other options.# In the ''Resource group'' drop-down menuA new blade, select '''OPS705.2207.NAA'Create lab resource''appears. Do not create a new group!# Under In the ''Virtual machine name''field, use type: yourSenecaUsername-winserv. For example: cjohnson30-winservwin (you only have 15 characters, you may need to abbreviate)# Leave ''RegionUsername:'' and ''Availability options'yourSenecaUsername' at their defaults.# In the ''Image'' drop-down menu, choose '''Windows Server 2016 Datacenter''# ''Azure Spot instance''Use a saved secret: '''No'''Unchecked# Under ''SizePassword'': '''Standard_DS1_v2 - 1 vcpus, 3.5 GiB memory'''# In the ''Username'' fieldYour choice, but use your Seneca username.# In the ''Password'' field, choose a good password, then confirm it same for all VMs and resources in the next fieldthis course. '''Do not use your Seneca e-mail password!'''# For ''Public inbound ports'', select '''Allow selected ports'Save as default password:''Checked.# In the ''Select inbound portsVirtual machine size'' drop-down menu, make sure the '''RDP (3389)''' item is selected.# Under ''Already have a Windows Server license?: '', select 'Standard_B2ms''No'''.# At Leave the top of the page, select the ''Tags'' tab.# In the ''Name'' field, insert ''SenecaID''.# In the ''Value'' field, insert your Seneca usernameremaining options as they are.# Click on the ''Review + create'' tab.# Review your settings against the directions in this section.# When ready, click the '''Create''' button at the bottom left of the screen.# You are now back in the '''Overview'My virtual machines'' screen blade while Azure creates your personal virtual machine. This may take a few minutes.
# When it finishes, you should see a '''Your deployment is complete.''' message near the top of the page. Congratulations!
# 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 ==
[[Image:Ops705_lab2_fig6.png|thumb|right|250px275px|Figure 42. 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.
# In the ''Overview'' tab for the Virtual Machine created in Part 1, look for the '''Public IP addressor FQDN''' entry. This is the address you will use to connect later in this section. Write it down(Hover over the URL, and you'll see a ''Copy to clipboard'' icon).# Look for the '''NAT protocol''' entry. This is the port number you'll use to connect. Write this down as well.
# If you're on a Windows PC: Open the '''Remote Desktop Connection''' application. It comes pre-installed with the OS.
# If you're on a Mac: Download the '''Microsoft Remote Desktop''' app from the Mac App Store [https://apps.apple.com/ca/app/microsoft-remote-desktop/id1295203466 here].
# Open the ''Remote Desktop'' application.
# In the ''Computer'' field, enter the IP address and port you wrote down from step 1and 2.Use the following format: ''URL:portnumber'' (Example: ops705108.canadacentral.cloudapp.azure.com:62245)
# In the ''User name'' field, enter your Seneca username.
# Click the '''Connect''' button.
# You should see a login progress screen, and a Windows Server desktop after a few moments.
# Congratulations! You've set up a Windows Server VM and logged in remotely.
# Open Notepad, and write <code>My name is ''insertFullName'', and I've completed the Windows Server VM investigation!</code> Save the file to your VM's desktop, with the filename ''yourSenecaUsername.txt''.
# '''Do not skip Part 3 at this stage! Otherwise, you'll be bleeding funds by leaving the VM running.'''
== Part 3: Shutting Down Fully Stopping Your Windows Safely Virtual Machine ==[[Image:Ops705_lab2_fig7.png|thumb|right|350px375px|Figure 53. The Overview page blade for the winserv VM. Notice its status as ''Stopped''.]]This section is fairly simple. Whenever possible,''always'' shut down The one thing to never forget: Ensure your VMs properly. DonVM't automatically go s status is set to the Azure VM Overview and click '''Stop'Stopped (Deallocated)''. This is how you lose data and corrupt systems.# Remotely connect to the Windows Server desktop (if you haven't already).# Click on In the ''WindowsOverview'' Start iconblade of your Windows Server VM, and select click on the Power icon.# Select '''Shut downStop'', and choose a reason. It doesn't matter which at this point in the coursebutton.# Your VM A notification will now shutdown. You will lose appear in the top right of your browser window, confirming your remote connectionaction.# Switch back to your browser, Don't worry about going into the Windows OS and in shutting down first. Azure, load Virtual machines > winserv > Overview, and verify its Status is set sends a signal to '''Stopped'''. You may need the VM to refresh the page a few timesshut down safely.# You've successfully and properly shut down If your Windows VM!# status says stopped, but does not include the '''Bonus:(Deallocated)''' For shortcut glorytext, in then resources are still being held by the Windows VMand we're still being charged. The stop button will still be available, use the Winkey+R combo, and type <code>shutdown /p</code> in the Run dialog box instead of using the Start menuso click it.
= 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 [[OPS705_Lab_3 | Lab 3]].
== Part 1: Creating A CentOS VM From An Image ==
[[Image:Ops705_lab2_fig8.png|thumb|right|450px500px|Figure 64. Searching for a CentOS 7.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:# '''Virtual machine nameChoose a base:''' yourSenecaUsernameCentOS-linux# '''Image:''' CentOS based 7.8 Minimal (You'll need to search for it using the ''Browse all public and private images'' link. See ''Figure 6'')# '''RegionVirtual machine name:''' Default settingyourSenecaUsername-lnx# '''Availability optionsUser name:''' Default setting# '''Azure spot instance:''' No# '''Size:''' Basic_A0 - 1vcpus, 0.75 GiB memoryyourSenecaUsername
# '''Authentication type:''' Password
# '''UsernameUse a saved secret:''' yourSenecaUsernameUnchecked# '''Password:''' Same password you used for as your Windows ServerVM# '''Public inbound portsSave as default password:''' Allow selected portsChecked# '''Select inbound portsVirtual machine size:''' SSH (22)Standard_B1ms# Click on the ''Advanced Settings'' tab.# Under '''IP address''', select ''Public''.# Click back to ''Basic Settings.# Leave all other options as they are.# Click '''Create'''!
In the ''Tags'' tab:# '''Name:''' SenecaID# '''Value:''' yourSenecaUsername In the ''Review + create'' tab:# Click '''Create''' When deployment is complete, click on the new VM in '''Go to resource'My virtual machines'' tab to verify its status and find the VM's IP addressand SSH port. Write it both down.
== Part 2: Accessing Your CentOS VM Remotely Using SSH ==
[[Image:Ops705_lab2_fig9.png|thumb|right|450px|Figure 5. 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.
On Windows Using PuTTY:
#Open ''PuTTY''# In the '''Host Name (or IP address)''' field: Insert your address from ''Part 1''. (Refer to ''Figure 7'')# In the '''Port''' field: '''22'''# Leave all other fields as their defaults.# Click on the '''Open''' button.# Click ''Yes'' on the security alert.# In the '''login as:''' prompt, type your SenecaUsername, the press Enter.# 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.)# If login is successful, you should see a prompt like this: <code>[cjohnson30@cjohnson30-lnx ~]$</code># To prove you've completed this section, run the following: <code>echo "My name is ''insertFullName'', and I've completed the CentOS investigation." > ~/lab2.txt</code># To quit, type <code>exit</code>.
== Part 3On macOS/Linux Using Terminal: Shutting Down CentOS Safely ==As with # From the command line, type <code>ssh ''yourSenecaUsername''@''address''</code>, press Enter.# When prompted for a password, use the one you gave when you created the Windows Server VM. (You won't see anything as you type here; that's normal.)# If login is successful, you should see a prompt like this: <code>[cjohnson30@cjohnson30-lnx ~]$</code># To prove you've completed this section, shutting down safely run the following: <code>echo "My name is paramount for keeping your data ''insertFullName'', and OS safeI've completed the CentOS VM investigation." > ~/lab2.txt</code># To quit, type <code>exit</code>.
From the command line== Part 3:Fully Stopping your CentOS VM ==# Type: <code>sudo systemctl poweroff</code># Enter As with the Windows Server VM, fully deallocating your password when askedVM is essential to responsible usage.
In Azure# Click on the ''s 'Stop'Overview'' button at the top of your CentOS the VM:# Ensure its Status is set to '''Stopped'''s Overview blade.
That's it!
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 ==From the ''DevTest Labs'' blade:# Click on the ''My virtual machines'' menu bar item.# Click on the virtual machine you'd like to manage to move to its ''Overview'' blade.# Click the '''Start''' menu button near the top.
== Part 2: Powering Off A Virtual Machine ==
From the ''DevTest Labs'' blade:
# Click on the ''My virtual machines'' menu bar item.
# Click on the virtual machine you'd like to manage to move to its ''Overview'' blade.
# Click the '''Stop''' menu button near the top.
 
Remember the difference between the status ''Stopped'' and ''Stopped (deallocated)''!
 
== Part 3: Restarting A Virtual Machine ==
There are two methods to restarting a VM. Either within the OS, or through the Azure Dashboard.
 
Inside the OS:
* Windows: Click on Start, and select Power Off.
* Linux: From the command line (SSH), type <code>sudo reboot</code>
In either OS, you will be disconnected from your remote session. Wait a few minutes while the VM restarts, and reconnect.
 
From Azure Dashboard:
# Click on the '''Stop''' button from the VM's ''Overview'' blade.
# Wait until the VM's status has changed to '''Stopped (Deallocated)'''.
# Click on the '''Start''' button at the top of the blade.
 
== Part 4: Deleting A Virtual Machine ==
Deleting a Virtual Machine is useful when you no longer need it long-term, or if there's a catastrophic issue with the OS inside. Be careful! Any saved data inside the VM will be deleted as well!
# Navigate to the VM's ''Overview'' blade.
# If the VM status isn't '''Stopped (Deallocated)''', stop the VM. Wait until its status updates.
# Click on the '''Delete''' button at the top of the blade.
== Part 35: Deleting A Virtual Machine Note About Resource Usage ==As mentioned during our lecture and throughout this lab, using resources responsibly is incredibly important. We pay for what we use. While we have a failsafe in place to stop all VMs at 2:00am EST daily, don't rely on it! Fully stop your VMs when you're not using them.
== Part 4: A Note About Resource Usage ==Your total allowed resource allocation has been restricted for this course. This means you can only have two VMs (or services) at a time. This includes Web Apps. If you have two already, you won't be able to add another until you delete one.
= Lab Submission =
Once complete, youSubmit to Blackboard's ''Lab Submission'' section full-desktop screenshots (PNG/JPG) of the following:# Your view of the OPS705 DevTest Labs Overview blade.# The Azure ''Overview''ll submit blade for your work through '''Windows Server''' VM.# The Azure ''Overview'' blade for your section's Blackboard course''CentOS''' VM. See below # A full desktop screenshot of the text file created for what is requiredyour Windows VM, open in Notepad.# A screenshot of your CentOS remote SSH session after running the command: <code>cat ~/lab2.txt</code> Your professor will review your VMs directly; the screenshots are a backup in case of catastrophic issues.
== Lab Check Script =='''Your professor will not check your lab until the screenshots have been submitted.'''
== Online Submission Requirements ==Make sure to fully stop your VMs when you're done!
[[Category:OPS705]]
[[Category:Digital Classroom]]
[[Category:Fall 2020]]
[[Category:Draft]]