54 lines
1.4 KiB
Markdown
54 lines
1.4 KiB
Markdown
# VM Tool
|
|
|
|
This script sets up multiple temporary VMs using QEMU. They run in the background, are on the same network as one another, and can be accessed via SSH.
|
|
|
|
## Usage
|
|
|
|
Ensure QEMU and `mkisofs` are installed. On Debian-like systems:
|
|
|
|
```sh
|
|
sudo apt install qemu-system genisoimage
|
|
```
|
|
|
|
Download a base image:
|
|
|
|
```sh
|
|
mkdir -p images
|
|
curl -C - -Lo images/Rocky-9-GenericCloud-Base.latest.x86_64.qcow2 https://dl.rockylinux.org/pub/rocky/9/images/x86_64/Rocky-9-GenericCloud-Base.latest.x86_64.qcow2
|
|
```
|
|
|
|
Create the VMs (by default, two VMs are created):
|
|
|
|
```sh
|
|
./vmtool.sh create
|
|
```
|
|
|
|
*Creating VMs will destroy any previous VMs first.*
|
|
|
|
Once the VMs are running, access them via SSH:
|
|
|
|
```sh
|
|
ssh -F ssh.conf node0
|
|
ssh -F ssh.conf node1
|
|
```
|
|
|
|
The VMs are on the same subnet, starting with ip `192.168.30.10` for `node0`, `192.168.30.11` for `node1`, and so on. They can reach one another:
|
|
|
|
```console
|
|
[root@node0 ~]# ping 192.168.30.11
|
|
PING 192.168.30.11 (192.168.30.11) 56(84) bytes of data.
|
|
64 bytes from 192.168.30.11: icmp_seq=1 ttl=64 time=0.465 ms
|
|
64 bytes from 192.168.30.11: icmp_seq=2 ttl=64 time=0.390 ms
|
|
64 bytes from 192.168.30.11: icmp_seq=3 ttl=64 time=0.684 ms
|
|
```
|
|
|
|
When done, you can stop and/or destroy the VMs:
|
|
|
|
```sh
|
|
./vmtool.sh destroy
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Check the environment variables at the top of the script to set memory, CPU count, max disk size, number of nodes, etc.
|