aboutsummaryrefslogtreecommitdiff
path: root/packer/README.md
blob: e688802c62ecb4a55e83401e55c1653b3ba6e2bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Packer Template for QEMU VM with Nested Virtualization

This Packer template creates a QEMU-based virtual machine (VM) that can be used in Proxmox with nested virtualization enabled. It is designed for building other VMs inside this VM.

## Requirements

- Packer
- QEMU/KVM
- Ubuntu 24.04 Server ISO
- (Optional) Proxmox to run the image

## Usage

### Install Prerequisites

- You can use the provided script to install all necessary tools on your host system or inside an existing VM:

```
./scripts/install-prerequisites.sh
```

- This sets up tools like Packer, QEMU, and Docker.

### Build the image

- Run the following command from the project root to build the image:

```
packer build ubuntu-qemu-template.json
```

- The resulting .qcow2 image will be saved in the `output/` directory.

### Post-Processing

- After the build, the following script generates checksum files with the `scripts/create-checksums.sh` script. It produces .sums files with MD5 and SHA512 checksums.

### Using the VM

- Import the image into Proxmox and enable nested virtualization.
- You can then run this image as a VM capable of building other VMs using tools like Packer or Docker-in-Docker.

## Notes

- The image uses Ubuntu 24.04 Live Server.
- `scripts/sysprep.sh` prepares the image for reuse (e.g., clears logs, resets machine ID, etc.).
- The template sets defaults like 2 CPUs, 2 cores, 2 GB RAM.
- You can customize variables in the Packer template.

## File Structure

- `ubuntu-24.04-server_vm-builder.json` – Main Packer configuration.
- `scripts/install-prerequisites.sh` – Installs dependencies.
- `scripts/sysprep.sh` – Cleans and prepares the image.
- `scripts/create-checksums.sh` – Generates MD5/SHA512 checksums.