diff options
Diffstat (limited to 'others')
| -rwxr-xr-x | others/vm3/.config/cloud-init-generator/fedora40.sh | 4 | ||||
| -rw-r--r-- | others/vm3/.docs.swp | bin | 16384 -> 16384 bytes | |||
| -rw-r--r-- | others/vm3/docs | 62 |
3 files changed, 47 insertions, 19 deletions
diff --git a/others/vm3/.config/cloud-init-generator/fedora40.sh b/others/vm3/.config/cloud-init-generator/fedora40.sh index f32327d..fd2f0a0 100755 --- a/others/vm3/.config/cloud-init-generator/fedora40.sh +++ b/others/vm3/.config/cloud-init-generator/fedora40.sh | |||
| @@ -49,8 +49,8 @@ runcmd: | |||
| 49 | - sudo xfs_growfs / | 49 | - sudo xfs_growfs / |
| 50 | - sudo dnf install -y vim git | 50 | - sudo dnf install -y vim git |
| 51 | - cd /home/user | 51 | - cd /home/user |
| 52 | - #git clone https://git.0nom.ch/setup | 52 | - git clone https://git.0nom.ch/setup |
| 53 | - #sudo ./setup/setup.sh | 53 | - sudo ./setup/setup.sh |
| 54 | - touch /home/user/runcmd_done | 54 | - touch /home/user/runcmd_done |
| 55 | EOF | 55 | EOF |
| 56 | 56 | ||
diff --git a/others/vm3/.docs.swp b/others/vm3/.docs.swp index 304e100..3eb0602 100644 --- a/others/vm3/.docs.swp +++ b/others/vm3/.docs.swp | |||
| Binary files differ | |||
diff --git a/others/vm3/docs b/others/vm3/docs index dc5a3e6..e350e4e 100644 --- a/others/vm3/docs +++ b/others/vm3/docs | |||
| @@ -77,20 +77,48 @@ Available images: | |||
| 77 | Usage: ./vm compute create <name> <os> --vcpu 4 --ram 8 --disk 40 --storage-pool prod-store --network prod-net | 77 | Usage: ./vm compute create <name> <os> --vcpu 4 --ram 8 --disk 40 --storage-pool prod-store --network prod-net |
| 78 | 78 | ||
| 79 | # Then use directly | 79 | # Then use directly |
| 80 | ./vm compute create myvm fedora 2 4 20 prod-net prod-store | 80 | ./vm compute create myvm fedora40 prod-net prod-store |
| 81 | 81 | ||
| 82 | 82 | ||
| 83 | 83 | ||
| 84 | 84 | os | |
| 85 | for debian12, | 85 | for debian12, |
| 86 | sudo dnf install libguestfs libguestfs-tools libvirt virt-install virt-manager guestfs-tools | 86 | sudo dnf install libguestfs libguestfs-tools libvirt virt-install virt-manager guestfs-tools |
| 87 | sudo virt-customize -a /var/lib/libvirt/images/.image_store/debian12.qcow2 --root-password password:yourpassword | 87 | sudo virt-customize -a /var/lib/libvirt/images/.image_store/debian12.qcow2 --root-password password:yourpassword |
| 88 | sudo apt update && sudo apt install -y ssh cloud-init | 88 | sudo apt update && sudo apt install -y ssh cloud-init |
| 89 | 89 | ||
| 90 | console works but no ssh, and the generic cloud ssh fails after editing the password(not sure if this is the reason) | 90 | console works but no ssh, and the generic cloud ssh fails after editing the password(not sure if this is the reason) |
| 91 | try to find out how to execute commands in sudo virsh console t1 in a bash script | 91 | try to find out how to execute commands in sudo virsh console t1 in a bash script |
| 92 | not sure if cloud init can work after this but | 92 | not sure if cloud init can work after this but |
| 93 | 93 | ||
| 94 | currently only fedra works fully, debian can work and login after editing the root password | 94 | currently only fedra works fully, debian can work and login after editing the root password |
| 95 | freebsd have not tried editing root password, boots on generic cloud image, no login yet | 95 | freebsd have not tried editing root password, boots on generic cloud image, no login yet |
| 96 | ubuntu no boot no login yet. | 96 | ubuntu no boot no login yet. |
| 97 | |||
| 98 | others | ||
| 99 | ssh | ||
| 100 | public ssh port like online vps | ||
| 101 | this forwards 2222 on the host to port 22 | ||
| 102 | # 1. First, check your VM's IP address (from inside the VM) | ||
| 103 | ip addr show | ||
| 104 | # 2. Set up port forwarding in libvirt | ||
| 105 | virsh net-list # List networks | ||
| 106 | virsh net-edit default # Edit default network config | ||
| 107 | # Add this inside the <network> section: | ||
| 108 | <forward mode='nat'> | ||
| 109 | <nat> | ||
| 110 | <port start='2222' end='2222'> | ||
| 111 | <protocol>tcp</protocol> | ||
| 112 | <forward address='192.168.122.x' port='22'/> # Replace x with your VM's last octet | ||
| 113 | </port> | ||
| 114 | </nat> | ||
| 115 | </forward> | ||
| 116 | # 3. Restart the network | ||
| 117 | virsh net-destroy default | ||
| 118 | virsh net-start default | ||
| 119 | # 4. Configure firewall on Fedora host | ||
| 120 | sudo firewall-cmd --add-port=2222/tcp --permanent | ||
| 121 | sudo firewall-cmd --reload | ||
| 122 | seed.iso | ||
| 123 | move seed.iso to images/vmname/seed.iso | ||
| 124 | allows concurrent usage of vm.sh as there will be no conflicts | ||
