Differences

This shows you the differences between two versions of the page.

Link to this comparison view

scgc:laboratoare:00 [2021/03/01 17:10]
maria.mihailescu [4. [15p] Connect to the virtual machine with X forwarding]
scgc:laboratoare:00 [2021/10/13 17:26] (current)
maria.mihailescu [6. Delete the virtual machine]
Line 1: Line 1:
-====== ​Laboratory 00. Working with Openstack ======+====== Working with Openstack ======
 ===== Lab Setup ===== ===== Lab Setup =====
  
-  * We will be using two virtual machines in the [[http://cloud.curs.pub.ro/​|faculty'​s cloud]].+  * We will be using two virtual machines in the [[https://cloud.grid.pub.ro/​|faculty'​s cloud]].
   * When creating a virtual machine follow the steps described in the exercises below.   * When creating a virtual machine follow the steps described in the exercises below.
   * These steps will be useful in all labs.   * These steps will be useful in all labs.
Line 11: Line 11:
 The faculty'​s cloud uses [[https://​www.openstack.org/​|Openstack]] to provide students with the ability to create and configure virtual machines in the faculty'​s cluster. The faculty'​s cloud uses [[https://​www.openstack.org/​|Openstack]] to provide students with the ability to create and configure virtual machines in the faculty'​s cluster.
  
-Connect to Horizon, the web front-end of Openstack, at [[https://​cloud-controller.grid.pub.ro/​]] and authenticate using your LDAP username and password (LDAP is used to centrally authenticate across all UPB services; we will go into more details about how LDAP can be configured in [[scgc:​laboratoare:​02]]). Most labs will rely on interacting with Openstack using Horizon.+Connect to Horizon, the web front-end of Openstack, at [[https://​cloud.grid.pub.ro/​]] and authenticate using your LDAP username and password (LDAP is used to centrally authenticate across all UPB services; we will go into more details about how LDAP can be configured in [[scgc:​laboratoare:​02]]). Most labs will rely on interacting with Openstack using Horizon.
  
 Most virtual machine images (base virtual disks) use [[https://​cloudinit.readthedocs.io/​en/​latest/​|cloud-init]] to automatically configure the virtual machine. As part of the first run of the virtual machine, cloud-init will re-generate SSH host keys, reset the default user's password to an invalid value (and usually make them a sudoer without requiring the password), disable root login, and inject the user's keys into the virtual machine. Most virtual machine images (base virtual disks) use [[https://​cloudinit.readthedocs.io/​en/​latest/​|cloud-init]] to automatically configure the virtual machine. As part of the first run of the virtual machine, cloud-init will re-generate SSH host keys, reset the default user's password to an invalid value (and usually make them a sudoer without requiring the password), disable root login, and inject the user's keys into the virtual machine.
  
-We will use ''​fep.grid.pub.ro''​ as a proxy for our connections to the virtual machines. You can connect to fep using ''​ssh user.name@fep.grid.pub.ro''​ and entering the LDAP password of your account when prompted.+We will use ''​fep8.grid.pub.ro''​ as a proxy for our connections to the virtual machines. You can connect to fep using ''​ssh user.name@fep8.grid.pub.ro''​ and entering the LDAP password of your account when prompted.
  
-We also recommend using ''​-o ServerAliveInterval=100''​ to instruct the SSH client to send beacons to the server every 100 seconds, so you do not get disconnected due to inactivity, and ''​-X''​ for X11 forwarding (we will use this option later); the final command looks like ''​ssh user.name@fep.grid.pub.ro -X -o ServerAliveInterval=100''​. The short format will likely be enough in most cases.+We also recommend using ''​-o ServerAliveInterval=100''​ to instruct the SSH client to send beacons to the server every 100 seconds, so you do not get disconnected due to inactivity, and ''​-X''​ for X11 forwarding (we will use this option later); the final command looks like ''​ssh user.name@fep8.grid.pub.ro -X -o ServerAliveInterval=100''​. The short format will likely be enough in most cases.
  
 <note important>​ <note important>​
Line 23: Line 23:
 </​note>​ </​note>​
  
-==== 1. [5p] SSH key pair generation ====+==== 1. SSH key pair generation ====
  
 Because the virtual machine'​s user's password is reset to an invalid value by cloud-init, you will not be able to log into the virtual machine using password login. Instead, you must first create an SSH key that will be automatically added to the virtual machine'​s default user's authorized key. Because the virtual machine'​s user's password is reset to an invalid value by cloud-init, you will not be able to log into the virtual machine using password login. Instead, you must first create an SSH key that will be automatically added to the virtual machine'​s default user's authorized key.
Line 43: Line 43:
 {{ :​scgc:​laboratoare:​openstack-key-import.png?​700 }} {{ :​scgc:​laboratoare:​openstack-key-import.png?​700 }}
  
-==== 2. [15p] Create virtual machines ====+==== 2. Create virtual machines ====
  
 Now that the SSH key pair is available, we can start creating virtual machines. Note that you can only use a limited amount of total resources. You can see graphs of the total amount of resources you can use, and the amount of resources you have used so far through the Horizon interface, in the ''​Project''​ > ''​Compute''​ > ''​Overview''​ section. In the image below, resources are limited to 4 CPU cores and 4GB of RAM. Now that the SSH key pair is available, we can start creating virtual machines. Note that you can only use a limited amount of total resources. You can see graphs of the total amount of resources you can use, and the amount of resources you have used so far through the Horizon interface, in the ''​Project''​ > ''​Compute''​ > ''​Overview''​ section. In the image below, resources are limited to 4 CPU cores and 4GB of RAM.
Line 61: Line 61:
 === Details Menu === === Details Menu ===
  
-In the Details Menu, you must provide a suitable name for your virtual machine. In our case, the virtual machine will be named  ''​lab00''​.+In the Details Menu, you must provide a suitable name for your virtual machine. In our case, the virtual machine will be named  ''​scgc-lab00''​.
  
 {{ :​scgc:​laboratoare:​openstack-vm-create-details.png?​700 }} {{ :​scgc:​laboratoare:​openstack-vm-create-details.png?​700 }}
Line 97: Line 97:
    
 In the previous image, you can see information about the newly created virtual machine: In the previous image, you can see information about the newly created virtual machine:
-  * Instance Name: ''​lab00''​ – the virtual machine’s name that was configured through the Details Menu+  * Instance Name: ''​scgc-lab00''​ – the virtual machine’s name that was configured through the Details Menu
   * Image Name: ''​SCGC Template''​ – the virtual machine’s image that was chosen through the Source Menu   * Image Name: ''​SCGC Template''​ – the virtual machine’s image that was chosen through the Source Menu
   * IP Address: ''​10.9.X.Y''​ – the IP address that is assigned for the virtual machine. We will use this IP address to connect to the virtual machine.   * IP Address: ''​10.9.X.Y''​ – the IP address that is assigned for the virtual machine. We will use this IP address to connect to the virtual machine.
Line 107: Line 107:
 </​note>​ </​note>​
  
-==== 3. [15p] Connect to the virtual machine ====+==== 3. Connect to the virtual machine ====
 The picture bellow shows how you can connect to the virtual machine. Since the virtual machine runs in OpenStack (i.e. in the faculty'​s cluster) and the assigned IP address is a private address, you cannot directly connect to the virtual machine. ​ The picture bellow shows how you can connect to the virtual machine. Since the virtual machine runs in OpenStack (i.e. in the faculty'​s cluster) and the assigned IP address is a private address, you cannot directly connect to the virtual machine. ​
  
Line 155: Line 155:
 </​code>​ </​code>​
  
-==== 4. [15p] Connect to the virtual machine with X forwarding ====+==== 4. Connect to the virtual machine with X forwarding ====
 Linux uses a client-server architecture for the X window system. SSH allows you to forward graphical applications information through the X11 forwarding functionality. Linux uses a client-server architecture for the X window system. SSH allows you to forward graphical applications information through the X11 forwarding functionality.
  
Line 169: Line 169:
  
 === MacOS client === === MacOS client ===
-The MacOS SSH client has X11 forwarding functionality,​ but may not have an X11 server installed. You must first install an X11 server before being able to forward the GUI. Please follow [[https://​medium.com/​@toja/​using-x11-apps-in-mac-os-x-c74b304fd128|these instructions]]. Afterwards, you can use the same commands described for the Linux cient (above).+The MacOS SSH client has X11 forwarding functionality,​ but may not have an X11 server installed. You must first install an X11 server before being able to forward the GUI. Please follow [[https://​medium.com/​@toja/​using-x11-apps-in-mac-os-x-c74b304fd128|these instructions]]. Afterwards, you can use the same commands described for the Linux client ​(above).
  
 === Windows client === === Windows client ===
Line 181: Line 181:
 student@scgc-lab00:​~$ xclock student@scgc-lab00:​~$ xclock
 </​code>​ </​code>​
-==== 5. [20p] Connect to someone else's virtual machine ====+<​hidden>​ 
 +==== 5. Connect to someone else's virtual machine ====
 Partner up with someone else in the lab. Create a simple simple message server using ''​netcat''​ to listen to port ''​8890''​. Ask your partner to connect to your client and also try to connect to their server. You will need two terminals to perform this.  Partner up with someone else in the lab. Create a simple simple message server using ''​netcat''​ to listen to port ''​8890''​. Ask your partner to connect to your client and also try to connect to their server. You will need two terminals to perform this. 
  
Line 209: Line 210:
  
 {{ :​scgc:​laboratoare:​openstack-security-group-cidr.png?​700 }} {{ :​scgc:​laboratoare:​openstack-security-group-cidr.png?​700 }}
-==== 6[5p] Delete the virtual machine ====+</​hidden>​ 
 +==== 5. Delete the virtual machine ====
 After each lab, and whenever you no longer need a virtual machine, please delete it. Go to the Horizon dashboard, go to ''​Project''​ > ''​Compute''​ > ''​Instances''​ and delete the virtual machine. You can either select all virtual machines your wish to delete from their checkbox on the left, and then click on ''​Delete Instances'',​ or select ''​Delete instance''​ from the dropdown menu on the right. After each lab, and whenever you no longer need a virtual machine, please delete it. Go to the Horizon dashboard, go to ''​Project''​ > ''​Compute''​ > ''​Instances''​ and delete the virtual machine. You can either select all virtual machines your wish to delete from their checkbox on the left, and then click on ''​Delete Instances'',​ or select ''​Delete instance''​ from the dropdown menu on the right.
  
 It would also be a good idea to delete the security group rule you have previously created earlier if you do not need to allow communication with machines outside your project. It would also be a good idea to delete the security group rule you have previously created earlier if you do not need to allow communication with machines outside your project.
scgc/laboratoare/00.1614611441.txt.gz · Last modified: 2021/03/01 17:10 by maria.mihailescu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0