VirtualBox : Create Virtual Machines2024/03/19 |
Create a Virtual Machine.
On this example, create a VM to install FreeBSD 14. |
|
[1] | Create a Virtual Machine. |
root@dlp:~ # ifconfig vtnet0: flags=1008943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST,LOWER_UP> metric 0 mtu 1500 options=c00b8<VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,VLAN_HWTSO,LINKSTATE> ether 52:54:00:6c:78:51 inet 10.0.0.30 netmask 0xffffff00 broadcast 10.0.0.255 inet6 fe80::5054:ff:fe6c:7851%vtnet0 prefixlen 64 scopeid 0x1 media: Ethernet autoselect (10Gbase-T <full-duplex>) status: active nd6 options=23<PERFORMNUD,ACCEPT_RTADV,AUTO_LINKLOCAL> lo0: flags=1008049<UP,LOOPBACK,RUNNING,MULTICAST,LOWER_UP> metric 0 mtu 16384 options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 groups: lo nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> # disable checksum offload if you like to run VM in bridge networking root@dlp:~ # ifconfig vtnet0 -rxcsum -txcsum -rxcsum6 -txcsum6 -tso -lro root@dlp:~ # echo "ifconfig vtnet0 -rxcsum -txcsum -rxcsum6 -txcsum6 -tso -lro" >> /etc/rc.conf
# create a directory for VM root@dlp:~ # mkdir /var/vbox
# create a VM root@dlp:~ # VBoxManage createvm \ --name FreeBSD_14 \ --ostype FreeBSD_64 \ --register \ --basefolder /var/vbox Virtual machine 'FreeBSD_14' is created and registered. UUID: 945d43c5-8dbe-4ed7-80d1-34b7c903ae6a Settings file: '/var/vbox/FreeBSD_14/FreeBSD_14.vbox' # modify settings for VM # replace the interface name [vtnet0] to your own environment # for VNCPassword, set any VNC password you like root@dlp:~ # VBoxManage modifyvm FreeBSD_14 \
--cpus 4 \ --memory 4096 \ --nic1 bridged \ --bridgeadapter1 vtnet0 \ --boot1 dvd \ --vrde on \ --vrdeport 5901 \ --vrdeproperty VNCPassword=password # configure storage for VM root@dlp:~ # VBoxManage storagectl FreeBSD_14 --name "FreeBSD_14_SATA" --add sata root@dlp:~ # VBoxManage createhd \ --filename /var/vbox/FreeBSD_14/FreeBSD_14.vdi \ --size 20480 \ --format VDI \ --variant Standard 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% Medium created. UUID: 60fffb71-5ba2-46f8-a69a-05885b6b9cce root@dlp:~ # VBoxManage storageattach FreeBSD_14 \
--storagectl FreeBSD_14_SATA \ --port 1 \ --type hdd \ --medium /var/vbox/FreeBSD_14/FreeBSD_14.vdi # configure DVD drive for VM # example below, it specifies an ISO file for installation root@dlp:~ # VBoxManage storageattach FreeBSD_14 \
--storagectl FreeBSD_14_SATA \ --port 0 \ --type dvddrive \ --medium /home/FreeBSD-14.0-RELEASE-amd64-dvd1.iso # confirm settings for VM root@dlp:~ # VBoxManage showvminfo FreeBSD_14 Name: FreeBSD_14 Groups: / Guest OS: FreeBSD (64-bit) UUID: 945d43c5-8dbe-4ed7-80d1-34b7c903ae6a Config file: /var/vbox/FreeBSD_14/FreeBSD_14.vbox Snapshot folder: /var/vbox/FreeBSD_14/Snapshots Log folder: /var/vbox/FreeBSD_14/Logs Hardware UUID: 945d43c5-8dbe-4ed7-80d1-34b7c903ae6a Memory size: 4096MB Page Fusion: disabled VRAM size: 8MB CPU exec cap: 100% HPET: disabled CPUProfile: host Chipset: piix3 Firmware: BIOS Number of CPUs: 4 PAE: enabled Long Mode: enabled Triple Fault Reset: disabled APIC: enabled X2APIC: disabled Nested VT-x/AMD-V: disabled CPUID Portability Level: 0 CPUID overrides: None Boot menu mode: message and menu Boot Device 1: DVD Boot Device 2: DVD Boot Device 3: HardDisk Boot Device 4: Not Assigned ..... ..... # * if detach DVD, run like follows root@dlp:~ # VBoxManage storageattach FreeBSD_14 --storagectl FreeBSD_14_SATA --port 0 --device 0 --medium none |
[2] | Start a Virtual Machine. |
root@dlp:~ #
VBoxManage startvm FreeBSD_14 --type headless Waiting for VM "FreeBSD_14" to power on... vboxdrv: XXXXXXXXXXXXXXXX VMMR0.r0 vboxdrv: XXXXXXXXXXXXXXXX VBoxDDR0.r0 VMMR0InitVM: eflags=40246 fKernelFeatures=0x2 (SUPKERNELFEATURES_SMAP=1) VM "FreeBSD_14" has been successfully started. # * if stop VM, run like follows root@dlp:~ # VBoxManage controlvm FreeBSD_14 poweroff # * if remove VM, run like follows root@dlp:~ # VBoxManage unregistervm FreeBSD_14 |
[3] |
It's possible to connect to VM with VNC from remote computers.
This example is based on Windows 11 and UltraVNC. Download UltraVNC from the site below.
⇒ https://www.uvnc.com/downloads/ultravnc.html
After installing UltraVNC, click [UltraVNC Viewer] to run, then, following window is shown.Input [(VirtualBox Server hostname or IP address):(vrdeport you et for the VM)] like following example and then click the [Connect] button. |
[4] | You will be asked to enter the VNC password, so enter the password you set for [VNCPassword=xxx] in [1]. |
[5] | If the connection is successful, the installation will proceed as normal. |
Sponsored Link |
|