Introduction

WebThings Gateway is an open-source IoT platform that allows you to connect and monitor smart devices in your home. In this tutorial, we will guide you through the installation process of WebThings Gateway on Ubuntu Server.

Prerequisites

Step 1: Update package list

Before installing anything in Ubuntu, it's always a good practice to update the package list.

Run the following command to update the package list:

sudo apt update

Step 2: Install necessary dependencies

We need to install some dependencies before proceeding with the installation of WebThings Gateway. Run the following command to install them:

sudo apt install git curl build-essential nginx certbot python3-certbot-nginx

Step 3: Download and install WebThings Gateway

First, clone the WebThings Gateway repository from GitHub to your system by running the following command:

git clone --recursive https://github.com/WebThingsIO/gateway.git

Now, we will install the WebThings Gateway. Change to the downloaded gateway directory by running the command:

cd gateway

Next, run the following command to install the WebThings Gateway:

sudo ./setup.sh

The above command will install all the necessary dependencies, build the gateway add-on, and start the WebThings Gateway service.

Step 4: Configuring NGINX reverse proxy

We need to configure the NGINX reverse proxy to access the WebThings Gateway from a web browser.

Open the NGINX default configuration file in your preferred text editor:

sudo nano /etc/nginx/sites-available/default

Then, add the following lines to the file:

server {
        listen 80 default_server;
        listen [::]:80 default_server;

        server_name YOUR_IP_ADDRESS;

        location / {
                proxy_pass http://localhost:8080;
                proxy_set_header Host $host;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
}

Make sure to replace YOUR_IP_ADDRESS with the IP address of your system.

Save and close the file. Then, restart the NGINX service by running the following command:

sudo systemctl restart nginx

Step 5: Access WebThings Gateway

Open a web browser and navigate to http://YOUR_IP_ADDRESS.

You will be redirected to the NGINX HTTPS page. Click on the link that says "Proceed to YOUR_IP_ADDRESS" to access the WebThings Gateway login page.

Step 6: Configure SSL Certificate

To enable secure HTTPS access to your WebThings Gateway, you need to configure a SSL certificate.

Run the following command to set up a certificate with certbot:

sudo certbot --nginx -d YOUR_DOMAIN_NAME

Replace YOUR_DOMAIN_NAME with your domain name.

Follow the instructions provided by certbot to generate a certificate.

Conclusion

Congratulations! You have successfully installed WebThings Gateway on Ubuntu Server and configured it to use HTTPS with a SSL certificate. You can now connect and monitor your smart devices from the WebThings Gateway interface.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!