李光春

Debian安装SmartDNS带UI界面版本

· 李光春

效果图

Image Alt Text

Image Alt Text

前提条件

  • 文件存放在/root/smartdns目录下,请根据自己情况修改

下载需要的软件包

根据系统版本下载对应的版本

https://github.com/user-attachments/files/18922855/smartdns-with-webui-x86_64.tar.gz
https://github.com/user-attachments/files/18922865/smartdns-with-webui-aarch64.tar.gz
  • 解压文件
  • 复制旧的配置文件到/root/smartdns目录下,替换 smartdns.conf 文件 (根据需求选择是否替换)

准备服务文件

编辑 nano /lib/systemd/system/smartdns.service 文件

[Unit]
Description=SmartDNS Server
After=network.target
StartLimitBurst=0
StartLimitIntervalSec=60

[Service]
Type=forking
PIDFile=/root/smartdns/smartdns.pid
ExecStart=/root/smartdns/ld-linux.so --library-path /root/smartdns /root/smartdns/smartdns -c /root/smartdns/smartdns.conf -p /root/smartdns/smartdns.pid
Restart=always
RestartSec=2
TimeoutStopSec=15

[Install]
WantedBy=multi-user.target
Alias=smartdns.service
  • 具体程序参数请参考下方官方程序给出的解释
Usage: smartdns [OPTION]...
Start smartdns server.
  -f            run foreground.
  -c [conf]     config file.
  -p [pid]      pid file path, '-' means don't create pid file.
  -R            restart smartdns when crash.
  -S            ignore segment fault signal.
  -x            verbose screen.
  -v            display version.
  -h            show this help message.
Debug options:
  --cache-print [file] print cache.
Online help: https://pymumu.github.io/smartdns
Copyright (C) Nick Peng <[email protected]>

检查配置文件 smartdns.conf ,是否包含下面的配置

# 数据目录
data-dir /root/smartdns/db

# 启用 UI 插件
plugin /root/smartdns/libsmartdns_ui.so

# 设置 SmartDNS UI 的根目录
smartdns-ui.www-root /root/smartdns/www

赋值权限

chmod +x /root/smartdns/ld-linux.so
chmod +x /root/smartdns/smartdns

启动服务

systemctl daemon-reload
systemctl enable smartdns.service
systemctl start smartdns.service