起初是用的 Rocky 搭建 的,刚开始用起来还好,慢慢的时间长了。我发现 Adguard 的处理速度一直保持在10ms左右就是下不去。IPV6的私有地址经常访问不通。考虑可能是系统的关系,尝试采用主流的 Debian 试一下。
搭建服务
系统安装的是 Debian 11 ,过程简单,这里略过。
系统设置
设置静态ip
# 安装 vim 用来编辑一些文件
apt install vim
# 让 reboot poweroff 这些命令可用
vim /etc/profile
# 在 export PATH 添加下面一行
export PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin
# 编辑网络配置文件
vim /etc/network/interfaces
# 照着修改下面
iface ens3 inet static
address 192.168.10.20
netmask 255.255.255.0
gateway 192.168.10.1
# 修改DNS
vim /etc/resolv.conf
114.114.114.114
允许 root 账户直接 ssh 登陆(可选)
vim /etc/ssh/sshd_config
修改
PermitRootLogin yes
PermitEmptyPasswords yes
GSSAPIAuthentication no
删除用户(可选)
deluser -remove-all-files zhe
安装 Docker
apt install curl
apt install gnupg
curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
echo \
"deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://mirrors.aliyun.com/docker-ce/linux/debian \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt update
# 安装 Dcoker
apt install docker-ce
# 让 Docker 支持 IPV6
vim /etc/docker/daemon.json
{
"ipv6": true,
"fixed-cidr-v6": "2001:db8:1::/64",
"experimental": true,
"ip6tables": true
}
# 启动 Docker
systemctl start docker
配置IPV6
# 临时添加地址(注意网卡名 ens3 )
ip address add dev ens3 fc00::20/64
# 添加到开机脚本里
# 添加文件 etc/rc.local 给权限
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
ip address add dev ens3 fc00::20/64
exit 0
安装 radvd
apt install radvd
cp /usr/share/doc/radvd/examples/simple-radvd.conf /etc/radvd.conf
vim /etc/radvd.conf
# 添加
interface ens3
{
AdvSendAdvert on;
MinRtrAdvInterval 30;
MaxRtrAdvInterval 100;
prefix fc00::/64
{
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
};
安装一些Docker服务
# 拉 nginx 镜像
docker pull nginx
# 安装 nginx 镜像
docker run --name Nginx \
-v /docker/nginx/config:/etc/nginx/conf.d \
-v /docker/nginx:/usr/share/nginx \
--network=host \
--restart=always \
-d nginx
docker run --name AdGuardHome \
-v /docker/adguardhome/workdir:/opt/adguardhome/work \
-v /docker/adguardhome/confdir:/opt/adguardhome/conf \
-p 53:53/tcp -p 53:53/udp \
-p 8989:8989/tcp \
-p 1443:443/tcp \
-p 853:853/tcp \
-p 784:784/tcp \
--restart=always \
-d adguard/adguardhome
docker run --name HomeAssistant \
-v /docker/homeassistant/config:/config \
--network=host \
--restart=always \
-d homeassistant/home-assistant:latest
docker run -d \
--name Watchtower \
--restart always \
-v /var/run/docker.sock:/var/run/docker.sock \
-e TZ=Asia/Shanghai \
containrrr/watchtower \
--cleanup \
--schedule "0 0 3 1 * ?"
# 查看日志
docker logs Watchtower -f
Comments | NOTHING