Proxmox Virtual Environment: Difference between revisions
No edit summary |
m fix style :-] |
||
| (2 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
[https://www.proxmox.com/proxmox-ve {{PAGENAME}}] - shortened ''PVE'' - ([[wikipedia:en:{{PAGENAME}}]]) is a platform for containerization and virtualization. PVE | [https://www.proxmox.com/proxmox-ve {{PAGENAME}}] - shortened ''PVE'' - ([[wikipedia:en:{{PAGENAME}}]]) is a platform for containerization and virtualization. | ||
PVE is open source and is based on Debian GNU/Linux (with a customized kernel from Ubuntu) and supports a variety of filesystems (e.g.[[ZFS]]) and storage-backends/network-filesystems (e.g.[[Ceph]]). [[Ceph]] can be setup, administrated and monitored through the Webinterface, just as most other functions of PVE. There is also an API and a way to configure PVE through Configfiles and CLI-Commands. | |||
[[File:Proxmox-VE-8-0-Cluster-Summary.png|thumb|Proxmox-VE-8-0-Cluster-Summary]] | |||
PVE can manage a "data center" as a cluster of machines and storage through a unified Webgui that allows management of the whole cluster through each of the nodes. | |||
Proxmox VE uses | Proxmox VE uses | ||
| Line 7: | Line 13: | ||
<blockquote> | <blockquote> | ||
The instructions should work for PVE | The instructions should work for PVE 7.2 and later with NixOS 22.05 and later. | ||
</blockquote> | </blockquote> | ||
| Line 25: | Line 31: | ||
The first run will take some time, as a patched version of qemu with support for the VMA format needs to be built | The first run will take some time, as a patched version of qemu with support for the VMA format needs to be built | ||
</blockquote> | </blockquote> | ||
< | |||
nix run github:nix-community/nixos-generators -- --format proxmox | <syntaxhighlight lang=console> | ||
</ | $ nix run github:nix-community/nixos-generators -- --format proxmox | ||
</syntaxhighlight> | |||
Pass additional nix configuration to the template with <code>--configuration filename.nix</code>. In addition to NixOS module options, proxmox-specific options present in [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/proxmox-image.nix nixos/modules/virtualisation/proxmox-image.nix] can be used to set core, memory, disk and other VM hardware options. | Pass additional nix configuration to the template with <code>--configuration filename.nix</code>. In addition to NixOS module options, proxmox-specific options present in [https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/virtualisation/proxmox-image.nix nixos/modules/virtualisation/proxmox-image.nix] can be used to set core, memory, disk and other VM hardware options. | ||
| Line 34: | Line 42: | ||
The generated vma.zst file can be copied to <code>/var/lib/vz/dump/</code> (or any other configured VM dump storage path). A new VM can be spun up from it either using the GUI or the CLI: | The generated vma.zst file can be copied to <code>/var/lib/vz/dump/</code> (or any other configured VM dump storage path). A new VM can be spun up from it either using the GUI or the CLI: | ||
< | <syntaxhighlight lang=console> | ||
qmrestore /var/lib/vz/dump/vzdump-qemu-nixos-21.11.git.d41882c7b98M.vma.zst | $ qmrestore /var/lib/vz/dump/vzdump-qemu-nixos-21.11.git.d41882c7b98M.vma.zst <vmid> --unique true | ||
</ | </syntaxhighlight> | ||
<blockquote> | <blockquote> | ||
note: the MAC address of net0 defaults to <code>00:00:00:00:00:00</code>. This must either be overridden through <code>proxmox.qemuConf.net0</code>, or the <code>unique</code> attribute must be set to true when importing the image on Proxmox. | note: the MAC address of net0 defaults to <code>00:00:00:00:00:00</code>. This must either be overridden through <code>proxmox.qemuConf.net0</code>, or the <code>unique</code> attribute must be set to true when importing the image on Proxmox. | ||
| Line 42: | Line 50: | ||
By default, the generated image is set up to expose a serial terminal interface for ease of access. | By default, the generated image is set up to expose a serial terminal interface for ease of access. | ||
< | <syntaxhighlight lang=console> | ||
root@proxmox-server:~# qm start | root@proxmox-server:~# qm start <vmid> | ||
root@proxmox-server:~# qm terminal | root@proxmox-server:~# qm terminal <vmid> | ||
starting serial terminal on interface serial0 (press Ctrl+O to exit) | starting serial terminal on interface serial0 (press Ctrl+O to exit) | ||
<<< NixOS Stage 1 >>> | |||
loading module dm_mod... | loading module dm_mod... | ||
| Line 58: | Line 66: | ||
<<< Welcome to NixOS 21.11.git.d41882c7b98M (x86_64) - ttyS0 >>> | |||
Run 'nixos-help' for the NixOS manual. | Run 'nixos-help' for the NixOS manual. | ||
| Line 66: | Line 74: | ||
[root@nixos:~]# | [root@nixos:~]# | ||
</ | </syntaxhighlight> | ||
=== Network configuration === | === Network configuration === | ||
| Line 72: | Line 80: | ||
Cloud-init can be enabled with | Cloud-init can be enabled with | ||
< | <syntaxhighlight lang=nix> | ||
services.cloud-init.network.enable = true; | services.cloud-init.network.enable = true; | ||
</ | </syntaxhighlight> | ||
This will enable systemd-networkd, allowing cloud-init to set up network interfaces on boot. | This will enable systemd-networkd, allowing cloud-init to set up network interfaces on boot. | ||
| Line 81: | Line 89: | ||
=== Generating LXC template === | === Generating LXC template === | ||
< | <syntaxhighlight lang=console> | ||
nix run github:nix-community/nixos-generators -- --format proxmox-lxc | $ nix run github:nix-community/nixos-generators -- --format proxmox-lxc | ||
</ | </syntaxhighlight> | ||
=== Privileged LXCs === | === Privileged LXCs === | ||
| Line 102: | Line 110: | ||
The template built above without any options does not come with <code>/etc/nixos/configuration.nix</code>. A minimal working example is presented below. Be sure to run <code>nix-channel --update</code>, reboot the container running before <code>nixos-rebuild switch</code>. | The template built above without any options does not come with <code>/etc/nixos/configuration.nix</code>. A minimal working example is presented below. Be sure to run <code>nix-channel --update</code>, reboot the container running before <code>nixos-rebuild switch</code>. | ||
< | <syntaxhighlight lang=nix> | ||
{ pkgs, modulesPath, ... }: | { pkgs, modulesPath, ... }: | ||
| Line 114: | Line 122: | ||
]; | ]; | ||
} | } | ||
</ | </syntaxhighlight> | ||
=== LXC Console === | === LXC Console === | ||