Lab 1 mnjk: Difference between revisions
NateHaleen (talk | contribs) |
|||
(62 intermediate revisions by 3 users not shown) | |||
Line 6: | Line 6: | ||
*Learn to remotely access the system with SSH and SFTP. | *Learn to remotely access the system with SSH and SFTP. | ||
You will | You will be introduced to the following commands: | ||
*'''[https://linux.die.net/man/8/apt apt]''' | *'''[https://linux.die.net/man/8/apt apt]''' | ||
Line 14: | Line 14: | ||
*'''[https://linux.die.net/man/8/ip ip address show]''' | *'''[https://linux.die.net/man/8/ip ip address show]''' | ||
=Netlab Access= | =Lab Procedure= | ||
'''''[https://www.youtube.com/watch?v=-hLejbDfPGM&feature=youtu.be Video | ==Netlab Access== | ||
'''''[https://www.youtube.com/watch?v=-hLejbDfPGM&feature=youtu.be Video Tutorial - NetLab Access]''''' | |||
<ol> | <ol> | ||
<li> Connect to the ITCnet </li> | <li> Connect to the ITCnet </li> | ||
: This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]]. | : This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the [[ITC_VPN_Instructions|VPN]]. | ||
'' Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN. | :'' Note: If you want to connect using a wireless connection on campus you need to [[Connecting to Eduroam|connect to the eduroam network]] before connecting to the VPN. | ||
<li> After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net</li> | <li> After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net</li> | ||
* The first time you visit this site in a browser you may need to accept a self-signed security certificate | * The first time you visit this site in a browser you may need to accept a self-signed security certificate | ||
Line 26: | Line 27: | ||
<li> Once you are logged in click the blue "New Lab Reservation" button</li> | <li> Once you are logged in click the blue "New Lab Reservation" button</li> | ||
: Next, in the lower left corner of the screen, select "Schedule a Lab for Myself". Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit. | : Next, in the lower left corner of the screen, select "Schedule a Lab for Myself". Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit. | ||
:'' Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen. | |||
: All of our lab work in this class is done in a single "Lab Environment" and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course "Linux System Administration Labs". Click on this lab title. | : All of our lab work in this class is done in a single "Lab Environment" and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course "Linux System Administration Labs". Click on this lab title. | ||
<li> Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).</li> | <li> Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).</li> | ||
Line 35: | Line 36: | ||
</ol> | </ol> | ||
=Debian Linux Installation= | ==Debian Linux Installation== | ||
'''''[https://www.youtube.com/watch?v=H0DcdEytpFQ&feature=youtu.be Video | '''''[https://www.youtube.com/watch?v=H0DcdEytpFQ&feature=youtu.be Video Tutorial - Debian Linux Installation]''''' | ||
<ol> | <ol> | ||
<li> Log in to the Netlab system</li> | <li> Log in to the Netlab system</li> | ||
Line 55: | Line 56: | ||
* Set ''ens192'' as your primary network interface. | * Set ''ens192'' as your primary network interface. | ||
* Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like ''2480-Z'' for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the "Topology" and "Linux Server" tabs and you should see a line with "LSA Pod" followed by a letter, that letter is your pod ID letter. | * Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like ''2480-Z'' for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the "Topology" and "Linux Server" tabs and you should see a line with "LSA Pod" followed by a letter, that letter is your pod ID letter. | ||
'' Note: These steps are critical to future success in labs, check your spelling carefully'' | :'' Note: These steps are critical to future success in labs, check your spelling carefully'' | ||
: [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png| | : [[File:Lab1_hostname.png|link=https://wiki.ihitc.net/mediawiki/images/5/57/Lab1_hostname.png|500px]] | ||
: [[Media:Lab1_hostname.png|Click here for a larger image]] | |||
* Set the domain name to ''itc2480.campus.ihitc.net'' | * Set the domain name to ''itc2480.campus.ihitc.net'' | ||
: [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png| | : [[File:Lab1_domainname.png|link=https://wiki.ihitc.net/mediawiki/images/5/5a/Lab1_domainname.png|500px]] | ||
: [[Media:Lab1_domainname.png|Click | : [[Media:Lab1_domainname.png|Click here for a larger images]] | ||
* Set the root password to something you will NOT FORGET, this is the administrator account, ''cisco'' might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection) | * Set the root password to something you will NOT FORGET, this is the administrator account, ''cisco'' might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection) | ||
* Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget | * Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget | ||
Line 68: | Line 70: | ||
* Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine. | * Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine. | ||
* On the software selection screen UNSELECT "Debian desktop environment" and "Print server" and make sure that "SSH server" and "Standard system utilities" are the only two selected options. | * On the software selection screen UNSELECT "Debian desktop environment" and "Print server" and make sure that "SSH server" and "Standard system utilities" are the only two selected options. | ||
'' | :'' Note: To select and unselect options move your cursor over the option and press the space bar. | ||
* Choose that yes you want to install GRUB to the master boot record on the ''/dev/sda'' device. | * Choose that yes you want to install GRUB to the master boot record on the ''/dev/sda'' device. | ||
<li>Complete the installation</li> | <li>Complete the installation</li> | ||
Line 74: | Line 76: | ||
</ol> | </ol> | ||
=Installing sudo and | ==Installing sudo and Checking Your IP Address== | ||
'''''[https://www.youtube.com/watch?v=TwXp5YfAvlw&feature=youtu.be Video | '''''[https://www.youtube.com/watch?v=TwXp5YfAvlw&feature=youtu.be Video Tutorial - Installing sudo and checking your IP address]''''' | ||
<ol> | <ol> | ||
<li>Log in to NetLab</li> | <li>Log in to NetLab</li> | ||
: Login through the Netlab local console with your root account and password (username ''root'', password as set during the installation) | : Login through the Netlab local console with your root account and password (username ''root'', password as set during the installation) | ||
:'' Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password. | |||
<li>Install '''sudo''' from the command line using: | <li>Install '''sudo''' from the command line using: | ||
< | : ''Note: A good practice is to update your system before installing any packages, this should be completed using '''apt update''', ensure to use '''sudo''' when not logged in as root. | ||
< | : <code>apt update</code> | ||
: <code>apt install sudo</code></li> | |||
: For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the '''sudo''' program. The '''sudo''' program is not installed by default so after you have logged in to the root account enter '''apt update''' and press enter which will update the list of software available for installation and then '''apt install sudo''' and press enter to install the sudo software. | : For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the '''sudo''' program. The '''sudo''' program is not installed by default so after you have logged in to the root account enter '''apt update''' and press enter which will update the list of software available for installation and then '''apt install sudo''' and press enter to install the sudo software. | ||
<li>Add sudo privileges to our standard user account. | <li>Add sudo privileges to our standard user account. | ||
< | <code>adduser <username> sudo</code></li> | ||
: We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command '''sudo adduser ''<username>'' sudo''' and press enter, replacing ''<username>'' with the name of your standard user account (set during the setup process, probably your first name in lowercase). We'll learn more about these commands later in the course. | : We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command '''sudo adduser ''<username>'' sudo''' and press enter, replacing ''<username>'' with the name of your standard user account (set during the setup process, probably your first name in lowercase). We'll learn more about these commands later in the course. | ||
<li>Reboot system</li> | <li>Reboot system</li> | ||
< | <code>shutdown -r now</code> | ||
: Reboot your system using the '''shutdown -r now''' command to apply the changes | : Reboot your system using the '''shutdown -r now''' command to apply the changes | ||
<li>Log in as your standard user account, determine system IP address. | <li>Log in as your standard user account, determine system IP address. | ||
: Once you are logged in use the following command at the command line to determine the IP address of your system | : Once you are logged in use the following command at the command line to determine the IP address of your system | ||
< | <code>ip address show</code></li> | ||
: Using the '''ip address show''' command will allow you to check the IP address of your system. The IP address should be something like ''172.17.50.xxx'' and be an ''inet'' address on the ''ens192'' adapter. | : Using the '''ip address show''' command will allow you to check the IP address of your system. The IP address should be something like ''172.17.50.xxx'' and be an ''inet'' address on the ''ens192'' adapter. | ||
[[File:Lab1_ip_address_show2.PNG|500px]] | |||
<li>Test sudo privileges</li> | <li>Test sudo privileges</li> | ||
: Try running the same command as the administrator by typing '''sudo ip address show''', you will need to enter in your password again when you run this command. | : Try running the same command as the administrator by typing '''sudo ip address show''', you will need to enter in your password again when you run this command. | ||
< | <code>sudo ip address show</code> | ||
<li>Exit from the local console</li> | <li>Exit from the local console</li> | ||
: To log out of the console type '''exit''' and press enter. | : To log out of the console type '''exit''' and press enter. | ||
</ol> | </ol> | ||
=Logging in to a | ==Logging in to a Remote Terminal== | ||
'''''[https://www.youtube.com/watch?v=JEiDkrlPMNw&feature=youtu.be Video | '''''[https://www.youtube.com/watch?v=JEiDkrlPMNw&feature=youtu.be Video Tutorial - Logging into a remote terminal]''''' | ||
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network. | |||
<ol> | <ol> | ||
<li>Install Putty</li> | <li>Install Putty</li> | ||
Line 110: | Line 115: | ||
<li>Open an SSH session</li> | <li>Open an SSH session</li> | ||
:* Run the PuTTY software on your computer and enter in the IP address of your VM in the "Host Name" box and click the "Open" button. | :* Run the PuTTY software on your computer and enter in the IP address of your VM in the "Host Name" box and click the "Open" button. | ||
:[[File:Lab1_putty.png| | :[[File:Lab1_putty.png|link=https://wiki.ihitc.net/mediawiki/images/f/f5/Lab1_putty.png|500px]] | ||
:[[Media:Lab1_putty.png| Click here for larger image]] | :[[Media:Lab1_putty.png| Click here for larger image]] | ||
:* Click Yes to save the host key on your system | :* Click Yes to save the host key on your system | ||
: [[File: | : [[File:Lab1_puttycert.png|link=https://wiki.ihitc.net/mediawiki/images/4/4b/Lab1_puttycert.png|500px]] | ||
: [[Media:Lab1_puttycert.png|Click here for larger image]] | |||
:* Enter the standard username and password for your Linux system to connect. | :* Enter the standard username and password for your Linux system to connect. | ||
: '' Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server. | : '' Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server. | ||
Line 120: | Line 126: | ||
</ol> | </ol> | ||
=Remote File Transfer= | ==Remote File Transfer== | ||
'''''[https://www.youtube.com/watch?v=JEiDkrlPMNw&feature=youtu.be Video | '''''[https://www.youtube.com/watch?v=JEiDkrlPMNw&feature=youtu.be Video Tutorial - Remote File Transfer]''''' | ||
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network. | |||
<ol> | <ol> | ||
<li>Install FileZilla</li> | <li>Install FileZilla</li> | ||
Line 132: | Line 139: | ||
:* Enter ''22'' in the "Port:" box | :* Enter ''22'' in the "Port:" box | ||
:* Click the "Quickconnect" button. | :* Click the "Quickconnect" button. | ||
: [[File: | : [[File:Lab1_filezillanew.png|link=https://wiki.ihitc.net/mediawiki/images/b/b1/Lab1_filezillanew.png|500px]] | ||
: [[Media:Lab1_filezillanew.png|Click here for larger image]] | |||
: You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as ''.bashrc'' and ''.profile'' The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth. | : You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as ''.bashrc'' and ''.profile'' The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth. | ||
: [[File: | : [[File:Lab1_filezillaconnected.png|link=https://wiki.ihitc.net/mediawiki/images/c/ca/Lab1_filezillaconnected.png|500px]] | ||
: [[Media:Lab1_filezillaconnected.png|Click here for larger image]] | |||
<li>Close the FileZilla software to disconnect.</li> | <li>Close the FileZilla software to disconnect.</li> | ||
</ol> | </ol> | ||
=Install VM Tools= | ==Install VM Tools== | ||
'''''[https://www.youtube.com/watch?v=gLC1liwVJ8s&feature=youtu.be Video | '''''[https://www.youtube.com/watch?v=gLC1liwVJ8s&feature=youtu.be Video Tutorial - Install VM Tools]''''' | ||
: Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine. | : Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine. | ||
<ol> | <ol> | ||
Line 146: | Line 155: | ||
<li>Install '''open-vm-tools'''</li> | <li>Install '''open-vm-tools'''</li> | ||
: Run the '''sudo apt install open-vm-tools''' command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type '''y''' and press enter to install the software. | : Run the '''sudo apt install open-vm-tools''' command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type '''y''' and press enter to install the software. | ||
< | <code>sudo apt install open-vm-tools</code> | ||
</ol> | |||
==Install Python== | |||
In order to check your work in the labs of this course you will need to have an application called [https://www.python.org/ Python] installed on your Linux system. | |||
<ol> | |||
<li> Download ''python3'' using '''apt'''</li> | |||
* When prompted type Y to install the app and its dependencies</li> | |||
<ul>''NOTE: This may take a while.''</ul> | |||
* When prompted to specify the name of the host where the TANGO database server is running, just select ok.</li> | |||
<ul> [[File:Python_tango.png|link=https://wiki.ihitc.net/mediawiki/images/4/4c/Python_tango.png|500px]]</ul> | |||
<ul> [[Media:Python_tango.png | Click for Larger Image]]</ul> | |||
<li> Run the following command to verify that python version 3.6 is installed.</li> | |||
<code>python3 --version</code> | |||
<ul> [[File:Python_version.png|link=https://wiki.ihitc.net/mediawiki/images/7/70/Python_version.png|500px]]</ul> | |||
<ul> [[Media:Python_version.png | Click for Larger Image]]</ul> | |||
</ol> | </ol> | ||
=Install Nmap= | ==Install Nmap== | ||
:Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course. This course's labwork often builds upon the work you have done in previous labs. The self-check scripts are to assist you in ensuring you have not missed any ''critical'' steps in your work that would affect your success in subsequent labs. | :Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course. This course's labwork often builds upon the work you have done in previous labs. The self-check scripts are to assist you in ensuring you have not missed any ''critical'' steps in your work that would affect your success in subsequent labs. | ||
Line 157: | Line 181: | ||
<li>Open a SSH session to your server</li> | <li>Open a SSH session to your server</li> | ||
: Run the following command at the command line. | : Run the following command at the command line. | ||
< | <code>sudo apt install nmap</code> | ||
: Run the '''sudo apt install nmap''' command to install the nmap tool. You will be prompted about additional software packages required to be installed, type '''y''' and press enter to install the software. | : Run the '''sudo apt install nmap''' command to install the nmap tool. You will be prompted about additional software packages required to be installed, type '''y''' and press enter to install the software. | ||
</ol> | |||
==Install Curl== | |||
:Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course. | |||
<ol> | |||
<li> Run the following command at the command line. </li> | |||
<code>sudo apt install curl</code> | |||
: If prompted to install additional packages type "y" | |||
<li> Automatically check your results by running this command:</li> | |||
: Installing Curl will allow you to check each of your labs for completion of some of the critical objectives of the lab work using a command in the "Checking your Work" section of the labs. This will usually be completed as the last step of the lab, but for this lab please run the following command now to check your work. | |||
<code><nowiki> | |||
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3 | |||
</nowiki></code> | |||
<li>Close the SSH session</li> | <li>Close the SSH session</li> | ||
: Type '''exit''' to close the connection while leaving your VM running. | : Type '''exit''' to close the connection while leaving your VM running. | ||
</ol> | </ol> | ||
=Safely Shutdown= | ==Safely Shutdown== | ||
'''''[https://www.youtube.com/watch?v=gLC1liwVJ8s&feature=youtu.be Video | '''''[https://www.youtube.com/watch?v=gLC1liwVJ8s&feature=youtu.be Video Tutorial - Safely Shutdown]''''' | ||
:We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we'll turn it off. | :We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we'll turn it off. | ||
<ol> | <ol> | ||
Line 172: | Line 208: | ||
<li> Safely shutdown you server</li> | <li> Safely shutdown you server</li> | ||
:* Run the '''sudo shutdown -h now''' at the command line to safely shutdown the system. | :* Run the '''sudo shutdown -h now''' at the command line to safely shutdown the system. | ||
< | <code>sudo shutdown -h now</code> | ||
: You should soon get a message that PuTTY has lost it's connection. Click OK and then you can close the PuTTY window. | : You should soon get a message that PuTTY has lost it's connection. Click OK and then you can close the PuTTY window. | ||
<li>End NetLab Reservation</li> | <li>End NetLab Reservation</li> | ||
: If you still have time left in your reservation in Netlab it's polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the "Reservation" menu at the top of the screen and choose to "End Reservation Now" followed by confirming that you want to end the reservation. | : If you still have time left in your reservation in Netlab it's polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the "Reservation" menu at the top of the screen and choose to "End Reservation Now" followed by confirming that you want to end the reservation. | ||
</ol> | </ol> | ||
=Checking your Work= | |||
<ol> | |||
<li>This section will cover ways to manually check your work</li> | |||
<ul>For this lab each section was tested in the process of the lab. You should have successfully connected an SSH session with putty, and an ftp session with FileZilla.</ul> | |||
<ul>You should have shut down you server in one of the last steps, so no further testing is necessary at this time.</ul> | |||
<li> Automatically check your results by running this command:</li> | |||
<code><nowiki> | |||
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3 | |||
</nowiki></code> | |||
<br> | |||
</ol> | |||
=Web App= | |||
You can check your progress on any of the labs in the ITC-2480 course from a web app from this link: <br> | |||
[http://webcheck.itc2480.campus.ihitc.net webcheck.itc2480.campus.ihitc.net]<br> | |||
You must be logged into the campus VPN to use this application. <br> | |||
In order to use the web app, follow the link and enter the username, password and IP Address for your Linux server into the form. The address must be on the 172.17.50.0/24 subnet or the app will make you re-enter it. When you've entered your credentials, click the Sign In button on the bottom. You should see a 3x4 grid of buttons with the names of each of the labs. Click the lab you want to check and the application will automatically run the check-script for that lab! |
Latest revision as of 01:12, 20 April 2021
Introduction
- In this lab you will perform the following tasks:
- Access NetLab to access the environment for you virtual machine
- Install the latest version of Debian Linux in a virtual machine
- Learn how to login and check the IP address of the system
- Learn to remotely access the system with SSH and SFTP.
You will be introduced to the following commands:
Lab Procedure
Netlab Access
Video Tutorial - NetLab Access
- Connect to the ITCnet
- This can be accomplished by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the VPN.
- Note: If you want to connect using a wireless connection on campus you need to connect to the eduroam network before connecting to the VPN.
- After you are connected to ITCnet (by VPN or wired connection) you simply need to open a web browser and access https://ihcc-netlab.campus.ihitc.net
- The first time you visit this site in a browser you may need to accept a self-signed security certificate
- You will need to log in with a username and password established by your instructor.
- The first time you log in you will need to change your password and set your timezone. Make sure your timezone is set correctly so you can schedule reservations to work with equipment at convenient times.
- Once you are logged in click the blue "New Lab Reservation" button
- Next, in the lower left corner of the screen, select "Schedule a Lab for Myself". Reservations are used to hold a place on the Netlab system to work on labs during a specific time. You only need reservations in this class when working with the GUI, which will come later in the class, if you need to turn the power back on to your VM, or during the installation process. The rest of the time you will be able to connect directly to your Linux server using the SSH protocol, but more on that in a bit.
- Note: If you are enrolled in more than one class that is using Netlab you will be presented with a list of classes you are enrolled in, click on your Linux System Administration course of you see this screen.
- All of our lab work in this class is done in a single "Lab Environment" and your progress will be saved from one reservation to another. As a result there is only one lab listed in this course "Linux System Administration Labs". Click on this lab title.
- Use the calendar to choose a date, time, and specific pod to reserve for your lab activity (when you will begin your Debian server installation).
- The red line on this screen indicates the current time. If you want to get started right away you can click just below this line. Pay attention to the title of the column at the top, it will say something like "LSA Pod Z". The letter at the end of this pod name is your "pod letter" which you will use to set the host name and IP address of your machine in the future so make note of it.
- You will be presented with a summary screen for your reservation where you can set the end time of your reservation (up to a maximum). It is suggested to make your reservation a couple hours long the first time you plan to install Debian, though you can extend it if needed. Click submit once you are ready to make the reservation.
- You will see a confirmation screen that your reservation has been made.
- You are now ready to progress on to the Debian Linux Installation (as long as your reservation is right away).
Debian Linux Installation
Video Tutorial - Debian Linux Installation
- Log in to the Netlab system
- Access this using a web browser at https://ihcc-netlab.campus.ihitc.net if you are not already logged in.
- If you have a currently active reservation you will see a green "Enter Lab" button on your list of reservations. Click the green "Enter Lab" button. If not, you will need to make a reservation (see above) and then click the "Enter Lab" button.
- Your virtual machines (VMs) will automatically power on when your reservation begins and because there is no operating system currently installed to their virtual hard drives they will boot from their virtual CD/DVD drives which have been pre-loaded with the installation discs for Linux.
- Access you virtual machine console
- Once you are in your pod you can either click on the image of the "Linux Server" on the topology diagram or use the tabs across the top of your screen to access the console of your Linux Server VM.
- The console shows the display of your VM and allows you to type and interact with your VM just as if you were physically sitting down in front of a server with a monitor, keyboard, and mouse attached. Just like a separate physical machine you will not be able to copy and paste text or drag and drop files in and out of this console window. We will use other utilities across the network connection to do those things just like we would with a physical server.
- Learn to "Power Cycle" your virtual machine
- By now your VM has likely already booted from it's virtual CD/DVD drive and should be at the "Debian GNU/Linux installer menu". Before continuing let's practice rebooting your system so you can watch the system boot and see how to reboot the system if needed. Click the down arrow button on the right side of the "Linux Server" tab at the top of your screen and choose "Power Off" then click the red "Power Off" button on the popup to power off your VM. This is the equivalent of just pulling out the power cord, at least until we install the VMware Tools software which allows for a graceful shutdown, so you'll want to be careful to only do this if absolutely needed until then.
- Power on you Virtual machine
- Click the down arrow button on the right side of the "Linux Server" tab at the top of your screen and choose "Power On", or press the blue "Power On" button in the middle of your screen, then press the green "Power On" button to boot your system.
- Install Debian Linux
- Once the system has rebooted and is back to the "Debian GNU/Linux installer menu" choose "Install" and not "Graphical Install". If you make an incorrect choice you can reboot your virtual machine (power off and on) before installing to get back to the menu.
- In the installer you will use the space bar to select and unselect "checkboxes", the tab key to move between fields and buttons, and the enter key to continue. You will be prompted for the following choices
- Select English as the language, United States as your location, and American English as the keymap.
- Set ens192 as your primary network interface.
- Set a hostname for the system to 2480 followed by a dash and then your pod ID letter, like 2480-Z for LSA Pod Z. If you have forgotten your pod ID letter look up at the top of your screen above the line with the "Topology" and "Linux Server" tabs and you should see a line with "LSA Pod" followed by a letter, that letter is your pod ID letter.
- Note: These steps are critical to future success in labs, check your spelling carefully
- Click here for a larger image
- Set the domain name to itc2480.campus.ihitc.net
- Set the root password to something you will NOT FORGET, this is the administrator account, cisco might be a good choice for our purposes though that would not be secure for a system directly accessible from the Internet (we are protected by a firewall which you are bypassing via the VPN connection)
- Create a new user account by entering your name. The system will automatically use your first name (all lowercase) as the username and then you should set the password to another password you will not forget
- Select your timezone
- Choose "Guided - Use entire disk" as the partitioning method and select the sda drive and "All files in one partition" as the partitioning scheme, "Finish partitioning and write the changes to the disk", and then finally confirm you want to write the changes.
- You do not want to scan any other CDs or DVDs at this time.
- You want to select a mirror located close to you with good speed. Because your VM is actually running from the campus and is connected to the campus Internet connection a good option is "debian.uchicago.edu" with no http proxy.
- Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.
- On the software selection screen UNSELECT "Debian desktop environment" and "Print server" and make sure that "SSH server" and "Standard system utilities" are the only two selected options.
- Note: To select and unselect options move your cursor over the option and press the space bar.
- Choose that yes you want to install GRUB to the master boot record on the /dev/sda device.
- Complete the installation
- When the installation is complete you can select continue to "eject" the virtual CD and reboot into the new install
Installing sudo and Checking Your IP Address
Video Tutorial - Installing sudo and checking your IP address
- Log in to NetLab
- Login through the Netlab local console with your root account and password (username root, password as set during the installation)
- Note: When entering a password on the command line of a Linux system it is normal that nothing should appear and the cursor will not move when you are typing. This prevents someone who is able to see your computer screen from seeing what your password is or even how long it is. Just type your password and trust that the system is receiving it, press enter to submit your password.
- Install sudo from the command line using:
- Note: A good practice is to update your system before installing any packages, this should be completed using apt update, ensure to use sudo when not logged in as root.
apt update
apt install sudo
- For security purposes it is usually the case that you do not want to log in as the root user. Instead, best practice is to log in as a standard user and then execute specific commands that require root access with administrative privileges through the sudo program. The sudo program is not installed by default so after you have logged in to the root account enter apt update and press enter which will update the list of software available for installation and then apt install sudo and press enter to install the sudo software.
- Add sudo privileges to our standard user account.
adduser <username> sudo
- We now need to add our standard user account to the group which is allowed to have administrative access to do this enter the command sudo adduser <username> sudo and press enter, replacing <username> with the name of your standard user account (set during the setup process, probably your first name in lowercase). We'll learn more about these commands later in the course.
- Reboot system
- Reboot your system using the shutdown -r now command to apply the changes
- Log in as your standard user account, determine system IP address.
- Once you are logged in use the following command at the command line to determine the IP address of your system
ip address show
- Using the ip address show command will allow you to check the IP address of your system. The IP address should be something like 172.17.50.xxx and be an inet address on the ens192 adapter.
- Test sudo privileges
- Try running the same command as the administrator by typing sudo ip address show, you will need to enter in your password again when you run this command.
- Exit from the local console
- To log out of the console type exit and press enter.
shutdown -r now
sudo ip address show
Logging in to a Remote Terminal
Video Tutorial - Logging into a remote terminal
A faster way to interact with your system is not through the Netlab local console but through a remote SSH session over the network directly to your server. Once you have mastered this you will be able to copy and paste text to your Linux server and will not need to make a reservation in Netlab to work on labs. For our purposes you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.
- Install Putty
- Assuming you are running Windows, install the PuTTY software on your home PC from this website.
- Note: For other operating systems there are other ways and software you can use to make an SSH connection, you will need to research what tools are used for making SSH connections from your particular operating system.
- Open an SSH session
- Run the PuTTY software on your computer and enter in the IP address of your VM in the "Host Name" box and click the "Open" button.
- Click here for larger image
- Click Yes to save the host key on your system
- Click here for larger image
- Enter the standard username and password for your Linux system to connect.
- Note: You should receive a prompt just like the one you had on the Netlab local console but it is now a direct connection from your computer over the ITCnet to your server.
- Close the SSH session
- Type exit to close the connection while leaving your VM running.
Remote File Transfer
Video Tutorial - Remote File Transfer
The easiest way to transfer files to and from your VM is with SFTP software. For our purposes, you will always need to connect to the ITCnet VPN before doing this so that you have access to the 172.17.50.0 network.
- Install FileZilla
- Install the FileZilla client software on your home PC from this website
- Open a SFTP session to your server
- Run FileZilla and use the Quick Connect bar at the top of the screen to access your system.
- Enter the IP address of your Linux system in the "Host:" box
- Enter your standard username and password in the appropriate boxes
- Enter 22 in the "Port:" box
- Click the "Quickconnect" button.
- Click here for larger image
- You should see some connection text scroll on the top of the screen and some files on the right side of the screen now such as .bashrc and .profile The right side of the screen is the drive on your Linux system and the left side of the screen is the drive on your home system. Files and folders can be dragged between the two sides to transfer them back and forth.
- Click here for larger image
- Close the FileZilla software to disconnect.
Install VM Tools
Video Tutorial - Install VM Tools
- Because your Debian Linux server is running as a virtual machine on a vmWare host system in order to achieve the best performance and driver integration we should install the vmWare Tools software package in your virtual machine.
- Open a SSH session to your server
- Connect into your system using the remote SSH console method explained above.
- Install open-vm-tools
- Run the sudo apt install open-vm-tools command to install the vmWare Tools. You will be prompted about several additional software packages required to be installed, type y and press enter to install the software.
sudo apt install open-vm-tools
Install Python
In order to check your work in the labs of this course you will need to have an application called Python installed on your Linux system.
- Download python3 using apt
- When prompted type Y to install the app and its dependencies
- When prompted to specify the name of the host where the TANGO database server is running, just select ok.
- Run the following command to verify that python version 3.6 is installed.
- NOTE: This may take a while.
python3 --version
Install Nmap
- Nmap is a tool we will learn more about later in the course but it will likely be used to check many of the labs for completion while working through the course. This course's labwork often builds upon the work you have done in previous labs. The self-check scripts are to assist you in ensuring you have not missed any critical steps in your work that would affect your success in subsequent labs.
- NOTE: Before we begin the installation of this tool it is important to remember that scanning a system is often seen as an attack against the system and should not be done unless you are the administrator of both the system that you are scanning from and the system you are scanning or have the explicit permission of the system administrator of those systems! In some areas people have been legally charged and prosecuted for scanning of systems which they are not authorized to do. You have been warned!
- At this time all you will be doing is installing the tool as it will be used to self-check your lab work to verify you are ready to move on to the next lab.
- Open a SSH session to your server
- Run the following command at the command line.
- Run the sudo apt install nmap command to install the nmap tool. You will be prompted about additional software packages required to be installed, type y and press enter to install the software.
sudo apt install nmap
Install Curl
- Curl is a tool that lets you run scripts that are not saved to your virtual machine. It will be used to check the labs for completion while working through the course.
- Run the following command at the command line.
- If prompted to install additional packages type "y"
- Automatically check your results by running this command:
- Installing Curl will allow you to check each of your labs for completion of some of the critical objectives of the lab work using a command in the "Checking your Work" section of the labs. This will usually be completed as the last step of the lab, but for this lab please run the following command now to check your work.
- Close the SSH session
- Type exit to close the connection while leaving your VM running.
sudo apt install curl
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3
Safely Shutdown
Video Tutorial - Safely Shutdown
- We will normally leave our VM running but it is important that you know how to shutdown a Linux system correctly so this time we'll turn it off.
- Open a SSH session to your server
- Connect in to your system using the remote SSH console method explained above.
- Safely shutdown you server
- Run the sudo shutdown -h now at the command line to safely shutdown the system.
- You should soon get a message that PuTTY has lost it's connection. Click OK and then you can close the PuTTY window.
- End NetLab Reservation
- If you still have time left in your reservation in Netlab it's polite to end the reservation so other users can work on the system, only a limited number of reservations can be made at one time. You can do this by logging into Netlab, opening your lab, and clicking the "Reservation" menu at the top of the screen and choose to "End Reservation Now" followed by confirming that you want to end the reservation.
sudo shutdown -h now
Checking your Work
- This section will cover ways to manually check your work
- Automatically check your results by running this command:
- For this lab each section was tested in the process of the lab. You should have successfully connected an SSH session with putty, and an ftp session with FileZilla.
- You should have shut down you server in one of the last steps, so no further testing is necessary at this time.
curl https://raw.githubusercontent.com/mnjk-inver/Linux-2480-Rebuild/main/lab_01_revised.py | python3
Web App
You can check your progress on any of the labs in the ITC-2480 course from a web app from this link:
webcheck.itc2480.campus.ihitc.net
You must be logged into the campus VPN to use this application.
In order to use the web app, follow the link and enter the username, password and IP Address for your Linux server into the form. The address must be on the 172.17.50.0/24 subnet or the app will make you re-enter it. When you've entered your credentials, click the Sign In button on the bottom. You should see a 3x4 grid of buttons with the names of each of the labs. Click the lab you want to check and the application will automatically run the check-script for that lab!