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
- A ServerStadium VM or dedicated server. Review the options at ServerStadium VM Pricing and Dedicated Servers.
- Basic knowledge of Linux and networking.
Step 1: Set Up Your ServerStadium VM or Dedicated Server
- Server Selection and Setup: Choose a VM or dedicated server from ServerStadium. For most IoT projects, a small to medium-sized VM will suffice.
- 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:
- Add Node.js Repository:
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash –
- Install Node.js:
sudo apt install -y nodejs
- 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:
- Stop Node-RED:If Node-RED is running, stop it with
Ctrl+C
in your terminal. - 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. - Edit Node-RED Settings:Edit the Node-RED settings file:
nano ~/.node-red/settings.js
Under theadminAuth
section, set up a user with your hashed password:
adminAuth: {
type: "credentials",
users: [{
username: "admin",
password: "your_hashed_password",
permissions: "*"
}]
} - Restart Node-RED:
node-red
Step 7: Configure for IoT Projects
- 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.
- 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.