Debian 12 初始化配置(一)时区设置和vnSTAT流量统计

64 5~7 分钟

时区和对时校准

1、时区变更并确认生效

timedatectl set-timezone Asia/Shanghai && timedatectl status

2、安装自动对时

apt update && apt install systemd-timesyncd

3、自动对时开机启动并确认生效

systemctl enable --now systemd-timesyncd && timedatectl set-ntp true && timedatectl status

安装流量统计vnSTAT

1、拉取源码

apt update && apt install -y git build-essential && apt install -y libsqlite3-dev && git clone https://github.com/vergoh/vnstat.git

2、编译

cd vnstat && ./configure && make && make install

3、建立流量统计任务守候

nano /etc/systemd/system/vnstat.service

3.1、守候任务文档

[Unit]
Description=vnStat network traffic monitor
After=network.target

[Service]
ExecStart=/usr/local/sbin/vnstatd -n
Restart=on-failure

[Install]
WantedBy=multi-user.target

3.2、建立软连接

sudo ln -s /usr/local/bin/vnstat /usr/bin/vnstat

3.3、修改vnSTAT配置文件

nano /usr/local/etc/vnstat.conf

3.4、启动vnSTAT和状态检查

systemctl daemon-reload && systemctl enable vnstat && systemctl start vnstat && systemctl status vnstat


上一篇 Debian 12 初始化配置(二)安装ServerStatus和Tailscale