Note/环境/PVE装机记录.md

232 lines
4.7 KiB
Markdown
Raw Normal View History

2024-06-26 15:27:17 +08:00
# PVE装机记录
## 硬件配置
| 硬件 | 配置 | 数量 | 参考单价 |
| ---- | ---------------------------- | ---- | ----------------- |
| CPU | E5 2673v3 | 2 | 56 |
| 主板 | 华南金牌 x99-8D3 双路 | 1 | 580 |
| 内存 | 三星 32G DDR3 ECC 4R*4 1866L | 2 | 88 |
| 机箱 | 金河田 凌霜Pro 黑色 | 1 | 148 |
| 电源 | 鑫谷 GN650 650W 金牌 | 1 | 299 |
| 风扇 | A500 风扇 | 2 | 40 |
| 显卡 | 亮机卡 | 1 | 20 |
| 硬盘 | 三星 970EVO 512G | 1 | 600笔记本拆机 |
| 硬盘 | 希捷 紫盘 4T | 1 | 439 |
| | | 总价 | 2454 |
## 系统选择
### [PVE](https://www.proxmox.com/en/)
全称 Proxmox Virtual Environment是基于 Debian 的 Linux 系统,虚拟机内核为 KVM。硬件兼容性优秀。Web UI 的界面功能不强,但是如果通过命令行去操作的话,扩展定制能力几乎是无限的。
![image-20240131103027227](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706668227.png)
我选择使用的是7.4的版本
## BIOS设置
## 系统安装
制作启动盘推荐使用 [balenaEthcher](https://www.balena.io/etcher/)
![image-20240131103233515](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706668353.png)
## 系统优化
参考https://bbs.x86pi.cn/thread?topicId=20
快速脚本
```shell
wget -q -O /root/pve_source.tar.gz 'https://bbs.x86pi.cn/file/topic/2023-11-28/file/01ac88d7d2b840cb88c15cb5e19d4305b2.gz' && tar zxvf /root/pve_source.tar.gz && /root/./pve_source
```
## 挂载硬盘
### 2T以下的硬盘
查看目前的硬盘分区
```shell
df -h
```
选择硬盘
```shell
fdisk /dev/sda
```
输入 n 创建新的分区,一只回车显示创建成功后输入 w 保存
格式化为ext4格式
```shell
mkfs -t ext4 /dev/sda1
```
创建目录
```shell
mkdir -p /mnt/sda1
```
将/dev/sda分区挂载在/mnt/sda上
```shell
mount -t ext4 /dev/sda1 /mnt/sda1
```
将/mnt/sda挂载写入到系统启动项
```shell
echo /dev/sda1 /mnt/sda1 ext4 defaults 12>> /etc/fstab
```
最后添加在PVE设置中
![image-20240131091718419](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706663839.png)
### 4T及以上使用parted工具
首先安装工具 parted
```shell
apt install parted
```
![image-20240131100739790](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706666860.png)
查看目前的硬盘分区
```shell
df -h
```
选择硬盘
```shell
parted /dev/sda
```
查看分区
```shell
print
```
![image-20240131100810896](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706666891.png)
- 如果无法识别该硬盘需要输入以下命令先建立gpt表
```shell
mklabel gpt
```
求一个指定容量为4001GB的分区
```shell
mkpart primary 0GB 4001GB
```
![image-20240131100929879](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706666970.png)
查看分区是否完成
```shell
print
```
最后退出
```shell
quit
```
挂载到指定目录
查看一下是否有硬盘
```shell
fdisk -l
```
将/dev/sda分区挂载在/mnt/sda上
```shell
mount -t ext4 /dev/sda1 /mnt/sda1
```
将/mnt/sda挂载写入到系统启动项
```shell
echo /dev/sda1 /mnt/sda1 ext4 defaults 12>> /etc/fstab
```
最后添加在PVE设置中
![image-20240131091718419](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706663839.png)
## 扩展硬盘
https://blog.csdn.net/u011414736/article/details/131207861
## 功耗节约
查看当前功耗
```shell
lscpu | grep MHz
```
![image-20240131104925895](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706669366.png)
### 省电优化
### 调整 CPU 模式
首先得安装 cpupower
```shell
apt install linux-cpupower
```
下面是 cpupower 的一些常用命令:
```shell
# CPU实时频率查看
watch -n 1 cpupower monitor
# 查看当前所有CPU的信息
cpupower -c all frequency-info
# 设置所有CPU为节能模式
cpupower -c all frequency-set -g powersave
# 设置所有CPU为性能模式
cpupower -c all frequency-set -g performance
```
![image-20240131105139420](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706669499.png)
因为 PVE 下默认的 CPU 电源策略就是 performance 性能模式了,所以我们这里将其设置为保守一点的 conservative 模式:
```shell
cpupower -c all frequency-set -g conservative
```
此时检测频率发现所有的 CPU 频率都已经下来了
![image-20240131105257937](https://lsky.hhdxw.top/imghub/2024/01/image-202401311706669578.png)
## [[内网穿透]]