MeteorJS on Freebsd 11 current

Meteor is a fantastic web framework, it bundles under the hood NodeJS, MongoDB and others open source packages. Unfortunatly the official support is only for Linux and Mac OS X operative systems.

UPDATE 11/2015: There is an active effort to have a "classic" Meteor experience on FreeBSD and *BSD, have a look here for more info.

But if you need to deploy Meteor apps, another operative system may be considered.. Windows? No, Freebsd and for it's out-the-box ZFS support.

FreeBSD is UNIX®, anyway you have to consider that some Open Source technologies may not have a mainstream support on FreeBSD. Personally:

  • FreeBSD 10 Gnome 3.12 gave me kernel panic on KVM, while FreeBSD 11 is fine (tested from a qcow2 image)
  • NodeJS and MongoDB run on Freebsd but on their websites it isn't much advertised.
  • Latest MongoDB supported by Meteor is MongoDB 2.4.x, the 2.6.x isn't supported yet by Meteor and Freebsd

Installation of Meteor's dependencies

sudo pkg install -y git node npm mongodb python gmake

I assume you previously installed "sudo" on Freebsd. "pkg install" will download and install the binary packages as much as "apt-get" on Debian/Ubuntu GNU/Linux distro.

sudo ln -s /usr/bin/clang++ /usr/bin/g++

It allows to you to use Clang as a GNU C++ (gcc) compiler, it works in this situation but if you really need gcc install gcc.

sudo service mongod onestart 

It will start the MongoDB daemon, it a non persistent way, if you want it at the next reboot add 'mongod_enable="YES"' to /etc/rc.conf (without the single quote ' )

The ground is ready, now you need a Meteor app to run.

Run a Meteor app from a bundle

From your Meteor development environment you can obtain a bundle with all the application dependencies running "meteor bundle deploy.tgz", then move the deploy.tgz on Freebsd and uncompress it.

This bundle contains also some Linux binaries, which must be rebuilt for Freebsd

cd bundle/server/node_modules # or bundle/programs/server/node_modules/ on older Meteor versions
rm -rf fibers
npm install fibers@1.0.1
cd -

Now you should be ready to run a basic Meteor app on Freebsd, look at the official documentation for further env variables and tweaks.

PORT=3000 MONGO_URL="mongodb://localhost:27017/myappdb" node bundle/main.js

If you also want to develop on Freebsd there is a fork stopped and year ago

corso javascript