Installation Guide for Raspberry Pi OS Lite (32-bit), marlinraker, nginx, and Fluidd
This guide covers setting up a complete Marlin 3D printer control stack on Raspberry Pi OS Lite (32-bit) using Node.js 20, marlinraker, ustreamer (as a standalone camera backend service replacing crowsnest), nginx (as a reverse proxy for WebSocket, API endpoints, and camera streams), and Fluidd.
1. Flash Raspberry Pi OS Lite (32-bit)
- Download Raspberry Pi OS Lite (32-bit) and write it to your SD card using Raspberry Pi Imager.
- Enable SSH (and optionally configure Wi-Fi, username, and password) in Raspberry Pi Imager before writing.
- Insert the SD card into the Raspberry Pi, boot it up, and connect over SSH:
ssh <username>@<ip-address>
2. Update the System and Install Base Packages (Including ustreamer)
Update package lists and installed packages, then install essential tools along with ustreamer (providing MJPEG stream and snapshot endpoints on port 8080 instead of crowsnest):
sudo apt update && sudo apt full-upgrade -y
sudo apt install -y git curl ca-certificates gnupg unzip nginx ustreamer build-essential
Verify the installed versions:
nginx -v
ustreamer --version
3. Install Node.js 20
Install Node.js 20 (including npm) before cloning and building marlinraker:
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x nodistro main" | sudo tee /etc/apt/sources.list.d/nodesource.list >/dev/null
sudo apt update
sudo apt install -y nodejs
Check that node (v20.x) and npm are available:
node -v
npm -v
4. Install and Configure marlinraker
Clone marlinraker into your working directory, install dependencies, and build the project:
mkdir -p ~/marlin
cd ~/marlin
git clone https://github.com/a1d3s/marlinraker.git
cd marlinraker
npm install
npm run build
Configure config/marlinraker.toml
Create or review config/marlinraker.toml with your web port, serial device, and baud rate:
cp config/marlinraker.example.toml config/marlinraker.toml 2>/dev/null || true
nano config/marlinraker.toml
Example configuration values:
#<include printer.toml>
[web]
port = 7127
cors_domains = []
[serial]
port = "/dev/ttyUSB1"
baud_rate = "250000"
max_connection_attempts = 5
connection_timeout = 5000
Create a systemd Service for marlinraker
Create /etc/systemd/system/marlinraker.service (adjust User and WorkingDirectory to match your setup):
sudo tee /etc/systemd/system/marlinraker.service >/dev/null <<'EOF'
[Unit]
Description=MarlinRaker Moonraker-compatible API for Marlin
After=network.target
[Service]
Type=simple
User=<username>
WorkingDirectory=/home/<username>/marlin/marlinraker
ExecStart=/usr/bin/npm start
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now marlinraker
systemctl status marlinraker --no-pager -l
5. Set Up ustreamer as a systemd Service
Run /usr/bin/ustreamer as a background service listening on 127.0.0.1:8080 so nginx and Fluidd can access the stream and snapshot endpoints reliably (adjust --device, --resolution, and --desired-fps as needed):
sudo tee /etc/systemd/system/ustreamer.service >/dev/null <<'EOF'
[Unit]
Description=uStreamer MJPEG Camera Streamer
After=network.target
[Service]
Type=simple
User=<username>
ExecStart=/usr/bin/ustreamer --device=/dev/video0 --host=127.0.0.1 --port=8080 --resolution=1280x720 --desired-fps=30
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now ustreamer
systemctl status ustreamer --no-pager -l
6. Install Fluidd
Download the latest Fluidd release archive and extract it into /home/<username>/fluidd before validating and reloading nginx:
mkdir -p /home/<username>/fluidd
cd /home/<username>/fluidd
curl -L "https://github.com/fluidd-core/fluidd/releases/latest/download/fluidd.zip" -o fluidd.zip
unzip -o fluidd.zip && rm fluidd.zip
Ensure nginx can traverse and read the Fluidd directory:
chmod 755 /home/<username> /home/<username>/fluidd
7. Configure nginx
If nginx was not installed earlier, install it now:
sudo apt update
sudo apt install -y nginx
Write /etc/nginx/sites-available/fluidd to serve Fluidd and proxy /websocket, Moonraker/MarlinRaker API routes, and /webcam/ (ustreamer on port 8080):
sudo tee /etc/nginx/sites-available/fluidd >/dev/null <<'EOF'
server {
listen 80 default_server;
listen [::]:80 default_server;
access_log /var/log/nginx/fluidd-access.log;
error_log /var/log/nginx/fluidd-error.log;
client_max_body_size 100M;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 4;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
location / {
root /home/<username>/fluidd;
index index.html;
try_files $uri $uri/ /index.html;
}
location = /index.html {
add_header Cache-Control "no-store, no-cache, must-revalidate";
}
location /websocket {
proxy_pass http://127.0.0.1:7127/websocket;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_read_timeout 86400;
}
location ~ ^/(printer|api|access|machine|server)/ {
proxy_pass http://127.0.0.1:7127$request_uri;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location /webcam/ {
proxy_pass http://127.0.0.1:8080/;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
EOF
Disable the default site, enable the Fluidd configuration, test syntax, and reload nginx:
sudo rm -f /etc/nginx/sites-enabled/default
sudo ln -sf /etc/nginx/sites-available/fluidd /etc/nginx/sites-enabled/fluidd
sudo nginx -t && sudo systemctl reload nginx
8. Configure Webcam URLs in Fluidd
Open http://<ip-address>/ in your browser to verify that Fluidd loads and connects to marlinraker over /websocket. Then configure the camera in Fluidd -> Settings -> Cameras:
- Stream URL:
/webcam/?action=stream - Snapshot URL:
/webcam/?action=snapshot