Skip to content

Commit af9c57f

Browse files
authored
Update README.md
1 parent 468e34d commit af9c57f

File tree

1 file changed

+0
-256
lines changed

1 file changed

+0
-256
lines changed

README.md

Lines changed: 0 additions & 256 deletions
Original file line numberDiff line numberDiff line change
@@ -54,259 +54,3 @@ contains shared code referenced by each processor build.
5454

5555
- `aarch64` - ARM64 processor architecture
5656
- `x86_64` - X86_64/AMD64/Intel 64 processor architecture
57-
58-
### Building x86_64 images
59-
60-
```
61-
cd ubuntu/iso/x86_64
62-
packer init .
63-
PACKER_LOG=1 packer build \
64-
-var-file ubuntu-24.04-x86_64.pkrvars.hcl \
65-
ubuntu.pkr.hcl
66-
67-
PACKER_LOG=1 packer build \
68-
-var-file ubuntu-24.04-bios-x86_64.pkrvars.hcl \
69-
ubuntu.pkr.hcl
70-
```
71-
72-
### Building aarch64 images
73-
```
74-
cd ubuntu/aarch64
75-
PACKER_LOG=1 packer build \
76-
-var-file ubuntu-22.04-aarch64.pkrvars.hcl \
77-
ubuntu.pkr.hcl
78-
```
79-
80-
## Using the images
81-
82-
Ironically on Linux, it's easiest to use Docker or Podman to load the required
83-
dependencies for the Vagrant Libvirt plugin for Vagrant. For more information
84-
refer to the [Vagrant Libvirt Documentation](https://vagrant-libvirt.github.io/vagrant-libvirt/installation#requirements).
85-
86-
```
87-
# Create $HOME/.vagrant.d if it doesn't exist
88-
mkdir -p $HOME/.vagrant.d
89-
90-
docker run --interactive --tty --rm \
91-
--env LIBVIRT_DEFAULT_URI \
92-
--mount type=bind,source=/var/run/libvirt/,target=/var/run/libvirt/ \
93-
--mount type=bind,source=$HOME/.vagrant.d,target=/.vagrant.d \
94-
--mount type=bind,source=$(realpath "${PWD}"),target=${PWD} \
95-
--workdir "${PWD}" \
96-
--network host \
97-
vagrantlibvirt/vagrant-libvirt:latest \
98-
vagrant status
99-
100-
```
101-
102-
# Give permission to allow user VMs to access bridged device
103-
104-
```
105-
mkdir -p /etc/qemu
106-
cat >/etc/qemu/bridge.conf <<EOF
107-
allow br0
108-
EOF
109-
chown root:root /etc/qemu/bridge.conf
110-
chmod 0644 /etc/qemu/bridge.conf
111-
# Add setuid to the qemu-bridge-helper binary
112-
chmod u+s /usr/lib/qemu/qemu-bridge-helper
113-
```
114-
115-
# https://wiki.qemu.org/Documentation/Networking
116-
117-
```
118-
$ qemu-img convert -O qcow2 output-ubuntu-22.04-bios-x86_64/ubuntu-22.04-bios-x86_64 ubuntu-image.qcow2
119-
$ qemu-img resize -f qcow2 ubuntu-image.qcow2 32G
120-
$ qemu-system-x86_64 \
121-
-name ubuntu-image \
122-
-machine accel=kvm,type=q35 \
123-
-cpu host \
124-
-smp 2 \
125-
-m 2G \
126-
-net bridge,br=br0 -net nic,macaddr=${mac},model=virtio
127-
-device virtio-net-pci,netdev=net0 \
128-
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
129-
-drive file=ubuntu-image.qcow2,if=virtio,format=qcow2
130-
```
131-
132-
133-
### QEMU x86_64 BIOS
134-
135-
```
136-
$ qemu-img convert -O qcow2 output-ubuntu-22.04-bios-x86_64/ubuntu-22.04-bios-x86_64 ubuntu-image.qcow2
137-
$ qemu-img resize -f qcow2 ubuntu-image.qcow2 32G
138-
$ qemu-system-x86_64 \
139-
-name ubuntu-image \
140-
-machine accel=kvm,type=q35 \
141-
-cpu host \
142-
-smp 2 \
143-
-m 2G \
144-
-device virtio-net-pci,netdev=net0 \
145-
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
146-
-drive file=ubuntu-image.qcow2,if=virtio,format=qcow2
147-
```
148-
149-
### QEMU x86_64 UEFI
150-
151-
```
152-
$ qemu-img convert -O qcow2 output-ubuntu-22.04-x86_64/ubuntu-22.04-x86_64 ubuntu-image.qcow2
153-
$ cp output-ubuntu-22.04-x86_64/efivars.fd ubuntu-image-efivars.fd
154-
$ qemu-img resize -f qcow2 ubuntu-image.qcow2 32G
155-
$ qemu-system-x86_64 \
156-
-name ubuntu-image \
157-
-machine accel=kvm,type=q35 \
158-
-cpu host \
159-
-smp 2 \
160-
-m 2G \
161-
-device virtio-net-pci,netdev=net0 \
162-
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
163-
-drive file=ubuntu-image.qcow2,if=virtio,format=qcow2 \
164-
-drive if=pflash,format=raw,readonly=on,unit=0,file=/usr/share/OVMF/OVMF_CODE.fd \
165-
-drive if=pflash,format=raw,unit=1,file=ubuntu-image-efivars.fd
166-
```
167-
168-
### QEMU aarch64 UEFI
169-
170-
```
171-
$ qemu-img convert -O qcow2 output-ubuntu-22.04-aarch64/ubuntu-22.04-aarch64 ubuntu-image.qcow2
172-
$ cp output-ubuntu-22.04-aarch64/efivars.fd ubuntu-image-efivars.fd
173-
$ qemu-img resize -f qcow2 ubuntu-image.qcow2 32G
174-
qemu-system-aarch64 \
175-
-name ubuntu-image \
176-
-machine accel=kvm,type=virt \
177-
-cpu host \
178-
-smp 2 \
179-
-m 2G \
180-
-device virtio-keyboard \
181-
-device virtio-mouse \
182-
-device virtio-gpu-pci \
183-
-device virtio-net-pci,netdev=net0 \
184-
-netdev user,id=net0,hostfwd=tcp::2222-:22 \
185-
-drive file=ubuntu-image.qcow2,if=virtio,format=qcow2 \
186-
-drive if=pflash,format=raw,readonly=on,unit=0,file=/usr/share/AAVMF/AAVMF_CODE.fd \
187-
-drive if=pflash,format=raw,unit=1,file=ubuntu-image-efivars.fd
188-
```
189-
190-
### libvirt x86_64 BIOS
191-
192-
```
193-
sudo qemu-img convert -O qcow2 output-ubuntu-22.04-bios-x86_64/ubuntu-22.04-bios-x86_64 /var/lib/libvirt/images/ubuntu-image.qcow2
194-
sudo qemu-img resize -f qcow2 /var/lib/libvirt/images/ubuntu-image.qcow2 32G
195-
196-
virt-install \
197-
--name ubuntu-image \
198-
--memory 2048 \
199-
--vcpus 2 \
200-
--os-variant ubuntu22.04 \
201-
--disk path=/var/lib/libvirt/images/ubuntu-image.qcow2,bus=virtio \
202-
--import \
203-
--noautoconsole \
204-
--network network=default,model=virtio \
205-
--graphics spice \
206-
--video model=virtio \
207-
--console pty,target_type=serial
208-
209-
virt-install \
210-
--connect qemu:///system \
211-
--name ubuntu-image \
212-
--memory 2048 \
213-
--vcpus 2 \
214-
--os-variant ubuntu22.04 \
215-
--disk path=/var/lib/libvirt/images/ubuntu-image.qcow2,bus=virtio \
216-
--import \
217-
--noautoconsole \
218-
--network network=default,model=virtio \
219-
--graphics spice \
220-
--video model=virtio \
221-
--console pty,target_type=serial
222-
223-
virsh console ubuntu-image
224-
virt-viewer ubuntu-image
225-
226-
virsh destroy ubuntu-image
227-
virsh undefine ubuntu-image --remove-all-storage
228-
```
229-
230-
### libvirt x86_64 UEFI
231-
232-
```
233-
# You can get paths of the pools from /etc/libvirt/storage
234-
sudo qemu-img convert -O qcow2 output-ubuntu-22.04-x86_64/ubuntu-22.04-x86_64 /var/lib/libvirt/images/ubuntu-image.qcow2
235-
sudo qemu-img resize -f qcow2 /var/lib/libvirt/images/ubuntu-image.qcow2 32G
236-
237-
virt-install \
238-
--connect qemu:///system \
239-
--name ubuntu-image \
240-
--boot uefi \
241-
--memory 2048 \
242-
--vcpus 2 \
243-
--os-variant ubuntu22.04 \
244-
--disk path=/var/lib/libvirt/images/ubuntu-image.qcow2,bus=virtio \
245-
--import \
246-
--noautoconsole \
247-
--network network=default,model=virtio \
248-
--graphics spice \
249-
--video model=virtio \
250-
--console pty,target_type=serial
251-
252-
sudo rm 50-cloud-init.yaml
253-
sudo vi /etc/netplan/00-installer-config.yaml
254-
network:
255-
ethernets:
256-
enp1s0:
257-
dhcp4: true
258-
version: 2
259-
260-
sudo vi /etc/hosts
261-
127.0.0.1 localhost ubuntu-cloud
262-
263-
sudo netplan apply
264-
virsh console ubuntu-image
265-
virt-viewer ubuntu-image
266-
267-
virsh destroy ubuntu-image
268-
virsh undefine ubuntu-image --nvram --remove-all-storage
269-
```
270-
271-
### libvirt aarch64 UEFI
272-
273-
```
274-
# You can get paths of the pools from /etc/libvirt/storage
275-
# /data/vms
276-
# /var/lib/libvirt/images
277-
278-
qemu-img convert -O qcow2 output-ubuntu-22.04-aarch64/ubuntu-22.04-aarch64 /data/vms/ubuntu-image.qcow2
279-
qemu-img resize -f qcow2 /data/vms/ubuntu-image.qcow2 32G
280-
281-
virt-install \
282-
--connect qemu:///system \
283-
--name ubuntu-image \
284-
--boot uefi \
285-
--memory 2048 \
286-
--vcpus 2 \
287-
--os-variant ubuntu20.04 \
288-
--disk path=/data/vms/ubuntu-image.qcow2,bus=virtio \
289-
--import \
290-
--noautoconsole \
291-
--network network=default,model=virtio \
292-
--graphics spice \
293-
--video model=virtio \
294-
--console pty,target_type=serial
295-
296-
virsh console ubuntu-image
297-
virt-viewer ubuntu-image
298-
299-
virsh destroy ubuntu-image
300-
virsh undefine ubuntu-image --nvram --remove-all-storage
301-
```
302-
303-
#
304-
#
305-
#
306-
307-
https://www.dzombak.com/blog/2024/02/Setting-up-KVM-virtual-machines-using-a-bridged-network.html
308-
309-
virsh net-list
310-
virsh net-info hostbridge
311-
virsh net-dhcp-leases hostbridge
312-
sudo brctl show br0

0 commit comments

Comments
 (0)