1、下载脚本
提前 github 创建认证秘钥,自行百度
wget -O nezha.sh https://raw.githubusercontent.com/lvgj-stack/nezha/master/script/install.sh && chmod +x ./nezha.sh && sudo ./nezha.sh
2、客户端脚本安装
wget -O nezha.sh https://raw.githubusercontent.com/lvgj-stack/nezha/master/script/install.sh && chmod +x ./nezha.sh && bash ./nezha.sh install_agent 38.49.xx.xxx 5555 NRpluMhOL8BvrCpxxxxx
wget https://github.com/nezhahq/agent/releases/download/v0.16.2/nezha-agent_linux_amd64.zipunzip nezha-agent_linux_amd64.zip
./nezha-agent -s 198.2.25:5555 -p diMceRzNLCazqUdhkY --tls -d
3、改图标
# 改标签页图标nano /opt/nezha/dashboard/theme-custom/template/header.html# 改掉head.png# <link rel="shortcut icon" type="image/png" href="../../static/theme-custom/head.png" />
# 改顶部菜单图标nano /opt/nezha/dashboard/theme-custom/template/menu.html# 改掉head.png# <img src="/static-custom/head.png">
4、Alpine 客户端安装
(1) 下载对应版本的可执行文件:
https://github.com/nezhahq/agent/releases
(2) 解压文件到特定文件夹并赋予执行权限:
chmod +x nezha-agent
(3) 创建开机自启服务:
nano /etc/init.d/nezha-agent
# 修改对应内容:
#!/sbin/openrc-runname="nezha agent"command="/opt/nezha/agent/nezha-agent" # 填写你解压出的文件对应的位置command_background=truecommand_args="-s servername:port -p token --tls" # 修改server名,端口和tokenpidfile="/run/${RC_SVCNAME}.pid"start_pre() { sleep 10}depend() {need netuse dns logger netmount}-(4) 启动服务:-chmod +x /etc/init.d/nezha-agentrc-service nezha-agent startrc-update add nezha-agent