⬆️ ⬇️

VirtualBox on FreeBSD without X11

image At the moment, the VirtualBox port on FreeBSD is already quite stable and quite suitable for permanent use. But when installed on gui-less machines there are several problems. The following discussion focuses on installing and using VirtualBox on a FreeBSD machine without X11.







Install VirtualBox



The current actual version of the port of VirtualBox is 3.1.2. Starting from version 3.1.0, the port is split into two: virtualbox-ose-kmod (kernel modules) and virtualbox-ose (virtualbox itself).

')

Under FreeBSD only VirtualBox OSE (Open Source Edition) is ported. In it, compared to full VirtualBox, there is no USB device support, and most importantly, a vRDP server is cut out that allows you to connect to the virtual machine with any rdp client.

Without it and without x11, to install the OS on a virtual machine, you will need to install it on a separate computer and then transfer the disk image to the FreeBSD machine.



This problem was solved by one of the FreeNAS developers, screwing a vnc-server to the VirtualBox.

So, then actually install VirtualBox.



First of all, we install the vnc server libraries and VirtualBox kernel modules:

cd /usr/ports/net/libvncserver && make

make install

cd /usr/ports/emulators/virtualbox-ose-kmod && make

make install




After that, download the patch for VirtualBox:

cd ~/patches

fetch www.mail-archive.com/freebsd-stable@freebsd.org/msg108586/vboxvnc-20100211.tar.gz

cd /usr/ports/emulators/virtualbox-ose

tar xvf ~/patches/vboxvnc-20100211.tar.gz




Do

make config

remove all the checkboxes except Guest Additions and DBUS, and set VirtualBox:

make

make install




Add the loading of the VirtualBox module and launching the script to enable the virtual machine adapter to work in bridge mode (without it, only NAT):

echo 'vboxdrv_load="YES"' >> /boot/loader.conf

echo 'vboxnet_enable="YES"' >> /etc/rc.conf




In order not to reboot again, we manually load the module and script:

kldload vboxdrv

/etc/rc.d/vboxnet start




Create and configure a virtual machine



Creating a virtual machine from the console is described in this article, therefore I will only give a sequence of commands:

# ( ostype: VBoxManage list ostype)

VBoxManage createvm --name MicroXP --ostype WindowsXP --register



# (bridgeadapter1 , )

VBoxManage modifyvm MicroXP --memory 256 --floppy disabled --audio none --nic1 bridged --bridgeadapter1 eth0 --vram 4 --accelerate3d off --boot1 disk --acpi on --cableconnected1 on



# ,

VBoxManage createhd --filename /usr/local/vbox/iso/MicroXP.vdi --size 1000 --register



#

VBoxManage storagectl MicroXP --name "IDE Controller" --add ide



#

VBoxManage storageattach MicroXP --storagectl "IDE Controller" --port 0 --device 0 --type hdd --medium /usr/local/vbox/MicroXP.vdi



#

VBoxManage storageattach MicroXP --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /usr/local/vbox/MicroXP-v0.82.iso



#

VBoxManage modifyvm MicroXP --boot1 dvd




Next, start the machine and give it the vnc parameters:

VBoxHeadless --startvm MicroXP -v on -a 192.168.1.1 -p 5900 -S password



Let's turn on the vnc-client (for example, UltraVNC under Windows) and install the OS. Then you need to put guest additions in a virtual machine; without them, the vnc server is sometimes buggy:

VBoxManage storageattach MicroXP --storagectl "IDE Controller" --port 1 --device 0 --type dvddrive --medium /usr/local/lib/virtualbox/additions/VBoxGuestAdditions_3.1.2.iso



After that, the virtual machine is ready for use:





useful links



Source: https://habr.com/ru/post/84469/



All Articles