mirror of
https://github.com/rancher/os.git
synced 2025-09-16 15:09:27 +00:00
VirtualBox convenience scripts
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
#!/bin/bash
|
||||
set -x -e
|
||||
|
||||
set -e
|
||||
|
||||
## DOC: create a RancherOS VM for VirtualBox
|
||||
## the VM uses 2 network interfaces: eth0 (NAT) is for Internet access
|
||||
## eth1 (host-only) is for internal virtual network
|
||||
|
||||
## NOTE: host-only NIC `vboxnet1` should already exist!
|
||||
|
||||
cd $(dirname $0)/..
|
||||
: RANCHER_ISO=${RANCHER_ISO:="./dist/artifacts/rancheros.iso"}
|
||||
@@ -19,17 +25,22 @@ fi
|
||||
GITSHA=$(git rev-parse --short HEAD)
|
||||
VM="RancherOS-${GITSHA}"
|
||||
|
||||
VBoxManage createhd --format vhd --filename ./dist/artifacts/$VM.vhd --size 8000
|
||||
VBoxManage createhd --format vmdk --filename ./dist/artifacts/$VM.vmdk --size 40000
|
||||
|
||||
VBoxManage createvm --name $VM --ostype "Linux_64" --register
|
||||
|
||||
VBoxManage storagectl $VM --name "IDE Controller" --add ide
|
||||
VBoxManage storageattach $VM --storagectl "IDE Controller" --port 0 --device 0 \
|
||||
--type hdd --medium ./dist/artifacts/$VM.vhd
|
||||
VBoxManage storageattach $VM --storagectl "IDE Controller" --port 1 \
|
||||
--device 0 --type dvddrive --medium ${RANCHER_ISO}
|
||||
VBoxManage storagectl $VM --name "SATA" --add sata
|
||||
VBoxManage storageattach $VM --storagectl "SATA" --port 0 --type hdd --medium ./dist/artifacts/$VM.vmdk
|
||||
VBoxManage storageattach $VM --storagectl "SATA" --port 1 --type dvddrive --medium ${RANCHER_ISO}
|
||||
|
||||
VBoxManage modifyvm $VM --memory 1024 --acpi on --boot1 dvd --boot2 disk
|
||||
VBoxManage modifyvm $VM --memory 1024 --acpi on --boot1 disk --boot2 dvd
|
||||
VBoxManage modifyvm $VM --rtcuseutc on
|
||||
VBoxManage modifyvm $VM --usb off
|
||||
VBoxManage modifyvm $VM --audio none
|
||||
VBoxManage startvm $VM
|
||||
VBoxManage modifyvm $VM --nic1 nat
|
||||
VBoxManage modifyvm $VM --nictype1 virtio
|
||||
VBoxManage modifyvm $VM --nic2 hostonly
|
||||
VBoxManage modifyvm $VM --nictype2 virtio
|
||||
VBoxManage modifyvm $VM --hostonlyadapter2 vboxnet1
|
||||
|
||||
#VBoxManage startvm $VM
|
||||
|
11
scripts/vboxnet-dhcp
Executable file
11
scripts/vboxnet-dhcp
Executable file
@@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
set -x -e
|
||||
|
||||
## DOC: configure VirtualBox vboxnet1 host-only virtual network for use with a RancherOS VM cluster
|
||||
|
||||
## NOTE: host-only NIC `vboxnet1` should already exist!
|
||||
|
||||
vboxmanage hostonlyif ipconfig vboxnet1 --ip 172.17.7.1
|
||||
vboxmanage dhcpserver remove --ifname vboxnet1 && :
|
||||
vboxmanage dhcpserver add --ifname vboxnet1 --ip 172.17.7.100 --netmask 255.255.255.0 \
|
||||
--lowerip 172.17.7.101 --upperip 172.17.7.254 --enable
|
Reference in New Issue
Block a user