Proxmox Virtual Environment: Difference between revisions
imported>Bradfitz m typo fixes |
No edit summary |
||
(8 intermediate revisions by 5 users 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 | [https://www.proxmox.com/proxmox-ve {{PAGENAME}}] - shortened ''PVE'' - ([[wikipedia:en:{{PAGENAME}}]]) is a platform for containerization and virtualization. | ||
PVE uses | 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 | |||
* [[#KVM]] for virtualization and | |||
* [[#LXC]] for containerization. | |||
NixOS runs on both. | NixOS runs on both. | ||
Line 9: | Line 15: | ||
The instructions should work for PVE 7.2 and later with NixOS 22.05 and later. | The instructions should work for PVE 7.2 and later with NixOS 22.05 and later. | ||
</blockquote> | </blockquote> | ||
== Deploying Proxmox with NixOS == | |||
The [https://github.com/SaumonNet/proxmox-nixos/ proxmox-nixos] project allows to run the Proxmox Hypervisor on top of NixOS. | |||
== KVM == | == KVM == | ||
Line 14: | Line 24: | ||
It is possible to generate generic qcow2 images and attach them to VMs with <code>qm importdisk</code> as shown [https://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE#Importing_to_Proxmox_VE here]. | It is possible to generate generic qcow2 images and attach them to VMs with <code>qm importdisk</code> as shown [https://pve.proxmox.com/wiki/Migration_of_servers_to_Proxmox_VE#Importing_to_Proxmox_VE here]. | ||
A better option is to generate a VMA image that can be imported as a VM on | A better option is to generate a VMA image that can be imported as a VM on Proxmox VE. With this method, many VM configuration options such as CPU, memory, network interfaces, and serial terminals can be specified in nix instead of manually setting them on the Proxmox UI. | ||
=== Generating VMA === | === Generating VMA === | ||
Line 26: | Line 36: | ||
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. | ||
=== Deploying on | === Deploying on Proxmox VE === | ||
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: | ||
Line 34: | Line 44: | ||
</pre> | </pre> | ||
<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 | 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. | ||
</blockquote> | </blockquote> | ||
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. | ||
Line 87: | Line 97: | ||
=== Network configuration === | === Network configuration === | ||
The proxmox LXC template uses systemd-networkd by default to allow network configuration by | The proxmox LXC template uses systemd-networkd by default to allow network configuration by Proxmox. <code>proxmoxLXC.manageNetwork</code> can be set to true to disable this. | ||
=== | === Deploying on Proxmox VE === | ||
Copy the tarball to | Copy the tarball to Proxmox, then create a new LXC with this template through the web UI or the CLI. The “nesting” feature needs to be enabled. Newer versions of Proxmox will have it enabled by default. | ||
As of now, not all of the configuration options on the web UI work for | As of now, not all of the configuration options on the web UI work for Proxmox LXCs. Network configuration and adding SSH keys to root user work, while setting a password for the root user and setting hostname don’t. | ||
It is suggested to set a root password within the container on first boot. | It is suggested to set a root password within the container on first boot. | ||
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 110: | Line 120: | ||
]; | ]; | ||
} | } | ||
</ | </syntaxHighlight> | ||
=== LXC Console === | === LXC Console === | ||
Line 130: | Line 140: | ||
== References == | == References == | ||
<references /> | <references /> | ||
[[Category:Software]] | |||
[[Category:Virtualization]] |