记录下在Windows中如何远程将当前Windows部署成PVE
背景做这件事实属无奈公司另外一个分支的一个服务器(目前是Windows)需要跑多个平台的服务目前Windows Server上部署虚拟机直接装VMware workstation性能实在是糟糕迫不得已考虑远程(无显示器、无KVM)将Windows Server 2022重置成Debian 12再部署PVE8部署流程1. Windows上准备工作下载以下脚本和cygwin安装文件#国外可以使用这个URL下载脚本 https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.bat #国内可以用这个URL下载脚本 https://cnb.cool/bin456789/reinstall/-/git/raw/main/reinstall.bat #cygwin运行环境 https://www.cygwin.com/setup-x86.exe2. Windows上运行脚本把刚下载的reinstall.bat和setup-x86.exe放在同一个目录下然后使用管理员权限的CMD进入对应的目录执行命令.\reinstall.bat debian 12他会自动安装cygwin然后执行脚本下载并Debian12包务必注意如果是远程安装无法接显示器或者VNC的话请手工指定密码网络正常的话几分钟就可以下载完准安装包请注意下图箭头位置标识了后面登录会用到的用户名和密码此时如果重启机器就会自动开始安装Debian 12如果后悔不想装了根据提示输入命令: .\reinstall.bat reset 即可终止安装3. 登入Debian 12部署PVE8根据机器性能和网速等待一会就可以进入Debian 12了以我个人为例千兆网络大概3分钟装完可进入进入后输入以下命令安装部署PVE8#国外用户定义PVE源 echo deb [archamd64] http://download.proxmox.com/debian/pve bookworm pve-no-subscription /etc/apt/sources.list.d/pve-install-repo.list wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg #国内用户定义PVE源 wget https://mirrors.ustc.edu.cn/proxmox/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg echo deb https://mirrors.ustc.edu.cn/proxmox/debian bookworm pve-no-subscription /etc/apt/sources.list.d/pve-no-subscription.list #更新软件包并安装PVE内核 apt update apt full-upgrade apt install proxmox-default-kernel #重启系统 systemctl reboot4. 移除Debian内核官方说法是Proxmox VE 自带内核保留 Debian 默认内核可能会导致升级问题例如在 Debian 版本更新时。因此您必须移除默认的 Debian 内核#移除Debian内核 apt remove linux-image-amd64 linux-image-6.1* #更新并确认当前grub的配置 update-grub #建议移除 os-prober 软件包 (官方推荐) #os-prober 软件包会扫描主机上的所有分区以创建双启动 GRUB 条目。但扫描到的分区也可能包含分配给虚#拟机的分区而您肯定不希望将这些分区添加为启动项。如果您没有将 Proxmox VE 安装为与另一个操作系统双启动则可以安全地移除 os-prober 软件包 apt remove os-prober5. 登录PVE Web管理界面打开浏览器http(s)://IP:8006连入PVE的Web管理端用户是root密码是你的Linux设置的密码然后按照下图路径添加Linux网桥设置好网桥后就可以通过网桥地址管理PVE了如果你有多个网卡也可以创建多个网桥按需提供服务例如LAN、WAN、DMZ...在部署VM时候可以按需将一个或多个网桥分配给VM6. 遇到问题我做完1-5步后打不开8006端口的PVE Web管理端后来发现是PVE会检查Linux hosts文件如果遇到相同问题的同学请自行修改/etc/hosts文件把Linux的IP和localhost.proxmox做好映射#以下是我的hosts文件范例 cat /etc/hosts 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ff02::1 ip6-allnodes ff02::2 ip6-allrouters 192.168.85.128 localhost.proxmox localhost配置好hosts文件后运行命令进行验证一切正常的话就可以启动服务生成证书然后转回第5步配置网桥了。#以下是我的范例出现resolved说明OK了直接ctrl c退出调试继续下一步 /usr/bin/pmxcfs -f [main] notice: resolved node name localhost to 192.168.85.128 for default node IP address [libqb] info: server name: pve2 [main] notice: teardown filesystem [libqb] info: withdrawing server sockets [main] notice: exit proxmox configuration filesystem (0) #启动pve-cluster systemctl start pve-cluster #检查/etc/pve/目录下是否存在文件如果存在文件就说明工作正常如一个文件都没有就说明hosts有问题 ls -l /etc/pve/ total 0 lrwxr-xr-x 1 root www-data 0 Jan 1 1970 local - nodes/localhost lrwxr-xr-x 1 root www-data 0 Jan 1 1970 lxc - nodes/localhost/lxc lrwxr-xr-x 1 root www-data 0 Jan 1 1970 openvz - nodes/localhost/openvz lrwxr-xr-x 1 root www-data 0 Jan 1 1970 qemu-server - nodes/localhost/qemu-server #生成并更新证书 pvecm updatecerts -f Generating public/private rsa key pair. Your identification has been saved in /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub The key fingerprint is: SHA256:Ll2C3WJKkt/cIhrQtpg8xcarJiO5vdJxymw1Lkyy8is rootlocalhost The keys randomart image is: ---[RSA 4096]---- | | | | | | | . o . | | . X o S o | |..oB* B | | X*. * . | |E.Xo.o o . | |X*. | ----[SHA256]----- (re)generate node files generate new node certificate merge authorized SSH keys creating directory /etc/pve/firewall for observed files creating directory /etc/pve/ha for observed files creating directory /etc/pve/mapping for observed files creating directory /etc/pve/priv/acme for observed files creating directory /etc/pve/sdn for observed files creating directory /etc/pve/sdn/fabrics for observed files creating directory /etc/pve/virtual-guest for observed files7. 如果嫌弃部署的是PVE8而不是最新的PVE9那么请参考我另一个文章直升PVE9 吧https://blog.csdn.net/wanyf/article/details/150017597
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2450987.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!