73 lines
1.6 KiB
Markdown
73 lines
1.6 KiB
Markdown
# VMs
|
|
|
|
## HOW-TO
|
|
|
|
To start (or create) a VM, go in the desired folder and run
|
|
```console
|
|
$ ./run.sh [OPTS]
|
|
```
|
|
|
|
You can pass `qemu` flags (see `QEMU(1)`) to `./run.sh` directly or you can
|
|
make theses flags permanent by editing `run.sh` (current VM only) or `lib.sh`
|
|
(all VMs).
|
|
|
|
### Headless
|
|
|
|
For a headless VM, just remove the `-vga` and `-audio` flags from `lib.sh`.<br>
|
|
To start the VM in the background: `./run.sh & disown`
|
|
|
|
### CPU/RAM limit
|
|
|
|
The CPU flag is not set by default, see `QEMU(1)` for default values.<br>
|
|
Default RAM flag: `-m "2G,maxmem=$((HOST_RAM - 2))G"`.
|
|
```
|
|
./run.sh -smp "${NB_CPUS},maxcpus=${MAX_CPUS}" \
|
|
-m "${RAM}G,maxmem=${MAX_RAM}G"
|
|
```
|
|
|
|
### Port forwarding
|
|
|
|
To forward host port 2222 to guest port 22:
|
|
```
|
|
./run.sh -nic user,hostfwd=tcp::2222-:22
|
|
```
|
|
|
|
### USB passthrough
|
|
|
|
If you need USB passthrough, uncomment and fill in the corresponding line in
|
|
`run.sh`.
|
|
[You may need root privileges](https://wiki.archlinux.org/title/QEMU#Pass-through_host_USB_device).
|
|
|
|
## Windows installation
|
|
|
|
`Shift`+`F10` to open cmd.exe
|
|
```console
|
|
D:
|
|
pnputil /add-driver amd64\{version}\*.inf /install
|
|
|
|
diskpart
|
|
> list disk
|
|
> sel disk 0
|
|
> convert gpt
|
|
> create par efi size=100
|
|
> create par primary
|
|
> sel par 1
|
|
> format fs=fat32 quick
|
|
> assign letter=G:
|
|
> sel par 2
|
|
> format fs=ntfs quick
|
|
> assign letter=C:
|
|
> exit
|
|
|
|
E:
|
|
cd sources
|
|
dism /get-imageinfo /imagefile:install.wim
|
|
dism /apply-image /imagefile:install.wim /index:2 /applydir:C:
|
|
dism /image:C:\ /add-driver /driver:D:\amd64\{version}\viostor.inf
|
|
bcdboot C:\windows /s G: /f UEFI
|
|
```
|
|
|
|
## See also
|
|
|
|
<https://github.com/quickemu-project/quickemu>
|