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.
Step 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.
Step 2: Install MongoDB
Install MongoDB with the following command.
pkg install mongodb
Step 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
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
At any time, you can verify that the Mongo service (mongod
) is running by using the command service mongod onestatus
.
Step 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 $300 by adding new articles
Suggest an update
Request an article