ProxmoxVE8のセットアップ

えいら

Homelab構築のための第一歩としてProxmoxを導入したときのメモ。 基本的なインストールは手順に沿って実施するだけなので割愛。

下記の設定もWikiを読めば書いてあることしか書いていない。 https://pve.proxmox.com/wiki/Main_Page

Enterpriseリポジトリの無効化

デフォルトの状態かつサブスクリプションが無い場合、apt updateでエラーが発生してしまう。幸いProxmoxはサブスクリプションがない場合のリポジトリも用意されているためそちらに変更する。

$ cat /etc/apt/sources.list
deb http://ftp.debian.org/debian bookworm main contrib
deb http://ftp.debian.org/debian bookworm-updates main contrib

# Proxmox VE pve-no-subscription repository provided by proxmox.com,
# NOT recommended for production use
deb http://download.proxmox.com/debian/pve bookworm pve-no-subscription

# security updates
deb http://security.debian.org/debian-security bookworm-security main contrib
$ cat /etc/apt/sources.list.d/pve-enterprise.list
# deb https://enterprise.proxmox.com/debian/pve bookworm pve-enterprise
$ cat /etc/apt/sources.list.d/ceph.list
# deb https://enterprise.proxmox.com/debian/ceph-quincy bookworm enterprise
deb http://download.proxmox.com/debian/ceph-quincy bookworm no-subscription

参考: https://pve.proxmox.com/wiki/Package_Repositories

パッケージのアップデート&アップグレード

$ apt-get -y update && apt-get -y dist-upgrade

ユーザに2要素認証を設定

WebUIから設定を行う。

  • Datacenter > Permissions > Two Factor
  • 画面上部のAdd > TOTP
  • QRコードを2FAのアプリで読みこんで表示された値をVerify Codeに入力
  • Addをクリック

試しにログアウトしてから再ログインしようとすると2FAを求められる。

SSH公開鍵認証の有効化・パスワード認証の無効化

Proxmox側

/etc/ssh/sshd_configを編集

PubkeyAuthentication yes

sshdを再起動

$ systemctl restart sshd

クライアント側

$ ssh-keygen -t ed25519 -C "root@pve"
$ cat id_ed25519.pub

Proxmox側

/root/.ssh/authorized_keysにクライアント側で生成した公開鍵を設定

ssh-ed25519 xxxxxxxxxxxxxxxxxxxxxxxxxxxx root@pve

クライアント側

$ ssh root@${ホスト名} -i ~/.ssh/${秘密鍵}

ログインできない場合は.sshディレクトリやその配下のファイルのパーミッションが正しく設定されていることを確認する。

Proxmox側

再度/etc/ssh/sshd_configを編集

PasswordAuthentication no

sshdを再起動

$ systemctl restart sshd

クライアント側

パスワードでログインできなくなっていること、公開鍵でログインできることを確認する。