鸽子的折腾日记②丨Klipper的安装

开始

首先,你需要一个装有Debian系操作系统(如Debian、Ubuntu、Raspbian、Armbian等)的设备(电脑、瘦客户机、树莓派、玩客云等等……)。
在瘦客户机、电脑等安装Debian的方法可以参考本人的这篇教程。

安装前的准备

安装必要软件

Klipper相关的软件需要Python等软件才能运行,且需要git来同步最新的Klipper等软件源代码,所以需要使用sudo apt install build-essential python3 python3-pip git来安装必要的软件。
安装好pip后,运行pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple更换pip的源。
也可以将链接替换为下列链接中的其中之一:

# 豆瓣源
https://pypi.doubanio.com/simple
# 腾讯源
https://mirrors.cloud.tencent.com/pypi/simple
# 阿里源
https://mirrors.aliyun.com/pypi/simple

如果使用树莓派,请删除/etc/pip.conf文件中的所有内容,否则可能会导致换源后下载依旧缓慢!

安装

在本教程中,我们使用KIAUH脚本来安装Klipper、Moonraker、Fluidd三件套。
首先,使用git clone https://github.com/th33xitus/kiauh下载KIAUH脚本。如果所在地的GitHub速度缓慢,可使用此镜像git clone https://gitee.com/miroky/kiauh或以下代理加速:

以下代理列表不再维护,不保证有效性。
国内用户强烈建议使用上面的gitee源下载或自行寻找有效的GitHub代理!

# 使用下列命令中的其中一个即可!
# 代理1
git clone https://hub.fgit.ml/th33xitus/kiauh
# 代理2
git clone https://gitclone.com/github.com/th33xitus/kiauh
# 代理3
git clone https://ghproxy.com/github.com/th33xitus/kiauh
# 代理4
git clone https://api.mtr.pub/th33xitus/kiauh

更换下载源

如果使用上文中提到的gitee源,请直接略过此步骤。

KIAUH使用GitHub来获取代码,在国内可能会导致下载缓慢。
获取到脚本后不要急着运行,cd进入kiauh目录后,先使用下列命令修改scripts/globals.sh中的地址,通过代理服务加速源代码的获取:

# 更换除 Klipper 下载链接的所有其他下载链接
sed -i '40,$s|https://github.com/|https://gitclone.com/github.com/|g' scripts/globals.sh
# 更改 Klipper 安装脚本中的链接处理部分,使其无论如何都使用 gitclone.com 作为加速源
sed -i 's|repo="https://github.com/${repo}"|repo="https://gitclone.com/github.com/${repo}"|g' scripts/klipper.sh
# 如果要安装 Mainsail 而不是 Fluidd ,请将下面两行中的 fluidd.sh 改为 mainsail.sh
sed -i 's/raw.githubusercontent.com/raw.0z.gs/g' scripts/fluidd.sh
sed -i 's/github.com/download.0z.gs/g' scripts/fluidd.sh

安装

Klipper

运行kiauh.sh,出现如下界面(可以看到所有软件都显示为Not Installed):


选择1) [Install]后,出现如下界面:

选择1) [Klipper]来安装Klipper。
首先是选择Python版本的界面,因Python 2早已停止维护,不建议使用Python 2环境安装,直接选择Python 3环境安装即可。

/=======================================================\
| Please select your preferred Python version.          |
| The recommended version is Python 3.x.                |
|-------------------------------------------------------|
|  1) [Python 3.x]  (recommended)                       |
|  2) [Python 2.7]  (legacy)                            |
|-------------------------------------------------------|
|                       B) « Back                       |
\=======================================================/
###### Select Python version:

下一步会询问安装Klipper的实例数量,连接几台打印机就安装几个实例,如果只连接一台打印机,只需安装一个即可。
这里以一台打印机为例,按回车继续。

###### Initializing Klipper installation ...
/=======================================================\
| Please select the number of Klipper instances to set  |
| up. The number of Klipper instances will determine    |
| the amount of printers you can run from this host.    |
|                                                       |
| WARNING:                                              |
| Setting up too many instances may crash your system.  |
|-------------------------------------------------------|
|                       B) « Back                       |
\=======================================================/
###### Number of Klipper instances to set up: 1

此时KIAUH便会开始Klipper的安装,只需稍作等待即可。
安装过程中需要更新系统并安装一些依赖软件,可能需要系统的管理员密码。
安装好Klipper后,可能会询问是否将当前用户加入ttydialout等用户组,用于解决可能无法连接下位机的问题,回车确认即可。

/=======================================================\
| WARNING: Your current user is not in group:           |
| ● tty                                                 |
| ● dialout                                             |
|                                                       |
| It is possible that you won't be able to successfully |
| connect and/or flash the controller board without     |
| your user being a member of that group.               |
| If you want to add the current user to the group(s)   |
| listed above, answer with 'Y'. Else skip with 'n'.    |
|                                                       |
| INFO:                                                 |
| Relog required for group assignments to take effect!  |
\=======================================================/
###### Add user '用户名' to group(s) now? (Y/n): 

Moonraker

在Installation Menu界面选择2) [Moonraker]即可开始安装。

###### Initializing Moonraker installation ...
[✓ OK] Klipper installation found!

###### Install Moonraker? (Y/n): 

回车安装,稍等片刻,安装完成后会显示Moonraker的IP地址:

#########################################################
 Moonraker has been set up! 
#########################################################

        Instance 1: 192.168.2.235:7125

使用浏览器访问此地址后,显示类似如下内容即表示安装成功:


Mainsail/Fluidd

以下提示均以安装Fluidd为例,Mainsail安装过程与Fluidd大同小异,故不再赘述。

Installation Menu界面中选择3) [Mainsail]4) [Fluidd]即可开始安装。
完成后会询问是否添加常用的gcode宏(脚本),一般情况下直接回车安装即可:

/=======================================================\
| It is recommended to have some important macros in    |
| your printer configuration to have Fluidd fully       |
| functional and working.                               |
|                                                       |
| The recommended macros for Fluidd can be found here:  |
| https://docs.fluidd.xyz/configuration/initial_setup   |
|                                                       |
| If you already have these macros in your config file, |
| skip this step and answer with 'no'.                  |
| Otherwise you should consider to answer with 'yes' to |
| add the recommended example macros to your config.    |
\=======================================================/
###### Add the recommended macros? (Y/n): 

这一步如果使用gitee源可能会直接下载失败,看可以去

等待片刻,Fluidd或Mainsail即可安装完成。
如果在已经登陆图形界面且带有浏览器的系统安装,可进入浏览器访问127.0.0.1localhost,网页加载成功即为完成安装。
如果在远程连接的系统上安装,可以在同一局域网下使用浏览器访问上位机的IP地址,查看网页是否加载成功。

加载成功的fluidd界面,出现报错是正常现象

Crowsnest(摄像头)

Installation Menu界面中选择11) [Crowsnest]即可开始安装。

如果使用gitee源,安装过程中可能会出现下载rtsp-simple-server失败的情况。如出现此情况,请在安装完成后询问是否重启的提示处选择不重启,按照以下步骤重新下载rtsp-simple-server后再重启上位机。
缺少此组件会导致Crowsnest无法启动

重新下载rtsp-simple-server

进入crowsnest/bin目录,打开其中的Makefile文件,找到DL_RTSP开头的行,将其修改为如下内容(即将原本的https://mos.1ntegral.xyz/gh/https://github.com/替换为https://download.fgit.ml,也可以把前面的部分删掉只保留https://github.com):

DL_RTSP = https://download.fgit.ml/aler9/rtsp-simple-server/releases/download/$(RTSP_VERSION)/

修改完成后,输入make命令,重新下载rtsp-simple-server。

你可能感兴趣的:(鸽子的折腾日记②丨Klipper的安装)