How can we help?
Categories
< All Topics
Print

Installing and Configuring Node-RED for IoT Projects on ServerStadium

This tutorial will guide you through setting up Node-RED on a ServerStadium VM or dedicated server, which is ideal for developing and managing IoT applications.

Prerequisites

Step 1: Set Up Your ServerStadium VM or Dedicated Server

  1. Server Selection and Setup: Choose a VM or dedicated server from ServerStadium. For most IoT projects, a small to medium-sized VM will suffice.
  2. Initial Server Configuration: Connect to your server via SSH. Update and upgrade your system:

    sudo apt update
    sudo apt upgrade

Step 2: Install Node.js

Node-RED is built on Node.js. Install Node.js on your server:

  1. Add Node.js Repository:

    curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash –

  2. Install Node.js:

    sudo apt install -y nodejs

  3. Verify Installation:

    node –version
    npm –version

Step 3: Install Node-RED

Install Node-RED using npm:

sudo npm install -g –unsafe-perm node-red

Step 4: Start Node-RED

Start Node-RED:

node-red


Node-RED will now be running on your server on port 1880.

Step 5: Access Node-RED

Access Node-RED by navigating to http://your_server_ip:1880 in your web browser.

Step 6: Secure Node-RED

It’s essential to secure your Node-RED editor, especially if it’s accessible over the Internet:

  1. Stop Node-RED:If Node-RED is running, stop it with Ctrl+C in your terminal.
  2. Secure with a Password:Run the following command to generate a password hash:

    node-red-admin hash-pw


    Enter your desired password and copy the generated hash.
  3. Edit Node-RED Settings:Edit the Node-RED settings file:

    nano ~/.node-red/settings.js


    Under the adminAuth section, set up a user with your hashed password:

    adminAuth: {
    type: "credentials",
    users: [{
    username: "admin",
    password: "your_hashed_password",
    permissions: "*"
    }]
    }

  4. Restart Node-RED:

    node-red

Step 7: Configure for IoT Projects

  1. Install Additional Nodes: Depending on your IoT project, you may need additional nodes (like MQTT, HTTP, or WebSocket). These can be installed via the Node-RED palette manager in the web interface.
  2. Flow Configuration: Create and configure flows to process data from your IoT devices, integrate with various services, or execute automation tasks.

Conclusion

Your Node-RED instance is now set up and secured on a ServerStadium server, ready for IoT projects. You can build and manage complex IoT workflows using its intuitive interface.

For additional assistance, visit our knowledge base or contact our support team.

Table of Contents