Frankly, the simplest way I have found to install ERPNext on FreeBSD is to use the ERPNext Virtual Image with VirtualBox and phpVirtualBox. VirtualBox is supported on FreeBSD, and phpVirtualBox is a popular web application that duplicates the native VirtualBox manager for headless servers (and saved me from learning the intricacies of the Virtual Box cli). A big shout-out to Ian More for creating phpVirtualBox, and to the phpVirtualBox community – including 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 eventually had to switch to CentOS. This time I decided to try VirtualBox. I initially considered the BSD hypervisor bhyve, but bhyve does not directly support an Open Virtualization Format (OVF) disk image (although it is reportedly possible to use qemu-img to convert the OVF image to a raw image, which is supported by VirtualBox).
The server is de-branded HP Media Centre PC, with an E6600 Core 2 CPU and 3 GB of DDR2 PC2-5300. I was concerned about performance with only 3 GB of RAM but usability has been satisfactory, albeit to date under relatively light load. htop shows an increase in RAM and swap use with VirtualBox, but RAM use is still below 1 GB and swap use is under 100 MB.
Please comment if you found this information useful. It’s kind of a poll. Thanks.
# pkg install virtualbox-ose
The vboxdrv kernel module needs to be loaded at boot, done by editing /boot/loader.conf
# vi /boot/loader.conf ... vboxdrv_load="YES"
Reboot the system to have the kernel module loaded.
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 however does not actually start a virtual machine. I will be using phpVirtualBox to manage virtual machines interactively. However, a vboxheadless rc.d script is also provided to start a virtual machine automatically during 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/local/etc/vbox (a suitably arbitrary location).
% 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).
More about phpVirtualBox
phpVirtualBox may be a project in transition. Although researching the internet showed phpVirtualBox to be the most popular web UI for VirtualBox, it still appears to depend primarily on the project founder for development support.
The phpVirtualBox project was first hosted on Sourceforge. Although the code repository was later moved to GitHub, Sourceforge still hosts the distribution archives and documentation wiki.
The future of phpVirtualBox though is not completely certain, which is unfortunate as phpVirtualBox is the only web interface for VirtualBox. The GitHub repo is the only repo managed by the phpVirtualBox organization, which has has no public members and no written statement of direction. The FreeBSD phpvirtualbox port update from July 2017, billed as an “unofficial 5.1-1 release” was cherry picked from unaccepted community merge requests and included the comment “Sadly upstream is very silent”.
However, given the popularity of phpVirtualBox, and that it’s licensed using the GPL v3, I’m confident it will survive.