Proxmoxのセットアップメモ

自宅サーバーをやめたと言ったけどあれは嘘だ。再開した。
とはいえ、バージョンアップで色々汚くなっていたので、これを機にProxmox9.2を再インストールした。

構成

  • 機種 HP EliteDesk 800 G4 DM
  • CPU Intel Core i5-8500T
  • SSD 500GB * 2(NVMeで熱くなりがちなのでヒートシンクを縛りつけた)
  • メモリ 32GB

ファイルシステムは、ZFSのRAID1にした。インストール時にオプションを選ぶこと。

ネットワークインターフェースのハング対策

以前、テレホ鯖を運営していた際にネットワークインターフェースが固まって通信ができなくなったため、対策を行う。
post-up /sbin/ethtool -K nic0 tso offpost-up /sbin/ethtool --set-eee nic0 eee off を追記する。

参考: [SOLVED] - Intel NIC e1000e hardware unit hang | Page 6 | Proxmox Support Forum

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# cat /etc/network/interfaces
auto lo
iface lo inet loopback

iface nic0 inet manual

auto vmbr0
iface vmbr0 inet static
	address 192.168.1.100/24
	gateway 192.168.1.1
	bridge-ports nic0
	bridge-stp off
	bridge-fd 0
        post-up /sbin/ethtool -K nic0 tso off
        post-up /sbin/ethtool --set-eee nic0 eee off

その後、 ifreload -a をするんだったかな。

VMのテンプレート作り

VMのtemplateを作る。いちいちUbuntuのisoファイルをダウンロードして読み込んでVMを構築するのは時間がかかるため。
GUIでも作れるけど、CLIで行ってみた。むずい。

1
2
3
4
5
6
7
wget https://cloud-images.ubuntu.com/noble/current/noble-server-cloudimg-amd64.img
qm create 9000 --name ubuntu-template   --memory 2048   --cores 2   --cpu host   --net0 virtio,bridge=vmbr0   --scsihw virtio-scsi-single
qm importdisk 9000 noble-server-cloudimg-amd64.img local-zfs
qm set 9000 --scsi0 local-zfs:vm-9000-disk-0
qm set 9000 --ide2 local-zfs:cloudinit
qm set 9000 --boot order=scsi0
qm template 9000

みたいな感じだったと思う。

cloud-initの設定

いちいちVMを立てた後にユーザーを作って、公開鍵を設定するのは面倒なので、cloud-initというもので初期セットアップを自動でやってしまう。

最初にスニペットを置くディレクトリを作る必要がある。その後、localのストレージ設定でsnippetにチェックを入れておく。

1
mkdir -p /var/lib/vz/snippets

GUIでcloud-initの設定をする。ユーザー名とか秘密鍵とか。

続いてこんな感じのファイルを用意する。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# cat /var/lib/vz/snippets/vendor.yaml 
#cloud-config

packages:
  - qemu-guest-agent

runcmd:
  - systemctl enable qemu-guest-agent
  - systemctl start qemu-guest-agent

power_state:
  mode: reboot
  timeout: 30
  condition: true

最後にvendor.yamlを読み込む。
GUIでは完全なcloud-initの設定ができないので、手が届かない部分はファイルに書く必要がある。

1
2
qm set 9000 --cicustom "vendor=local:snippets/vendor.yaml"
qm config 9000

ダッシュボードにCPUとSSDの温度を表示する

これはおまけというか蛇足ではあるのだが、proxmoxのダッシュボードにCPUとストレージの温度を表示したくなった。
Meliox/PVE-mods: Proxmox modificationsを使ってみることにした。

1
2
3
4
5
apt-get install lm-sensors

wget https://raw.githubusercontent.com/Meliox/PVE-mods/refs/heads/main/legacy-scripts/pve-mod-gui-sensors.sh

bash pve-mod-gui-sensors.sh install

ブラウザのキャッシュを消したらダッシュボードから表示できるようになった。

あとがき

SSDにヒートシンクをつけたおかげか、温度は50度前後で程よくなっている。
つける前は70度くらいいってたので効果はあるようだ。

あとはここにMisskeyを移して、スペック不足でヒーヒー言ってるのを解消できたら良いと思う。
可用性は下がるしトラシュー力は求められるが、VPSで味気なかったので暇つぶしになって良いと思いたいところだ。

comments powered by Disqus
Hugo で構築されています。
テーマ StackJimmy によって設計されています。