I found the simplest “install” for ERPNext on FreeBSD is to use the ERPNext Virtual Image with VirtualBox. VirtualBox is well-supported on FreeBSD, and phpVirtualBox provides a web-based GUI for headless servers. I’d like to thank Ian More and the phpVirtualBox community for phpVirtualBox, and also thank decke@FreeBSD.org for updating the FreeBSD phpvirtualbox port and package.
Several years ago I attempted to install ERPNext on bare metal FreeBSD using the ERPNext Easy Install script, but found too many dependencies on Linux’isms and eventually switched the project server to CentOS. This time I used the virtual machine image provided by erpnext.org. I first considered hosting the vm using bhyve, the BSD hypervisor, but bhyve does not directly support an OVF disk image and it became more convenient to use VirtualBox (reportedly it is possible to convert an OVF image to a raw image using qeum-image, which can then be used by bhyve).
The host server is a re-purposed media PC with Intel E6600 Core 2 CPU and 6 GB RAM (DDR2 PC2-5300) running 64-bit FreeBSD 11.2. ERPNext performance has been completely satisfactory in a demo situation with several users.
I started by installing the virtualbox-ose-nox11 port, it has minimal dependencies and works nicely for someone who just wants to run headless virtual machines.
First I first installed FreeBSD source.
% 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 (not previously required as I had previously been installing binaries using pkg). The FreeBSD sources are required to compile the virtualbox kernel module.
# portsnap fetch # portsnap extract
I then installed virtualbox-ose-nox11 using pkg, which also installs the virtualbox kernel module (virtualbox-ose-kmod),
% 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, but the build tools may need to be compiled first (or you could install them using pkg to save some time). Make will refuse at first to install the kernel module because the one installed by pkg with virtualbox-ose-nox11 is still installed (by pkg). I followed the error messages and “make deinstalled” it, then “make reinstall”.
% cd /usr/ports/emulators/virtualbox-ose-kmod % sudo make install % sudo make deinstall % sudo make reinstall
The post-install instructions then say to:
1) edit /boot/loader.conf to load the vboxdrv kernel module at boot,
# vi /boot/loader.conf ... vboxdrv_load="YES"
and then 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.
# 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.
<VirtualHost phpvirtualbox.dalescott.net> DocumentRoot "/usr/local/www/phpvirtualbox" <Directory "/usr/local/www/phpvirtualbox"> allow from all Options None Require all granted </Directory> </VirtualHost>
Download an ERPNext Virtual Machine image (*.ova file) to /usr/home/dale/downloads (or some other suitably arbitrary location).
% cd ~/downloads % wget http://build.erpnext.com/ERPNext-Production.ova
Using phpVirtualBox, create a new vm by importing the downloaded ERPNext-Production.ova Virtual Image file (File/Import). It includes port forwarding rules to forward client port 80 (used by the vm to serve ERPNext) to host port 8080. There is also a rule to forward ssh from client port 22 to host port 3022.
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).