与你分享
互联网的方方面面

【转载】记录一下狗云独服安装pve7升级到8流程

前提

  • 终于收到狗云CQ.A特价独服,安装了pve7
  • 只有公网
  • 已安装哪吒监控
  • 已安装tailscale

升级前操作

更新源

# /etc/apt/sources.list 系统源
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free
deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

# /etc/apt/sources.list.d/pve-no-subscription.list 移除企业源
deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian/pve bullseye pve-no-subscription

更新系统及pve到最新版本

apt update
apt upgrade -y
apt dist-upgrade -y
pveversion

升级系统

# 替换 bullseye 为 bookworm
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list
sed -i 's/bullseye/bookworm/g' /etc/apt/sources.list.d/*.list
# 这个可选,Debian12新增
sed -i 's/non-free/non-free non-free-firmware/g' /etc/apt/sources.list

# 升级系统
apt update
apt upgrade -y
apt dist-upgrade -y

其他一路默认即可,安装完成重启。

重启完成后可以考虑

apt autoclean
apt autoremove -y

配置PVE

NAT 网络配置

登录 Proxmox VE 后台,选择系统 -> 网络,然后点击创建 -> Linux Bridge。

填写 IP 和子网掩码,IP 地址填写个局域网的网段地址就行。其他项目不用填也不用改,保持默认。

IP 地址填写一个局域网地址:192.168.99.1/24 ,创建完成后应用配置。

然后登录服务器 编辑 /etc/network/interfaces(编辑前先备份),然后在对应的 vmbr1 后面修改成相应的配置

auto vmbr1
iface vmbr1 inet static
	address 192.168.99.1/24
	bridge-ports none
	bridge-stp off
	bridge-fd 0
        post-up echo 1 > /proc/sys/net/ipv4/ip_forward
        post-up iptables -t nat -A POSTROUTING -s '192.168.99.0/24' -o vmbr0 -j MASQUERADE
        post-down iptables -t nat -D POSTROUTING -s '192.168.99.0/24' -o vmbr0 -j MASQUERADE

重启网络, 如果失联了,请申请vnc查看默认路由是否有问题 ip r

systemctl restart networking

DHCP 配置

避免每次都需要手动配置, 安装本地dhcp服务,安装过程中会提示启动失败,是正常的,需要调整2个配置文件

apt install isc-dhcp-server -y

修改 /etc/default/isc-dhcp-server ,将 INTERFACESv4 调整为 vmbr1 也就是要需要DHCP 的那个 Linux Bridge

修改 /etc/dhcp/dhcpd.conf dhcp具体配置

option domain-name "pve.local";
option domain-name-servers 121.4.4.123,120.53.53.38;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
log-facility local7;
subnet 192.168.99.0 netmask 255.255.255.0 {
  range 192.168.99.10 192.168.99.200;
  option subnet-mask 255.255.255.0;
  option domain-name-servers 121.4.4.123,120.53.53.38;
  option domain-name "pve.local";
  option routers 192.168.99.1;
  option netbios-name-servers 192.168.99.1;
  option netbios-node-type 8;
  get-lease-hostnames true;
  use-host-decl-names true;
  default-lease-time 600;
  max-lease-time 7200;
  interface vmbr0;
}

编辑完成后对比 cat /etc/dhcp/dhcpd.conf | grep -vE '(^#|^$)'

然后重启服务

systemctl restart isc-dhcp-server

测试

创建一个小鸡测试看看

其他

内网打通

由于我已经使用tailscale组网了,需要重新调整一下

tailscale down
tailscale up --accept-dns=false --accept-routes  --advertise-routes 192.168.99.0/24

禁止8006公网访问

iptables -A INPUT -p tcp --dport 8006 -s 10.0.0.0/8 -j ACCEPT
iptables -A INPUT -p tcp --dport 8006 -s 172.16.0.0/12 -j ACCEPT
iptables -A INPUT -p tcp --dport 8006 -s 192.168.0.0/16 -j ACCEPT
# tailscale 官方
# iptables -A INPUT -p tcp --dport 8006 -s 100.64.0.0/10 -j ACCEPT
iptables -A INPUT -p tcp --dport 8006 -j DROP

将上面的保存为一个脚本8006.sh

chmod +x /root/scripts/8006.sh

开机设置

cat /etc/rc.local
#!/bin/bash

/root/bin/8006.sh || true

exit 0

到这里就水完了。

原文:https://www.nodeseek.com/post-16307-1

赞(0)
版权声明:本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权
文章名称:《【转载】记录一下狗云独服安装pve7升级到8流程》
文章链接:https://wph.im/249.html
本站资源仅供个人学习交流,请于下载后24小时内删除,不允许用于商业用途,否则法律问题自行承担。

相关推荐

  • 暂无文章