🏠hoatranlab.io.vn 💬Zalo: 0917516878 📞0917516878 ✉️[email protected]

Phase 2: Cài đặt và cấu hình ban đầu

Bài 2.1: Cài đặt Proxmox VE 9 từ ISO

Lý thuyết cốt lõi

Các bước chuẩn bị:

  1. Tải ISO tại https://www.proxmox.com/en/downloads
  2. Tạo USB boot bằng dd (Linux) hoặc Rufus (Windows, chọn DD mode)
  3. BIOS: bật VT-x/AMD-V + VT-d/IOMMU + Secure Boot (VE 9 hỗ trợ)
  4. UEFI boot mode (tránh legacy BIOS)

Lựa chọn filesystem cài đặt:

FS Ưu điểm Nhược điểm Dùng khi
ext4 Đơn giản, mature Không snapshot Boot disk đơn giản
xfs Tốt với file lớn Không shrink Workload media/backup
ZFS (RAID1) Snapshot, replication, checksum Cần nhiều RAM Production recommended
btrfs Snapshot built-in Chưa stable lắm Lab/test only

Bài tập thực hành

Lab: cài VE 9 lên 1 node test (vật lý hoặc nested trong VMware/Hyper-V).

Các màn hình cài đặt:

  1. I agree → License
  2. Target Harddisk → Chọn disk → Options → ZFS (RAID1) nếu có 2 disk
  3. Country: Vietnam, Timezone: Asia/Ho_Chi_Minh, Keyboard: U.S. English
  4. Password + Email (admin contact)
  5. Management Network:
    - Hostname: pve01.lab.local
    - IP: 10.0.0.11/24
    - Gateway: 10.0.0.1
    - DNS: 10.0.0.1 (hoặc 8.8.8.8)
  6. Install → reboot

Post-install (SSH vào node):

# 1. Xem version
pveversion -v | head -5

# 2. Update to latest (VE 9 dùng no-subscription repo cho community)
sed -i 's/enterprise.proxmox.com/download.proxmox.com/g' /etc/apt/sources.list.d/pve-enterprise.sources

cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<'EOF'
Types: deb
URIs: http://download.proxmox.com/debian/pve
Suites: trixie
Components: pve-no-subscription
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
EOF

# 3. Disable enterprise repo (nếu không có license)
rm /etc/apt/sources.list.d/pve-enterprise.sources

# 4. Update
apt update && apt dist-upgrade -y
reboot

Kết quả đầu ra

$ pveversion -v | head -5
proxmox-ve: 9.1-1 (running kernel: 6.14.8-2-pve)
pve-manager: 9.1.3 (running version: 9.1.3/abc123)
proxmox-kernel-helper: 9.1.0
proxmox-kernel-6.14: 6.14.8-2
pve-kernel-6.14.8-2-pve-signed: 6.14.8-2

Truy cập Web GUI: https://10.0.0.11:8006 (login: root@pam + password đã set).

Troubleshooting

  • Nhận không ra RAID controller: thêm driver module trong initramfsupdate-initramfs -u -k all
  • NIC không active: check /etc/network/interfaces, verify driver bằng lspci | grep -i eth
  • Boot loop sau update: boot vào kernel cũ từ GRUB (press Shift), rollback kernel: apt install proxmox-kernel-6.14.8-1-pve

Ứng dụng thực tế

Tình huống: Triển khai 3 node DC nội bộ cho khách hàng ngân hàng.

Giải pháp:

  • Dùng iDRAC/iLO remote console map ISO từ workstation
  • Preseed config qua Answer File (VE 8.2+) để cài đồng loạt 3 node cùng lúc
  • Sau cài xong: apt update && apt install ifupdown2 ethtool bridge-utils (nếu chưa có)

Lợi ích: Giảm thời gian cài đặt từ 3 × 30 phút → 1 lần 10 phút parallel.


Bài 2.2: Post-install — repo, subscription nag, basic tuning

Lý thuyết cốt lõi

Sau khi cài xong, cần cấu hình:

  1. Repository (no-sub hoặc enterprise)
  2. Remove subscription nag (community edition)
  3. Tuning: disable HA watchdog (nếu single node), tuning I/O scheduler
  4. Time sync: chrony (mặc định Debian 13 đã có systemd-timesyncd)
  5. Fail2ban: bảo vệ SSH brute-force

Script post-install chuẩn:

#!/bin/bash
# post-install-pve9.sh

# 1. Hostname FQDN
hostnamectl set-hostname pve01.lab.local

# 2. /etc/hosts đúng thứ tự (quan trọng cho cluster)
cat > /etc/hosts <<'EOF'
127.0.0.1       localhost
10.0.0.11       pve01.lab.local pve01
EOF

# 3. Remove subscription nag
sed -i.bak "s/data.status.*!=.*Active/false/g" /usr/share/javascript/proxmox-widget-toolkit/proxmoxlib.js
systemctl restart pveproxy

# 4. Timezone + NTP
timedatectl set-timezone Asia/Ho_Chi_Minh
systemctl enable --now systemd-timesyncd

# 5. Install useful tools
apt install -y htop iotop iftop tmux vim curl wget unzip ethtool \
  lm-sensors smartmontools net-tools fail2ban chrony

# 6. Disable IPv6 nếu không dùng (tránh nhiễu corosync)
cat > /etc/sysctl.d/99-disable-ipv6.conf <<'EOF'
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
EOF
sysctl -p /etc/sysctl.d/99-disable-ipv6.conf

Bài tập thực hành

  1. Chạy script trên cho mỗi node
  2. Verify subscription nag đã tắt: login Web GUI, không thấy popup "No valid subscription"
  3. Check NTP:
timedatectl status
chronyc tracking

Kết quả đầu ra

$ timedatectl status
               Local time: Wed 2026-04-22 11:05:23 +07
           Universal time: Wed 2026-04-22 04:05:23 UTC
                 Time zone: Asia/Ho_Chi_Minh (+07, +0700)
 System clock synchronized: yes
               NTP service: active

Troubleshooting

  • Subscription nag quay lại sau update: script sửa file JS, khi update proxmox-widget-toolkit sẽ reset. Giải pháp: dùng dpkg-trigger hook hoặc script chạy sau mỗi apt upgrade.
  • Clock drift giữa các node: bắt buộc NTP server chung → corosync sẽ báo "clock skew" → cluster unstable.

Ứng dụng thực tế

Đóng gói script trên thành Ansible role pve9-postinstall để triển khai đồng loạt 10+ node.


Bài 2.3: Cấu hình mạng cơ bản — vmbr0, VLAN, bonding

Lý thuyết cốt lõi

Proxmox network dùng Linux Bridge (vmbr0, vmbr1...) — tương đương vSwitch ở VMware.

Naming conventions VE 9:

  • vmbrN: bridge
  • bondN: bonded interface
  • ensXfY / enoN / eth0: physical NIC (systemd predictable names)

File config: /etc/network/interfaces

Topology production 3-NIC:

eno1 (1 Gbps) ─── management (vmbr0) ─── 10.0.0.11/24
eno2+eno3 (2×10G, LACP bond0) ── VM traffic (vmbr1) + VLAN trunks
eno4+eno5 (2×25G, LACP bond1) ── Ceph cluster (vmbr2) — private, MTU 9000

Bài tập thực hành

Config /etc/network/interfaces cho node có 2 NIC 10G + 1 NIC 1G:

auto lo
iface lo inet loopback

# Management
auto eno1
iface eno1 inet manual

auto vmbr0
iface vmbr0 inet static
    address 10.0.0.11/24
    gateway 10.0.0.1
    bridge-ports eno1
    bridge-stp off
    bridge-fd 0

# LACP bond for VM traffic
auto eno2
iface eno2 inet manual

auto eno3
iface eno3 inet manual

auto bond0
iface bond0 inet manual
    bond-slaves eno2 eno3
    bond-miimon 100
    bond-mode 802.3ad
    bond-xmit-hash-policy layer2+3

auto vmbr1
iface vmbr1 inet manual
    bridge-ports bond0
    bridge-stp off
    bridge-fd 0
    bridge-vlan-aware yes
    bridge-vids 10-4094

Apply:

# VE 9 dùng ifupdown2 mặc định — reload không cần reboot
ifreload -a
ip -br addr show
bond-mode status:
cat /proc/net/bonding/bond0

Kết quả đầu ra

$ ip -br addr show
lo               UNKNOWN        127.0.0.1/8
eno1             UP
vmbr0            UP             10.0.0.11/24
eno2             UP
eno3             UP
bond0            UP
vmbr1            UP

Troubleshooting

Lỗi Nguyên nhân Fix
Bond down Switch chưa bật LACP Switch config channel-group X mode active
VLAN không pass bridge-vlan-aware chưa yes Sửa + ifreload -a
Ping không tới gateway MAC học sai ip neigh flush all
Lost SSH sau đổi config Sai gateway Console vào sửa /etc/network/interfaces

Ứng dụng thực tế

Tình huống: Data center 2 switch core redundant, cần HA cho VM traffic.

Giải pháp: Split bond — eno2 nối switch A, eno3 nối switch B → bond mode balance-slb (không phải LACP) vì 2 switch khác chassis. Nếu dùng MLAG (VPC/vPC) thì dùng LACP được.