Manual setup

Operating System

Don’t forget to enable SSH and configure a network if using Wi-Fi.

It is recommended to use a clean Raspberry Pi OS 64-bit Lite image. If you don't use a Raspberry Pi as SBC, every default Debian Bullseye / Bookworm (recommended) should also fit with this guide.

We recommend you follow the Raspberry Pi OS official documentation to flash and install the operating system to your SD card.

Once you have finished the installation and are connected via SSH, you can continue.

Requirements

Install the required packages and update the system:

sudo apt update && sudo apt upgrade -y
sudo apt install git unzip

Klipper

Installation

At first we have to install some OS dependencies:

The following commands will clone Klipper to an appropriate directory in HOME.

Then we can initialize the python virtual environment and install the python dependencies:

Configuration & startup service

After Klipper is installed, you will need to create the file structure for Klipper & Moonraker.

To create a service file for Klipper use:

fill in these lines:

Save the file with CTRL+O and close the editor with CTRL+X.

Next step, you have to create an Klipper environment file in your printer_data:

fill in these line:

Save the file with CTRL+O and close the editor with CTRL+X.

Please check and modify the username! If you do not use the user pi, you must replace it in each path and in the variable User in the service file.

To enable and start the Klipper service execute these commands:

After your config is in place, restart Klipper with sudo systemctl start klipper.

Moonraker

Moonraker is a web server that exposes APIs which lets Mainsail interact with Klipper.

Installation

At first we have to install some OS dependencies:

Clone Moonraker into your HOME directory:

Then we can initialize the python virtual environment and install the python dependencies:

Configuration

For Moonraker you’ll need to create a separate config file.

Insert the following part:

This is a very basic config For more options and detailed explanations you should follow Moonraker’s instructions.

Save the file with CTRL+O and close the editor with CTRL+X.

Startup service

To edit this file type:

fill in these lines:

Save the file with CTRL+O and close the editor with CTRL+X.

Next step, you have to create an Klipper environment file in your printer_data:

fill in these lines:

Save the file with CTRL+O and close the editor with CTRL+X.

Please check and modify the username! If you do not use the user pi, you must replace it in each path and in the variable user in the service file.

To enable Moonraker service execute these commands:

Then we have also to add some Moonraker PolicyKit rules. Moonraker already provides a script for these:

After your config is in place, start Moonraker with sudo systemctl start moonraker.

Open the following URL with your printers IP in your browser

If everything has been set up successfully, a message like this should appear:

Mainsail

Install web server & reverse proxy (NGINX)

NGINX is important to mount all components on port 80 and host the static files from Mainsail. To install NGINX you only need to execute:

now we create the config files with:

Each file can be filled with the following content:

Save the file with CTRL+O and close the editor with CTRL+X.

Save the file with CTRL+O and close the editor with CTRL+X.

Save the file with CTRL+O and close the editor with CTRL+X.

Create the directory for static files and active NGINX config:

Now you can recheck the API to see if it works with the reverse proxy. Open the URL http://<printer-ip>/server/info in your browser. If you see content like this:

Now we can install Mainsail.

Install httpdocs

Now you can download the current Mainsail static data.

Now it should be possible to open the interface: http://<printer-ip>/.

Important macros

If you want the whole experience with Mainsail and Klipper virtual_sdcard print, you should use these macros or use them as templates for your own.

Macro Link

Use hostname instead of IP to open Mainsail (optional)

To use the hostname instate of the IP, you can install the avahi-daemon:

sudo apt install avahi-daemon

And you can config your hostname:

sudo raspi-config

In 2 Network Options > N1 Hostname, you can edit the hostname of your Raspberry Pi. After a reboot, you can use http://<hostname>.local/ to open the web interface.

Last updated

Was this helpful?