Franske ITC-2480 Lab 1: Difference between revisions

From ITCwiki
Jump to navigation Jump to search
No edit summary
Line 2: Line 2:
In this lab you will install the latest version of Debian Linux in a virtual machine, learn how to login and check the IP address of the system, and learn to remotely access the system with SSH and SFTP.
In this lab you will install the latest version of Debian Linux in a virtual machine, learn how to login and check the IP address of the system, and learn to remotely access the system with SSH and SFTP.


=Local VirtualBox=
=VM Setup=
These instructions apply if you are completing this lab using the VirtualBox virtual machine software on campus or at home.
# Connect to the ITCnet either by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the VPN
# Make sure you have a copy of the latest version of Debian Linux.
# Open your browser to https://vsphere/ and click on the "Log in to vmWare vSphere Web Client" link on the right side of the page
#* If you are in an ITC lab on campus you should be able to find this on the D: drive of your computer in the D:\CNT Files folder
# Enter your vmWare credentials (the same as your VPN credentials)
#* If you need to download a copy you can find it on one of the Debian CD Image Mirror sites such as the one hosted by [http://mirror.anl.gov/pub/debian-cd/current/i386/iso-cd/debian-7.4.0-i386-netinst.iso Argonne National Lab]
# Click the "vCenter" tab on the left side of the screen just under "Home"
# Start the VirtualBox Software
# Click the "Hosts and Clusters" tab on the left side of the screen under "Inventory Trees"
#* Ensure that you have adjusted the VirtualBox "Default Machine Folder" to a location with appropriate permissions and space to save your VMs. If you are on campus this should be a new folder on the D: drive like D:\yourname-semesteryear This setting can be found in the File -> Preferences dialog box of VirtualBox
# Expand the ITC Datacenter -> Cluster One -> "2480 SS14" resource pool by clicking the small black triangle to the left of it
# Create a New VM
# In the center panel of your screen find your virtual machine (which your instructor has given you an ID letter for) and click on it, for example, mine is "2480-BF". Do not use the second VM (like "2480-BF-II") yet.
#* Bridged Networking to Internet
# Right click on your virtual machine and select "Edit Settings..."
#* If you are on campus make sure that you are connected to the ITC network 172.17.x.x
# When the settings panel loads click the small grey triangle to the left of "CD/DVD drive 1"
#* Debian Linux ISO attached to virtual CD drive
## Ensure the CD/DVD drive is set to "Datastore ISO File"
# Boot the VM and Install Debian Linux
## Ensure the "Connect At Power On" box is checked
## From the "Installer Boot Menu" choose "Install" not "Graphical Install" or one of the other choices
## Click the "Browse..." button to the right of the "CD/DVD Media" box.
## Select "English" as the language, "United States" as your location, and "American English" as the keymap.
### Click the "SAN0 Shared" datastore and then double click on the "ISOs" folder.
## Set a hostname for the system that is unique to you and this particular system
### Select the "debain-7.5.0-i385-netinst.iso" file and click the OK button. Make sure that you are using the i386 (32-bit) version for this course and not the amd64 version.
## Set the domain name to "localhost"
## Click the OK button again to close the settings dialog box.
## Set the root password to something you will NOT FORGET, this is the administrator account, "cisco" might be a good choice for our purposes
# Your VM is now setup and ready to be installed.
## Create a new user account using your first name (all lowercase) as the username and 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 and then write the changes to the disk and confirm it.
## Select a mirror located close to you with good speed. A good option on campus is "mirror.anl.gov" with no http proxy.
## Choose whether you want to participate in the package usage survey
## 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. Use the space bar to select and unselect and the tab key to move to the continue button.
## Choose yes to install GRUB to the master boot record
## When the installation is complete you can select continue to "eject" the virtual CD and reboot into the new install
# Login through the local console
# Check the IP address of your Linux system
## Use the ifconfig command as the root user on the system
# Remote SSH login from your host system through PuTTY
## Use the IP address you found above for your Linux system
# Remote SFTP login from your host system through FileZilla
## Use the IP address you found above for your Linux system, connect on port 22 for SFTP
# Safely shutdown your Linux system
## Use the "shutdown -h now" command as the root user to shutdown the system


=Remote vmWare=
=Debian Linux Installation=
Coming soon!
Note: These instructions assume that you have already installed the vSphere remote access plugin in your browser. If you have not done this yet you may be prompted to do so during the process.
# Right-click on your virtual machine and select "Power On"
# Click OK on the "Power On Recommendations" dialog box
# Right-click on your virtual machine and select "Open Console" which will open a local terminal to the VM in a new window.
# From the "Installer Boot Menu" choose "Install" '''not''' "Graphical Install" or one of the other choices
# Select "English" as the language, "United States" as your location, and "American English" as the keymap.
# Set eth0 as your primary network interface.
# Set a hostname for the system the same as your assigned machine name (e.g. 2480-BF)
# Set the domain name to "localhost"
# 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 using your first name (all lowercase) as the username and 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 and then write the changes to the disk and confirm it.
# 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 "mirror.anl.gov" 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. Use the space bar to select and unselect and the tab key to move to the continue button.
# Choose yes to install GRUB to the master boot record
# When the installation is complete you can select continue to "eject" the virtual CD and reboot into the new install


=New Commands=
=Installing sudo and checking your IP address=
* su
# Login through the local console with your root account and password (username root, password as set during the installation)
* exit
# 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-get update" and press enter which will update the list of software available for installation and then "apt-get install sudo" and press enter to install the sudo software.
* shutdown -r now
# 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 "adduser <username> sudo" and press enter, replacing <username> with the name of your standard user account (set during the setup process). We'll learn more about these commands later in the course.
* shutdown -h now
# Reboot your system using the "shutdown -r now" command to apply the changes
* ping
# Log in as your standard user account
* pwd
# Use the "sudo ifconfig" command to check the IP address of your system, you will need to enter in your password again when you run this command. The IP address should be something like 172.17.50.xxx and be on the eth0 adapter
* ls -al
 
=Logging in to a remote terminal==
A faster way to interact with your system is not through the vmWare local console but through a remote SSH session. 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.
# Assuming you are running Windows, install the PuTTY software on your home PC from [http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html this website].
# 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 Yes to save the host key on your system
# Enter the standard username and password for your Linux system to connect.
# You should receive a prompt just like the one you had on the local vmWare console.
# Type "exit" to close the connection while leaving your VM running.
 
=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 the FileZilla client software on your home PC from [https://filezilla-project.org/download.php?type=client this website]
# 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, your standard username and password in the appropriate boxes and "22" in the "Port:" box and click the "Quickconnect" button.
# 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.
# Close the FileZilla software to disconnect.
 
=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.
# Connect in to your system using the remote SSH console method explained above.
# Run the "sudo shutdown -h now" command 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.
# Now would be a good time to also close any vmWare windows you still have open and disconnect from the VPN.

Revision as of 02:32, 10 June 2014

Introduction

In this lab you will install the latest version of Debian Linux in a virtual machine, learn how to login and check the IP address of the system, and learn to remotely access the system with SSH and SFTP.

VM Setup

  1. Connect to the ITCnet either by directly plugging into an ITCnet port in one of the ITC labs or by connecting to the VPN
  2. Open your browser to https://vsphere/ and click on the "Log in to vmWare vSphere Web Client" link on the right side of the page
  3. Enter your vmWare credentials (the same as your VPN credentials)
  4. Click the "vCenter" tab on the left side of the screen just under "Home"
  5. Click the "Hosts and Clusters" tab on the left side of the screen under "Inventory Trees"
  6. Expand the ITC Datacenter -> Cluster One -> "2480 SS14" resource pool by clicking the small black triangle to the left of it
  7. In the center panel of your screen find your virtual machine (which your instructor has given you an ID letter for) and click on it, for example, mine is "2480-BF". Do not use the second VM (like "2480-BF-II") yet.
  8. Right click on your virtual machine and select "Edit Settings..."
  9. When the settings panel loads click the small grey triangle to the left of "CD/DVD drive 1"
    1. Ensure the CD/DVD drive is set to "Datastore ISO File"
    2. Ensure the "Connect At Power On" box is checked
    3. Click the "Browse..." button to the right of the "CD/DVD Media" box.
      1. Click the "SAN0 Shared" datastore and then double click on the "ISOs" folder.
      2. Select the "debain-7.5.0-i385-netinst.iso" file and click the OK button. Make sure that you are using the i386 (32-bit) version for this course and not the amd64 version.
    4. Click the OK button again to close the settings dialog box.
  10. Your VM is now setup and ready to be installed.

Debian Linux Installation

Note: These instructions assume that you have already installed the vSphere remote access plugin in your browser. If you have not done this yet you may be prompted to do so during the process.

  1. Right-click on your virtual machine and select "Power On"
  2. Click OK on the "Power On Recommendations" dialog box
  3. Right-click on your virtual machine and select "Open Console" which will open a local terminal to the VM in a new window.
  4. From the "Installer Boot Menu" choose "Install" not "Graphical Install" or one of the other choices
  5. Select "English" as the language, "United States" as your location, and "American English" as the keymap.
  6. Set eth0 as your primary network interface.
  7. Set a hostname for the system the same as your assigned machine name (e.g. 2480-BF)
  8. Set the domain name to "localhost"
  9. 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)
  10. Create a new user account using your first name (all lowercase) as the username and another password you will not forget
  11. Select your timezone
  12. Choose "Guided - Use entire disk" as the partitioning method and select the "sda" drive and "All files in one partition" as the partitioning scheme and then write the changes to the disk and confirm it.
  13. 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 "mirror.anl.gov" with no http proxy.
  14. Choose whether you want to participate in the package usage survey, for our purposes either choice is just fine.
  15. 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. Use the space bar to select and unselect and the tab key to move to the continue button.
  16. Choose yes to install GRUB to the master boot record
  17. 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

  1. Login through the local console with your root account and password (username root, password as set during the installation)
  2. 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-get update" and press enter which will update the list of software available for installation and then "apt-get install sudo" and press enter to install the sudo software.
  3. 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 "adduser <username> sudo" and press enter, replacing <username> with the name of your standard user account (set during the setup process). We'll learn more about these commands later in the course.
  4. Reboot your system using the "shutdown -r now" command to apply the changes
  5. Log in as your standard user account
  6. Use the "sudo ifconfig" command to check the IP address of your system, you will need to enter in your password again when you run this command. The IP address should be something like 172.17.50.xxx and be on the eth0 adapter

Logging in to a remote terminal=

A faster way to interact with your system is not through the vmWare local console but through a remote SSH session. 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.

  1. Assuming you are running Windows, install the PuTTY software on your home PC from this website.
  2. 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.
  3. Click Yes to save the host key on your system
  4. Enter the standard username and password for your Linux system to connect.
  5. You should receive a prompt just like the one you had on the local vmWare console.
  6. Type "exit" to close the connection while leaving your VM running.

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.

  1. Install the FileZilla client software on your home PC from this website
  2. 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, your standard username and password in the appropriate boxes and "22" in the "Port:" box and click the "Quickconnect" button.
  3. 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.
  4. Close the FileZilla software to disconnect.

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.

  1. Connect in to your system using the remote SSH console method explained above.
  2. Run the "sudo shutdown -h now" command 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.
  3. Now would be a good time to also close any vmWare windows you still have open and disconnect from the VPN.