This shows you the differences between two versions of the page.
|
cdci:res:openstack [2025/10/24 17:50] mihai.chiroiu created |
cdci:res:openstack [2025/10/24 18:00] (current) mihai.chiroiu |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== OpenStack ===== | ===== OpenStack ===== | ||
| - | You have the option to use the [[http://cloud.grid.pub.ro | + | For any labs requiring a Linux-based OS, you may use the [[http://cloud.grid.pub.ro | university's private cloud service (OpenStack)]]. |
| - | | faculty cloud (OpenStack)]] to complete your assignments/labs for RL. | + | |
| - | To start such a virtual machine for the first time, follow the tutorial at [[https://ocw.cs.pub.ro/courses/isc/info/virtualmachine | + | Using this, you may create / administer your own Virtual Machines (using a Web-based UI). |
| - | | this address]], keeping in mind the following key points and notes: | + | Note that you require some extra permissions on your student account before-hand (all course participants should have received them). |
| - | Add a private–public key pair on ''fep.grid.pub.ro'' (via ssh) and copy the public key to OpenStack (using the web interface). | + | Since the VMs have private IPs (not usable from the Internet), you will also need special care when connecting (''ssh''--ing in) to them. |
| + | That is, use a special //frontend machine// as proxy / intermmediary: ''fep.grid.pub.ro''. | ||
| + | You can do this either by ''ssh''--ing into ''fep'' and, from there, ''ssh''-ing to your virtual machine's private IP address (written in OpenStack's UI when creating the VM), OR (the preferred method) by using an advanced ''ssh''' feature: [[https://www.simplified.guide/ssh/jump-host|jump hosts]]! | ||
| - | Note: You only need to do this step once; the key remains active for the entire academic year (or until the first accidental deletion of it on fep :D). | + | Here are the rough steps: |
| - | When creating the virtual machine instance (in the "Launch instance" window), use the following settings: | + | 1. First time setup (only need to to this once, unless you lose your key!): |
| - | Give the instance a specific name — use your name and the lab number (e.g., "Iulia Florea Lab 8"); | + | * On your personal PC / laptop (in a bash-like or cmd shell), generate a public/private SSH keypair (if you haven't already): <code bash> |
| + | # first, check if a keypair already exists | ||
| + | you@yourlaptop:~# ls -l ~/.ssh/ | ||
| + | # if the files `id_ed25519` and `id_ed25519.pub` already exist, SKIP this next step: | ||
| + | you@yourlaptop:~# ssh-keygen -t ed25519 # use elliptic curves, better + shorter keys! | ||
| + | # answer the defaults (aka just press enter multiple times) | ||
| + | you@yourlaptop:~# ls -l ~/.ssh/ | ||
| + | -rw------- 1 root root 2602 Oct 15 12:59 id_ed25519 # <-- THE PRIVATE KEY, keep secret! | ||
| + | -rw-r--r-- 1 root root 571 Oct 15 12:59 id_ed25519.pub # <-- your PUBLIC key to give away! | ||
| + | # print and copy the private key (including the 'ssh-ed25519' prefix!): | ||
| + | you@yourlaptop:~# cat ~/.ssh/id_ed25519.pub | ||
| + | ssh-ed25519 AAAAB3NzaC... # a very long line containing the public key number | ||
| + | </code> | ||
| + | * Now, connect to the university's frontend processor machine (FEP): <code bash> | ||
| + | # first, login into fep using your Moodle account | ||
| + | you@yourlaptop:~# ssh moodle.username@fep.grid.pub.ro | ||
| + | # the first time, you'll need to authenticate using a browser, READ THE INSTRUCTIONS CAREFULLY! | ||
| + | # we want to avoid this the next times we ssh into FEP, so we will do the following: | ||
| + | [moodle.username@fep8 ~]$ mkdir -p ~/.ssh/ | ||
| + | [moodle.username@fep8 ~]$ nano ~/.ssh/authorized_keys | ||
| + | # paste your public key, INCLUDING THE ssh-ed25519 prefix! | ||
| + | # save, then exit! | ||
| + | </code> | ||
| + | * In a separate terminal, try to login again into ''fep.grid.pub.ro''. It should NOT ask for two-factor authentication anymore! | ||
| + | * **DO NOT LOSE (or share) THE PRIVATE KEY ON YOUR PC!** It can be used to authenticate on your behalf on FEP (and possibly more servers you setup the key with)! | ||
| + | * Now it's time to use [[https://cloud.grid.pub.ro/|OpenStack's Web UI]]! Open it in your browser, authenticate using ''login.upb.ro'', then: | ||
| + | * Compute -> Key Pairs -> Import Public Key, give it a suggestive name (e.g., "My Laptop"), set //Key Type// to ''SSH'' and paste your public key (contents of ''id_ed25519.pub''). **Note**: you only need to do this once per your device's lifetime (redo only if you lose and re-generate the key!). | ||
| + | * One-time setup is over! Proceed to create a new Virtual Machine and connect to it using ssh (read the following steps). | ||
| - | In the left menu, under Sources, look for ''RL 2024 rev 1'' and click the up arrow to select it; | + | 2. Create a new Virtual Machine on the UPB's OpenStack private cloud platform: |
| - | Under Flavor, ''m1.small'' is sufficient — you don’t need more CPUs or memory; | + | * Go to [[https://cloud.grid.pub.ro/]]. Click Compute -> Instances -> Launch Instance button! |
| + | * Fill the Instance Name (use //your name + lab number// for law & order); | ||
| + | * Go to the **Source** page, search the Available section for ''ISC 2025'' (choose the latest version) then click the //up arrow// icon to select it; | ||
| + | * From **Flavor**, choose ''m1.small'' (1GB RAM, 10GB disk should be enough); | ||
| + | * From **Networks**, choose ''vlan9'' (click the //up arrow// icon); | ||
| + | * Finally, click Launch Instance! | ||
| + | * Unfortunately, you must now wait a couple of minutes (~5 min in the worst case) until the VM is provisioned and booted! | ||
| + | * Wait until OpenStack allocates an IP address to your VM; it should begin with ''10.9...''; be careful: only search for the VM with **your given name** (don't worry, you will not be able to connect to other students' VMs without their private keys :P)! | ||
| + | * Periodically, try to connect to it with SSH on your PC (using FEP as jump target): <code bash> | ||
| + | # note: -J receives your FEP URL; your VM has the `ubuntu` + your pubkey as credentials! | ||
| + | you@yourlaptop:~# ssh -J moodle.username@fep.grid.pub.ro ubuntu@10.9.X.Y | ||
| + | # when the VM is ready, authentication should proceed withut asking for any passwords! | ||
| + | </code> | ||
| - | Under Networks, select ''vlan9'' and click the up arrow to set it; | + | <note important> |
| + | Our institution provides some rather limited resources at our disposal (mainly, a limit of 40 VMs). \\ | ||
| + | **Please delete the instance** after you're done with your lab / assignment to allow others to use the infrastructure without any hurdles! | ||
| + | </note> | ||
| - | Now you can start the machine by clicking Launch Instance! | ||
| - | |||
| - | Once the VM is running, you can connect to it using the following steps: | ||
| - | |||
| - | Connect via ssh to ''fep.grid.pub.ro'', then to your newly launched virtual machine through its private IP (''10.9.x.x''). Follow the steps below: | ||
| - | |||
| - | From your physical system, open a terminal and start an SSH session to ''fep.grid.pub.ro'': | ||
| - | <code bash> | ||
| - | student@mjolnir:~$ ssh <moodle_user>@fep.grid.pub.ro | ||
| - | |||
| - | </code> * **Attention!!** Replace ''<moodle_user>'' with your actual username! | ||
| - | |||
| - | From the ''fep'' terminal, connect further to your virtual machine on OpenStack: | ||
| - | <code bash> | ||
| - | [iulia.florea@fep7-1 ~]$ ssh -i ~/.ssh/openstack.key student@10.9.x.y | ||
| - | |||
| - | </code> * **Attention!!** The virtual machine’s IP is obtained from the graphical interface of [[https://cloud.grid.pub.ro|OpenStack]]. | ||