How To Install Modules in Ubuntu

Installing Ubuntu on a Raspberry Pi

Start by downloading the latest Ubuntu image.

Using a flashing tool like Balena Etcher for example, flash your SD card with the Ubuntu image.

KHM-052-01.png

You are going to do a headless setup as this is the quickest and easiest way with a Raspberry Pi. After the flashing has been completed, unplug and plug the SD card again as it has been automatically ejected. A "system-boot" partition should be visible, which should contain a file named "network-config". Open it up for editing and append the following lines to the end of it, where you replace "SSID" with your network's SSID and "password" with that network's password:

wifis:
  wlan0:
    dhcp4: true
    optional: true
    access-points:
      "SSID":
        password: "password"

Save the file and eject the SD card. Insert it in the Raspberry Pi and power it. After a brief wait, it should connect to your Wi-Fi network and obtain an IP address via DHCP.

Now the Pi can be accessed via SSH using the assigned IP Address with a tool like PuTTY for example. The default user name and password are 'ubuntu'.

You will be asked to change your password on the first boot, which will end with your session closing, so you need to open a new one. Now your Ubuntu is installed and ready to use.

KHM-052-02.png

Installing InfluxDB

Debian and Ubuntu users can install the latest stable version of InfluxDB using the apt-get package manager.

First, you need root access to add the influxDB repository so start with the command:

sudo su

Next, add the InfluxData repository with the following commands:

wget -qO- https://repos.influxdata.com/influxdb.key | gpg --dearmor > /etc/apt/trusted.gpg.d/influxdb.gpg
export DISTRIB_ID=$(lsb_release -si); export DISTRIB_CODENAME=$(lsb_release -sc)
echo "deb [signed-by=/etc/apt/trusted.gpg.d/influxdb.gpg] https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" > /etc/apt/sources.list.d/influxdb.list

Exit the root user.

exit

Install and start the InfluxDB service.

sudo apt-get update && sudo apt-get install influxdb
sudo service influxdb start

If you want InfluxDB to automatically start at boot, use the command listed. You will be asked for authentication via password.

systemctl enable --now influxdb

Finally, check the influxDB status.

sudo service influxdb status

The InfluxDB is now running and will start at boot, and it should show active, as shown in Figure 3.

KHM-052-03.png

Installing Grafana

This guide will show how to install Grafana on a Debian/Ubuntu system via the official APT repository. The method is convenient as it allows one to automatically update Grafana every time the apt-get update command is run.

Install the enterprise edition. Start by executing the set of commands below:

sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

Next, add the stable release repository:

echo "deb https://packages.grafana.com/enterprise/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

KHM-052-04.png

Update and install from the repository:

sudo apt-get update
sudo apt-get install grafana-enterprise

Once the procedure is complete, you should have output similar to the one in Figure 5.

KHM-052-05.png

You need to start the grafana-server process as the grafana user, which is created during the package installation. Execute the following command:

sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl status grafana-server

If the service starts normally, the output should be as in Figure 6.

KHM-052-06.png

Now, configure the Grafana server to start at boot.

sudo systemctl enable grafana-server.service

KHM-052-07.png

Installing Telegraf

Add the InfluxData repository with the following commands.

wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/lsb-release
echo "deb https://repos.influxdata.com/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable" | sudo tee /etc/apt/sources.list.d/influxdb.list

Install and start the Telegraf service.

sudo apt-get update && sudo apt-get install telegraf
sudo systemctl start telegraf

Check if the service is active using the command below.

sudo service telegraf status

If all went well, you will see what is shown in Figure 8:

KHM-052-08.png

vladislav-yordanov.jpg

Vladislav Yordanov

CCO of RAKwireless, Co-founder and CEO of IoT4Green. I believe technology can be the solution to most issues human kind is facing.

Updated