jhtone
jhtone
发布于 2024-10-05 / 8 阅读
1
0

[哪吒面板] 解决国内鸡无法下载/安装哪吒面板代理端核心问题

了解哪吒面板代理端文件分布

以下内容来自nezha.sh

NZ_BASE_PATH="/opt/nezha"
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"

1. "/opt/nezha" 为面板核心的存放目录,包括Dashboard 和 Agent

2. "/opt/nezha/agent" 结合上文,此目录就为代理端核心文件的存放位置

3. "/etc/systemd/system/nezha-agent.service" 
    对Liunx系统比较熟悉的小伙伴就会知道这个文件决定的哪吒代理端的开机启动

了解了以上内容我们就可以很轻易的不依赖外部的网络来部署哪吒探针代理端了

操作步骤

1. 请自行从 https://api.github.com/repos/nezhahq/agent/releases/latest 上下载nezha-agent到本地,注意无后缀,这是个二进制文件

2. 在服务器上创建 "/opt/nezha/agent" 目录,将nezha-agent放入

3. 将以下代码替换成自己的服务器地址与密钥

[Unit]
Description=Nezha Agent
After=syslog.target
#After=network.target
#After=nezha-dashboard.service

[Service]
# Modify these two values and uncomment them if you have
# repos with lots of files and get an HTTP error 500 because
# of that
###
#LimitMEMLOCK=infinity
#LimitNOFILE=65535
Type=simple
User=root
Group=root
WorkingDirectory=/opt/nezha/agent/
ExecStart=/opt/nezha/agent/nezha-agent -s IP地址:5555 -p 密钥
Restart=always
#Environment=DEBUG=true

# Some distributions may not support these hardening directives. If you cannot start the service due
# to an unknown option, comment out the ones not supported by your version of systemd.
#ProtectSystem=full
#PrivateDevices=yes
#PrivateTmp=yes
#NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

4. 在 "/etc/systemd/system/" 目录新建一个nezha-agent.service文件,将替换完成的代码保存进其中

5. 确认以上工作全部完成以后,在终端运行以下命令

  systemctl daemon-reload
  systemctl enable nezha-agent
  systemctl restart nezha-agent

6. 静待面板探针上线


评论