Table of Contents
Was this article helpful?
Try Vultr Today with

$50 Free on Us!

Want to contribute?

You could earn up to $600 by adding new articles.

Installing MongoDB on FreeBSD 10

Last Updated: Sat, Aug 1, 2015
Archived content

This article is outdated and may not work correctly for current operating systems or software.

MongoDB is a world-class NoSQL database that is frequently used in newer web applications. It provides high performance queries, sharding, and replication. This article will show you how to install MongoDB onto FreeBSD 10.x. This article will work for both x86 and x64 architectures, but note that MongoDB works best on a 64-bit architecture.

1. Update Package Repository

To make sure everything is up to date before installing MongoDB, run the following command.

pkg update

If you get a prompt stating that the "package management tool" is not available, type Y, then press Enter for it to continue. You can run pkg update -f to force the update, if needed. Otherwise, continue to step 2.

2. Install MongoDB

Install MongoDB with the following command.

pkg install mongodb

3. Start and Verify MongoDB

Verify the installation of MongoDB. This command will start the service.

service mongod onestart

Once the text "Starting mongod." shows on the screen, you'll be able to use the mongo shell. Run mongo now. You will be presented with an interactive console. The console will resemble the following.

MongoDB shell version: 2.6.7

connecting to: test

Welcome to the MongoDB shell.

For interactive help, type "help".

For more comprehensive documentation, see

Questions? Try the support group

At any time, you can verify that the Mongo service (mongod) is running by using the command service mongod onestatus.

4. Start Mongo on Boot

If you do not wish to use "onestart" for starting Mongo on boot, you can configure it to work with start instead. To do so, edit /etc/rc.conf with vi or your favorite editor and add mongod_enable="YES" to the file. Once complete, it will now start on boot of your server, and you can now use service mongod start to start the Mongo service. Other service commands such as stop and status will be available as well.

Want to contribute?

You could earn up to $600 by adding new articles.