Update Nezha installation script URL

This commit is contained in:
naiba 2023-12-04 10:34:30 +08:00
parent 5e2d707c38
commit 6b7e607731
2 changed files with 103 additions and 76 deletions

View File

@ -4,23 +4,27 @@ outline: deep
**哪吒监控的被控端服务被称为 Agent本文档将介绍如何在被控端服务器上安装 Agent并与 Dashboard 连接**
::: tip
Agent 二进制文件仓库地址为:https://github.com/nezhahq/agent/releases
Agent 二进制文件仓库地址为:<https://github.com/nezhahq/agent/releases>
:::
## 一键安装 Agent
目前哪吒监控已支持在 Windows 和 Linux上一键安装 Agent遵循本文档的步骤你可以很轻松的在服务器上部署它
<br/>
### 准备工作
你需要提前在管理面板中设置好通信域名此域名不可以接入CDN这里以前面提到过的示例通信域名 “data.example.com” 来做演示
进入后台管理面板,转到“设置”页,在“未接入 CDN 的面板服务器域名/IP”项中填入通信域名然后点击"保存"
<br/>
### 在 Linux 中一键安装 (Ubuntu、Debian、CentOS)
* 首先在管理面板中添加一台服务器
* 点击新添加的服务器旁,绿色的 Linux 图标按钮,复制一键安装命令
* 在被控端服务器中运行复制的一键安装命令,等待安装完成后返回到 Dashboard 主页查看服务器是否上线
<br/>
### 在 Windows 中一键安装
* 首先在管理面板中添加一台服务器
@ -29,6 +33,7 @@ Agent 二进制文件仓库地址为https://github.com/nezhahq/agent/releases
* 如遇到确认「执行策略变更」请选择 Y
* 等待安装完成后返回 Dashboard 主页查看服务器是否上线
<br/>
<br/>
## 其他方式安装 Agent
@ -37,13 +42,17 @@ Agent 二进制文件仓库地址为https://github.com/nezhahq/agent/releases
* 首先在管理面板中添加一台服务器
* 在被控服务器中,运行脚本(位于中国大陆的服务器请使用镜像):
```bash
curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
```
如果你的被控服务器位于中国大陆,可以使用镜像:
````bash
curl -L https://jihulab.com/nezha/dashboard/-/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
curl -L https://gitee.com/naibahq/nezha/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
````
* 选择“安装监控 Agent”
* 输入通信域名”data.example.com“
* 输入面板通信端口RPC端口默认为 5555
@ -52,6 +61,7 @@ curl -L https://jihulab.com/nezha/dashboard/-/raw/master/script/install.sh -o ne
<br/>
### 在 其他 Linux 如 Alpine 使用 Openrc 的发行版 安装 Agent
本节内容由 [unknown0054](https://github.com/unknwon0054) 贡献
* 修改 SERVER、SECRET、TLS 然后在 shell 中执行
@ -139,21 +149,20 @@ EOF
rc-update add nezha-agent
```
### 在 Windows 中安装 Agent
- 请参考社区文章:
* 请参考社区文章:
[哪吒探针 - Windows 客户端安装](https://nyko.me/2020/12/13/nezha-windows-client.html)
<br/>
### 在 群晖DSM 中安装 Agent
- 请参考社区文章:
* 请参考社区文章:
[群晖 DSM 7.x 安装 哪吒监控 Agent](https://blog.mitsea.com/3929551d08bd4bb0a8baa453e2d92b0c/)
[哪吒探针——群晖客户端(被控端)安装教程](https://wl.gta5pdx.cn/archives/546/)
- Systemd 实现 *仅适用于 DSM7*:
* Systemd 实现 *仅适用于 DSM7*:
```sh
# 客户端路径
EXEC="/PATH/TO/nezha-agent"
@ -192,6 +201,7 @@ EOF
# 服务自启动
systemctl enable nezha
```
‼️修改对应信息后‼️
使用 `root` 账号执行上述命令即可安装完成
@ -199,16 +209,18 @@ EOF
<br/>
### 在 MacOS 中安装 Agent
***本节内容改编自 [Mitsea Blog](https://blog.mitsea.com/e796f93db38d49e4b18df234c6ee75f5),改编已获得原作者授权***
<br/>
::: warning
安装过程中如提示“macOS 无法验证此 app“请前往系统设置手动允许程序运行
:::
+ 首先在管理面板中添加一台服务器
+ 前往 [Release](https://github.com/nezhahq/agent/releases) 页下载 Agent 二进制文件,根据 CPU 架构选择下载 darwin amd64 还是 arm64 的 Agent
* 首先在管理面板中添加一台服务器
* 前往 [Release](https://github.com/nezhahq/agent/releases) 页下载 Agent 二进制文件,根据 CPU 架构选择下载 darwin amd64 还是 arm64 的 Agent
如 Intel CPU 下载 amd64Apple Silicon 下载 arm64 版本。下载完成后解压 Agent 二进制文件,如解压到下载文件夹
+ 新建一个名为 `nezha_agent.plist` 的文件并保存,修改文件内容如下:
* 新建一个名为 `nezha_agent.plist` 的文件并保存,修改文件内容如下:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@ -233,39 +245,51 @@ EOF
</dict>
</plist>
```
+ 在 Terminal 中使用下面的命令加载 plist 文件到 launchd 里,**注意替换文件路径**
```shell
launchctl load /Users/123/Desktop/nezha_agent.plist
```
+ 启动进程
```shell
launchctl start nezha_agent
```
+ 检查进程是否运行
```shell
launchctl list | grep nezha_agent
```
+ 停止进程并移除
```shell
launchctl stop nezha_agent
```
```shell
launchctl remove nezha_agent
```
<br/>
### 在 OpenWRT 中安装 Agent
**如何 一步到位,解决安装过程疑难杂症**
- 请参考项目:
* 请参考项目:
[NZ-OpenWrt](https://github.com/dysf888/NZ-OpenWrt)
<br/>
**如何使 旧版 OpenWRT/LEDE 自启动**
- 请参考项目:
* 请参考项目:
[哪吒监控 For OpenWRT](https://github.com/Erope/openwrt_nezha)
<br/>
**如何使 新版 OpenWRT 自启动?来自 @艾斯德斯**
* 首先在 release 下载对应的二进制解压 zip 包后放置到 `/root`
* 运行 `chmod +x /root/nezha-agent` 赋予执行权限,然后创建 `/etc/init.d/nezha-service`
@ -296,10 +320,13 @@ restart() {
* 运行 `chmod +x /etc/init.d/nezha-service` 赋予执行权限
* 启动服务: `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start`
<br/>
<br/>
## FAQ
### Agent 有 Docker 镜像吗?
**Agent 目前没有推出 Docker 镜像。**
Agent 的设计思路和 Dashboard 相反Dashboard 要尽可能不影响宿主机工作,但 Agent 则需要在宿主机中执行监控服务和运行命令。
将 Agent 放入容器中确实可以继续执行监控任务,但 WebShell 等功能无法正常运行,因此不提供 Docker 镜像。

View File

@ -48,7 +48,7 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh
```
如果你的面板服务器位于中国大陆,可以使用镜像:
````bash
curl -L https://jihulab.com/nezha/dashboard/-/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
curl -L https://gitee.com/naibahq/nezha/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
````
* 等待Docker安装完毕后分别输入以下值