LAB Exercises Prepare VM on the Stratus Cloud 2024 IoT LAB – Cloud Services IoT LAB – today’s tasks ● Prepare virtual machine(s) ● Construct IP connectivity ● Install InfluxDB ● Install Grafana Stratus.FI ● OpenNebula virtualization platform ● Open to all students from FI ● Pre-configured virtual machines ● Login to management the same as login to KYPO PCs ● https://stratus.fi.muni.cz/ Stratus.FI ● Two ways to log into VM: ● PKI ● password Using Stratus.FI with PKI ● Prepare ssh keys ● Linux ● ssh-keygen -b 4096 -t rsa -f Stratus ● PassPhrase preferably empty ● Will generate files Stratus and Stratus.pub ● Windows ● Puttygen Using Stratus.FI with PKI ● Save your public key to Stratus ● Login ● Click your name → Settings → Auth → Public SSH Key ● You can add new key if you already have one installed ● Create virtual machine Create virtual machine ● Use template 1307 – Debian12[CVTFI] ● Instantiate as persistent ● Assign a name ● Click Create ● Don’t use excessive resources Create virtual machine Using Stratus.FI with password ● Generate DES encrypted password ● Create the VM ● Install the root password ● Log-in via VNC ● Create an user ● Log-in via ssh and newly created user Generate DES encrypted password ● Linux ● mkpasswd -m des your_password ● mkpasswd is part of the whois package ● Windows ● Use some on-line Python interpreter, e.g., https://www.programiz.com/python-programming/online-co mpiler/ ● import crypt ● hashed_password = crypt.crypt("your_password", "salt") ● print(hashed_password) Using Stratus.FI with password ● Open the VM → Conf ● → Update Configuration ● → Context → Custom vars Create a local user ● useradd -m your_username ● passwd your_username Using Stratus.FI ● Now you can access the console from Stratus management interface ● Access is allowed from FI, not from KYPO LAB ● Similar situation is expected in real life as well ● Two way to overcame the fence: ● SSH port forwarding ● OpenVPN SSH port forwarding SSH port forwarding ● Mainly for web interface to your servers ● Example Linux ● ssh -L 2222:Your_VM_IP_addr:22 -L 3000:Your_VM_IP_addr:3000 -L 8086:Your_VM_IP_addr:8086 yourlogin@aisa.fi.muni.cz ● ssh -i Stratus -p 2222 root@127.0.0.1 ● Web browser http://localhost:3000 SSH port forwarding – Windows Client ● Set host aisa.fi.muni.cz ● Side pannel → connection → SSH → Tunnel ● Source port 2222 ● Destination Your_VM_IP_addr:22 → Click add ● Source port 3000 ● Destination Your_VM_IP_addr:3000 → Click add ● Source port 8086 ● Destination Your_VM_IP_addr:8086 → Click add ● Save the configuration ● Open a new putty window, host = 127.0.0.1, port = 2222 InfluxDB ● Follow the instructions on the web https://docs.influxdata.com/influxdb/v2/install/ ● Or go directly to the download page https://www.influxdata.com/downloads/ ● If the gpg package is missing, install it via apt-get install gpg ● Don’t forget to start the influxdb: sudo service influxdb start ● And check it’s running: sudo service influxdb status Grafana ● Follow the instructions on the web: https://grafana.com/docs/grafana/latest/setup-grafana/i nstallation/debian/ ● Get started with Grafana and InfluxDB: https://grafana.com/docs/grafana/latest/getting-started/ get-started-grafana-influxdb/ ● Login to Grafana: https:127.0.0.1:3000 ● Default credentials: admin/admin Create a database (bucket) in InfluxDB ● Open the InfluxDB UI: http://localhost:8086 ● Create a Bucket (InfluxDB v2 uses "buckets" instead of databases): ● Log in to the InfluxDB UI. ● Go to Data > Buckets > Click Create Bucket. ● Enter a name for the bucket. > Click Create to save the bucket. ● Set Up Authorization (Token): ● Go to Data > Tokens. ● Either create a new token or use the default one to authenticate your API calls. ● Copy the token, you’ll need it for data interactions via the InfluxDB API or InfluxDB CLI. Add InfluxDB as a Data Source in Grafana ● Log in to Grafana: Go to your Grafana instance (e.g., http://localhost:3000). ● Add Data Source: ● In the left sidebar, click on Configuration > Data sources. ● Click Add data source. ● Select InfluxDB from the list. ● Configure InfluxDB Connection: ● URL: Enter http://localhost:8086 ● Database Type: Choose InfluxQL or Flux based on your setup. InfluxDB v2 typically uses Flux as the query language. ● Token: Paste the InfluxDB token you used to authenticate. ● Organization: Enter the name of your InfluxDB organization. ● Bucket: Select the bucket name where the sensor data is stored. ● Save & Test: Click Save & Test to ensure the connection is successful. Now you have the cloud SW installed. Next lab exercise we connect the RockPi as data source.