官方的安装命令:在国内有时候速度很慢,所以可以使用以下教程进行安装
curl -sSL https://download.technitium.com/dns/install.sh | sudo bash
在国内有时候速度很慢,所以可以使用以下教程进行安装
1.输入yum update -y,确保将系统升级到最新版本,然后重启
2.安装.NET7(Technitium DNS Server官方的一键脚本里面包含.NET的安装,但在国内比较慢,手动安装速度快得多了)
sudo yum install aspnetcore-runtime-8.0 -y
3.安装Technitium DNS Server(使用官方脚本会提示升级ASPNET,会非常慢,以下教程速度会快点。)
vi install.sh
按i
将以下代码复制,然后按esc,输入:wq,回车
#!/bin/sh dotnetDir="/opt/dotnet" if [ -d "/etc/dns/config" ] then dnsDir="/etc/dns" else dnsDir="/opt/technitium/dns" fi dnsTar="$dnsDir/DnsServerPortable.tar.gz" dnsUrl="https://download.technitium.com/dns/DnsServerPortable.tar.gz" mkdir -p $dnsDir installLog="$dnsDir/install.log" echo "" > $installLog echo "" echo "===============================" echo "Technitium DNS Server Installer" echo "===============================" echo "" echo "Downloading Technitium DNS Server..." if curl -o $dnsTar --fail $dnsUrl >> $installLog 2>&1 then if [ -d $dnsDir ] then echo "Updating Technitium DNS Server..." else echo "Installing Technitium DNS Server..." fi tar -zxf $dnsTar -C $dnsDir >> $installLog 2>&1 if [ "$(ps --no-headers -o comm 1 | tr -d '\n')" = "systemd" ] then if [ -f "/etc/systemd/system/dns.service" ] then echo "Restarting systemd service..." systemctl restart dns.service >> $installLog 2>&1 else echo "Configuring systemd service..." cp $dnsDir/systemd.service /etc/systemd/system/dns.service systemctl enable dns.service >> $installLog 2>&1 systemctl stop systemd-resolved >> $installLog 2>&1 systemctl disable systemd-resolved >> $installLog 2>&1 systemctl start dns.service >> $installLog 2>&1 rm /etc/resolv.conf >> $installLog 2>&1 echo "nameserver 127.0.0.1" > /etc/resolv.conf 2>> $installLog if [ -f "/etc/NetworkManager/NetworkManager.conf" ] then echo "[main]" >> /etc/NetworkManager/NetworkManager.conf echo "dns=default" >> /etc/NetworkManager/NetworkManager.conf fi fi echo "" echo "Technitium DNS Server was installed successfully!" echo "Open http://$(hostname):5380/ to access the web console." echo "" echo "Donate! Make a contribution by becoming a Patron: https://www.patreon.com/technitium" echo "" else echo "" echo "Failed to install Technitium DNS Server: systemd was not detected." exit 1 fi else echo "" echo "Failed to download Technitium DNS Server from: $dnsUrl" exit 1 fi bash install.sh,运行完就安装成功了。
4.放开防火墙对应的端口
firewall-cmd --permanent --add-port=5380/tcp firewall-cmd --permanent --add-port=53/tcp firewall-cmd --permanent --add-port=53/udp firewall-cmd --reload
5.打开http://你的服务器ip:5380/,就可以进行配置了。由于界面是全英文,不懂英文的可以通过翻译插件翻译后进行配置。