Install VirtualBox
I started by installing the virtualbox-ose-nox11 package which enables running headless virtual machines. The VirtualBox kernel module (virtualbox-ose-kmod) will also be installed.
% sudo pkg install virtualbox-ose-nox11
Unfortunately, currently on FreeBSD 11.2 the VirtualBox kernel module must be compiled from source or the system will crash during boot (if the kernel module is loaded at boot).
Compiling the virtualbox-ose-kmod is straightforward. First you must have the FreeBSD sources installed.
% fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/11.2-RELEASE/src.txz % tar -C / -xzvf src.txz
Next I installed the ports collection to compile the virtualbox-ose-kmod port from source.
portsnap fetch
portsnap extract
Finally I compiled and installed the virtualbox-ose-kmod port. Make first refused to install the module because it was already installed. I followed the instructions in the error output and deinstalled the old port then installed the newly compiled one.
% cd /usr/ports/emulators/virtualbox-ose-kmod
% sudo make install
% sudo make deinstall
% sudo make reinstall
Following the post-install instructions,
- edit /boot/loader.conf to load the vboxdrv kernel module at boot,
vi /boot/loader.conf
…
vboxdrv_load=“YES”
2) increase AIO limits by editing /etc/sysctl.conf (my server is using AIO, for more information refer to the virtualbox-ose-nox11 pkg-message).
vfs.aio.max_buf_aio=8192
vfs.aio.max_aio_queue_per_proc=65536
vfs.aio.max_aio_per_proc=8192
vfs.aio.max_aio_queue=65536
You can then reboot the system to load the kernel module (or it can be loaded manually).
The user that VirtualBox runs as must be a member of the vboxusers group. For simplicity, I’ll run VirtualBox using my own username, although best practise would be to create a dedicated user.
pw groupmod vboxusers -m dale
Edit /etc/rc.conf to run vboxwebsrv (the Virtual Box web interface daemon) using the provided startup script installed in /usr/local/etc/rc.d/
% sudo vi /etc/rc.conf
vboxwebsrv_enable=“YES”
vboxwebsrv_user=“dale”
and finally start the vboxwebsrv service.
% sudo service vboxwebsrv start
% sudo service vboxwebsrv status
This does not start a virtual machine. I will use phpVirtualBox to manage virtual machines interactively. A vboxheadless rc.d script is provided if you wish to automate starting a vm at system boot.
Install phpVirtualBox
phpVirtualBox is a web-based management application for VirtualBox.
pkg install phpvirtualbox
Edit the phpVirtualBox config.php file appropriately.
vi /usr/local/www/phpvirtualbox/config.php
var $username = ‘dale’;
var $password = ‘dale_login_password’;
Finally configure the webserver to serve phpVirtualBox. I use Apache 2.4 and added a virtual host definition to /usr/local/etc/apache24/extra/httpd-vhosts.conf to serve phpvirtualbox as a phpvirtualbox.dalescott.net.
Start the vm and then login to ERPNext from a browser (e.g. www.dalescott.net:8080) using the default credentials. The new site wizard will run and lead you through ERPNext configuration. Use a secure password when defining the initial (admin) user, and the wizard will delete the initial Administrator user (with default password) when complete.
Once logged into ERPNext, you will likely want to setup email processing so that users will receive notifications outside of ERPNext. This will be valuable to understanding and appreciating ERPNext’s significant social aspect. You will also want to change the password for the configured system user to something secure (or even disable password authentication entirely in favour of key-based authentication).