6

PVE安装和初始设置

 1 year ago
source link: https://hugo.111520.xyz/posts/2023-07-05-pve-setting/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

PVE 安装

PVE: 全称 Proxmox Virtual Environment,开源的虚拟化管理平台。它基于 Debian Linux 操作系统,并集成了 KVM 和 LXC 两种虚拟化技术,可以帮助用户快速搭建和管理虚拟化环境。

  1. 直接官网下载最新镜像 iso,选择 iso images。

    https://s3.bmp.ovh/imgs/2023/07/07/f94d45ba6b9ae6e7.png
  2. 用 U 盘做一个启动盘,注意如果用 rufus 工具的话,记得用 dd 模式,否则下个步骤会无法识别。 其他工具 balenaEtcher,使用也很简单,选择镜像,选择 u 盘,制作即可,注意制作过程可能会有弹窗,点取消就行。

    https://s3.bmp.ovh/imgs/2023/07/07/d34ba2dea988931a.png
  3. 主板 Bios 选择 U 盘的 UEFI 启动。

  4. 进入界面,选第一个 install promox VE,选择安装位置,选择地区(china),设置密码和邮箱,设置网络,开始安装。安装后会启动进入系统,用户 root,密码为刚才设置的密码。启动后会显示 IP,在同个局域网内可通过浏览器访问,注意是 https 而非 http。

    https://s3.bmp.ovh/imgs/2023/07/07/bc1b38bbcaf904a1.png

nano 编辑器简单介绍

一般 linux 发行版都内置了 nano,vi 编辑器,对新手而言 nano 更友好,vi 的使用习惯不太一样。

如系统没内置自行安装一下。

CentOS 系统:

yum install -y nano

Debian/Ubuntu 系统:

apt-get install -y nano

nano 编辑器语法简单介绍:

nano <文件名或文件绝对路径>

打开文件,文件不存在则新建

示例:
nano  xx.conf
nano  /xxx/xxx/xx.conf

打开后即可直接编辑,上下左右方向键可直接移动光标,选中可以进行复制,编辑,粘贴等,注意 pve 浏览器管理台中 shell 只能通过鼠标右键复制粘贴,不支持 ctrl+c/v。

底部有快捷键说明,^G 即为 Ctrl+G ,功能为显示帮助文本。

  • Ctrl+G,显示帮助文本
  • Ctrl+O,保存当前文件
  • Ctrl+R,读取其他文件并插入光标位置
  • Ctrl+Y,跳至上一屏幕
  • Ctrl+K,剪切当前一行
  • Ctrl+C,显示光标位置
  • Ctrl+X,退出编辑文本
  • Ctrl+J,对其当前段落(以空格为分隔符)
  • Ctrl+W,搜索文本位置
  • Ctrl+V,跳至下一屏幕
  • Ctrl+U,粘贴文本至光标处
  • Ctrl+T,运行拼写检查
  • Ctrl+_,跳转到某一行
  • ALT+U,撤销
  • ALT+E,重做
  • ALT+Y, 语法高亮
  • ALT+#,显示行号

编辑修改后,保存 ctrl+o,退出 ctrl+X,如没有保存直接退出 ctrl+x 时会弹出提示是否保存,按 y 或 n 进行保存退出或不保存退出。

笔记本 pve 合盖子不休眠设置

浏览器进入 pve 管理后台,shell,命令行界面,

编辑文件:nano /etc/systemd/logind.conf

**参数说明**
#HandlePowerKey 按下电源键后的行为,默认power off

#HandleSleepKey 按下挂起键后的行为,默认suspend

#HandleHibernateKey按下休眠键后的行为,默认hibernate

#HandleLidSwitch合上笔记本盖后的行为,默认suspend(改为ignore;即合盖不休眠)在原文件中,还要去掉前面的#

下面是修改后的 pve 源文件


#  This file is part of systemd.

#  systemd is free software; you can redistribute it and/or modify it

#  under the terms of the GNU Lesser General Public License as published by

#  the Free Software Foundation; either version 2.1 of the License, or

#  (at your option) any later version.

#

# Entries in this file show the compile time defaults.

# You can change settings by editing this file.

# Defaults can be restored by simply deleting this file.

#

# See logind.conf(5) for details.

  

[Login]

#NAutoVTs=6

#ReserveVT=6

#KillUserProcesses=no

#KillOnlyUsers=

#KillExcludeUsers=root

#InhibitDelayMaxSec=5

#UserStopDelaySec=10

#HandlePowerKey=poweroff

#HandleSuspendKey=suspend

#HandleHibernateKey=hibernate

HandleLidSwitch=ignore   #改这行

#HandleLidSwitch=suspend

#HandleLidSwitchExternalPower=suspend

#HandleLidSwitchDocked=ignore

#HandleRebootKey=reboot

#PowerKeyIgnoreInhibited=no

#SuspendKeyIgnoreInhibited=no

#HibernateKeyIgnoreInhibited=no

#LidSwitchIgnoreInhibited=yes

#RebootKeyIgnoreInhibited=no

#HoldoffTimeoutSec=30s

#IdleAction=ignore

#IdleActionSec=30min

#RuntimeDirectorySize=10%

#RuntimeDirectoryInodes=400k

#RemoveIPC=yes

#InhibitorsMax=8192

#SessionsMax=8192

设置 pve 每次重启后立即进入系统

pve 每次重启后停留在 进入 pve / 高级选项 / 进入 boot 页等选项页,而不是直接进入系统的解决方法。

编辑 GRUB 配置文件并更新 GRUB 引导程序:

  1. 以 root 用户身份登录到 PVE 服务器。
  2. 打开 GRUB 配置文件(/etc/default/grub)并使用文本编辑器进行编辑。例如,您可以使用 nano 编辑器打开该文件:
nano /etc/default/grub
  1. 在 GRUB 配置文件中找到 GRUB_TIMEOUT 选项,并将其值设置为 0,以使系统在启动时自动选择默认内核并立即启动。例如:
GRUB_TIMEOUT=0
  1. 更新 GRUB 引导程序以使更改生效。运行以下命令:
update-grub
reboot

更换国内软件源

更新通用软件源为清华源

nano /etc/apt/sources.list

添加以下,同时注释原有的,在其前面加#


deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free

#deb-src 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-src 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-src 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

#deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

更新企业订阅为免费源

nano /etc/apt/sources.list.d/pve-enterprise.list

添加以下,同时注释原有的,在其前面加#

deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription

apt install apt-transport-https ca-certificates

更换 CT Templates (LXC 容器) 源

将 /usr/share/perl5/PVE/APLInfo.pm 文件中默认的源地址 http://download.proxmox.com 替换为 https://mirrors.tuna.tsinghua.edu.cn/proxmox 即可。

可以使用如下命令修改:


cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm_back
sed -i 's|http://download.proxmox.com|https://mirrors.tuna.tsinghua.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm

针对 /usr/share/perl5/PVE/APLInfo.pm 文件的修改,重启后生效。

systemctl restart pvedaemon.service

https://s3.bmp.ovh/imgs/2023/07/07/d18cd8770007be48.png

去除无效订阅弹窗

https://s3.bmp.ovh/imgs/2023/07/07/1bd5889ca3f83dbb.png

修改文件在这个路径:/usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js

可以通过 ssh

用 nano 命令直接修改

nano /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js

https://s3.bmp.ovh/imgs/2023/07/07/3c142a1a5f456f8b.png

按 ctrl+w 或 F6 搜索 “data.status”,将整个 if 条件改为 false,注意需要保证这两快捷键不被其他软件占用,edge 浏览器占用了 ctrl+w (关闭当前串口)。

if(false)

https://s3.bmp.ovh/imgs/2023/07/07/e9a8daf415ce64d3.png

网卡驱动 r8168

lspci -v 查看

https://www.wanuse.com/2022/01/proxmox-ve.html https://blog.csdn.net/kuaile_0509/article/details/130273930 nano 使用教程

关注一下有惊喜
wxqr.png 公众号
赞赏支持
wechatpay.png 微信打赏 alipay.png 支付宝打赏

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK