Update VM deployment script and documentation to reflect new default VM name 'CUBE' and IP configuration. Adjusted cloud-init settings for static IP and network details. Enhanced README and related scripts for clarity on VLAN and bridge usage.
This commit is contained in:
39
README.md
39
README.md
@@ -13,12 +13,14 @@ Deploy a **Debian 13 minimal** VM with cloud-init on a host running **QEMU** and
|
||||
|
||||
## Specs (as requested)
|
||||
|
||||
- **VM name:** `CUBE` (override with `VM_NAME=...`)
|
||||
- **CPU:** 2 cores
|
||||
- **Memory:** 4 GB RAM + 4 GB swap
|
||||
- **Storage:** 128 GB
|
||||
- **IP:** 192.168.0.225
|
||||
- **IP:** 192.168.0.225 (set in `cloud-init/user-data`; override there if needed)
|
||||
- **User:** `rina` / **Password:** `rinapwd`
|
||||
- **OS:** Latest Debian minimal (Debian 13 Trixie cloud image)
|
||||
- **Network:** By default the VM is attached to bridge **br1.40** (VLAN 40). See [VLAN 40 / br1.40 setup](docs/vlan40-bridge-systemd-networkd.md) on the host first.
|
||||
|
||||
## Requirements on the remote host
|
||||
|
||||
@@ -36,37 +38,41 @@ sudo apt install libvirt-daemon-system qemu-kvm virtinst libguestfs-tools cloud-
|
||||
|
||||
1. Copy this directory to the remote machine (or clone there).
|
||||
|
||||
2. **Optional:** Edit `cloud-init/user-data` and `cloud-init/network-config`:
|
||||
- Change gateway (default `192.168.0.1`) or DNS if your LAN differs.
|
||||
2. **On the host:** If using VLAN 40, configure br1.40 and eth1.40 first (see [docs/vlan40-bridge-systemd-networkd.md](docs/vlan40-bridge-systemd-networkd.md)).
|
||||
|
||||
3. **Optional:** Edit `cloud-init/user-data` and `cloud-init/network-config`:
|
||||
- Change IP (default `192.168.0.225/24`), gateway (`192.168.0.1`), or DNS if your LAN differs.
|
||||
- Add your SSH public key under `ssh_authorized_keys` for key-based login.
|
||||
- Network is also embedded in `user-data`; `network-config` is kept for reference.
|
||||
|
||||
3. Run the deploy script (on the remote host):
|
||||
4. Run the deploy script (on the remote host):
|
||||
|
||||
```bash
|
||||
chmod +x deploy-rina-vm.sh
|
||||
./deploy-rina-vm.sh
|
||||
```
|
||||
By default the VM is named **CUBE** and attached to bridge **br1.40**. Override with `VM_NAME=...` or `BRIDGE=...` if needed.
|
||||
|
||||
4. Wait for first boot (~1–2 minutes). Then:
|
||||
5. Wait for first boot (~1–2 minutes). Then:
|
||||
|
||||
```bash
|
||||
ssh rina@192.168.0.225
|
||||
# password: rinapwd
|
||||
```
|
||||
Or open the console: `virsh console CUBE`.
|
||||
|
||||
## What the script does
|
||||
|
||||
1. Downloads the Debian 13 generic cloud image (qcow2) once to `/var/lib/libvirt/images/`.
|
||||
2. Creates a 128 GB disk for the VM backed by that image.
|
||||
3. Builds a cloud-init **NoCloud** seed ISO from `cloud-init/user-data` and `cloud-init/meta-data`.
|
||||
4. Creates and starts the VM with **virt-install** (2 vCPU, 4 GB RAM, 128 GB disk, seed ISO attached).
|
||||
4. Creates and starts the VM with **virt-install** (name **CUBE**, 2 vCPU, 4 GB RAM, 128 GB disk, bridge **br1.40**, seed ISO attached).
|
||||
|
||||
## Customization
|
||||
|
||||
- **VM name:** `VM_NAME=myvm ./deploy-rina-vm.sh` (default: **CUBE**)
|
||||
- **Pool directory:** `POOL_DIR=/path/to/images ./deploy-rina-vm.sh`
|
||||
- **Network:** By default the script uses the libvirt network `default`. For a bridge (e.g. `br0`):
|
||||
`NETWORK=br0 ./deploy-rina-vm.sh`
|
||||
- **Network:** By default the VM is attached to bridge **br1.40** (VLAN 40). To use another bridge: `BRIDGE=br0 ./deploy-rina-vm.sh`. To use a libvirt network: `BRIDGE= NETWORK=default ./deploy-rina-vm.sh`
|
||||
- **Resources:** `CPU=4 MEMORY_GB=8 DISK_GB=256 ./deploy-rina-vm.sh`
|
||||
|
||||
## Firewall and SSH (same as “Rina PC”)
|
||||
@@ -91,25 +97,28 @@ runcmd:
|
||||
|
||||
Adjust rules to match your Rina PC before deploying.
|
||||
|
||||
## Interface name (192.168.0.225 not working)
|
||||
## Interface name (wrong IP or DHCP)
|
||||
|
||||
If the VM gets an IP via DHCP instead of 192.168.0.225, the interface name might not be `enp1s0`. On the VM run `ip a` and note the main interface (e.g. `eth0`). Then in `cloud-init/user-data`, change the `network.ethernets` key from `enp1s0` to that name, rebuild the seed ISO, and redeploy (or fix netplan inside the VM once).
|
||||
If the VM gets an IP via DHCP instead of 192.168.0.225, the interface name might not be `enp1s0`. On the VM run `ip a` and note the main interface (e.g. `eth0`). Then in `cloud-init/user-data` (and `cloud-init/network-config` if used), change the `network.ethernets` key from `enp1s0` to that name, rebuild the seed ISO, and redeploy (or fix netplan inside the VM once).
|
||||
|
||||
## Useful commands (on the host)
|
||||
|
||||
```bash
|
||||
virsh list --all
|
||||
virsh console rina
|
||||
virsh shutdown rina
|
||||
virsh start rina
|
||||
virsh console CUBE
|
||||
virsh shutdown CUBE
|
||||
virsh start CUBE
|
||||
```
|
||||
(Use your `VM_NAME` if you overrode it.)
|
||||
|
||||
## Files
|
||||
|
||||
- `deploy-rina-vm.sh` – Deploy script (download image, create disk, build seed ISO, virt-install).
|
||||
- `cloud-init/user-data` – User `rina`, password, sudo, SSH, packages, static IP, 4 GB swap.
|
||||
- `deploy-rina-vm.sh` – Deploy script (VM name **CUBE**, bridge **br1.40** by default; download image, create disk, build seed ISO, virt-install).
|
||||
- `setup-vlan40-bridge.sh` – Optional one-off script to create br1.40 and attach eth1.40; for persistent config use systemd-networkd (see docs).
|
||||
- `cloud-init/user-data` – User `rina`, password, sudo, SSH, packages, static IP (192.168.0.225), 4 GB swap.
|
||||
- `cloud-init/meta-data` – Instance ID and hostname.
|
||||
- `cloud-init/network-config` – Standalone netplan-style config (reference; main config is in user-data).
|
||||
- `docs/vlan40-bridge-systemd-networkd.md` – Host setup for VLAN 40 and bridge br1.40 with systemd-networkd.
|
||||
|
||||
## Reference
|
||||
|
||||
|
||||
Reference in New Issue
Block a user