添加 macOS 上 Homebrew 服务安装方式 (#66)

This commit is contained in:
Mrered Cio 2024-05-03 03:47:31 +08:00 committed by GitHub
parent b4866847f8
commit d51f0f4ba1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 104 additions and 0 deletions

View File

@ -243,6 +243,58 @@ launchctl remove nezha_agent
``` ```
<br/> <br/>
Using Homebrew to install the Agent on macOS
The content of this section is adapted from [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew), with the permission of the original author.
* Adding the Homebrew third-party repository
As the package has not yet been submitted to the official Homebrew Core repository, it is currently available in the third-party Homebrew repository maintained by the author of the blog mentioned above.
```sh
brew tap brewforge/chinese
```
* Installing the Nezha Agent
```sh
brew install nezha-agent
```
* Adding environment variables
```sh
echo 'export HOMEBREW_NEZHA_AGENT_PASSWORD="your key, obtained from your service page"' >> ~/.zshrc
echo 'export HOMEBREW_NEZHA_AGENT_SERVER="your server and port, in the format your.domain:5555"' >> ~/.zshrc
source ~/.zshrc
```
* Starting the Nezha Agent service through Homebrew
```sh
brew services start nezha-agent
```
* Checking the service status
```sh
brew services info nezha-agent
```
* Stopping the service
```sh
brew services stop nezha-agent
```
* Uninstalling the Nezha Agent
```sh
brew rm nezha-agent
```
<br/>
### Installing Agent on OpenWRT ### Installing Agent on OpenWRT
**How to solve various problems during the installation process in one step** **How to solve various problems during the installation process in one step**
- Please refer to the project: - Please refer to the project:

View File

@ -279,6 +279,58 @@ launchctl remove nezha_agent
<br/> <br/>
### 在 macOS 中使用 Homebrew 安装 Agent
***本节内容改编自 [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew),改编已获得原作者授权***
* 添加 Homebrew 第三方仓库
***由于暂未提交到 Homebrew Core 官方库,暂时放在上述博客作者参与维护的第三方 Homebrew 仓库中***
```sh
brew tap brewforge/chinese
```
* 安装 Nezha Agent
```sh
brew install nezha-agent
```
* 添加环境变量
```sh
echo 'export HOMEBREW_NEZHA_AGENT_PASSWORD="你的密钥,在你的服务页面获取"' >> ~/.zshrc
echo 'export HOMEBREW_NEZHA_AGENT_SERVER="你的服务器和端口,格式 your.domain:5555 "' >> ~/.zshrc
source ~/.zshrc
```
* 通过 Homebrew 启动 Nezha Agent 服务
```sh
brew services start nezha-agent
```
* 检查服务状态
```sh
brew services info nezha-agent
```
* 停止服务
```sh
brew services stop nezha-agent
```
* 卸载 Nezha Agent
```sh
brew rm nezha-agent
```
<br/>
### 在 OpenWRT 中安装 Agent ### 在 OpenWRT 中安装 Agent
**如何 一步到位,解决安装过程疑难杂症** **如何 一步到位,解决安装过程疑难杂症**