Step 1: Update Package Repository
Step 2: Install MongoDB
Step 3: Start and Verify MongoDB
Step 4: Start Mongo on Boot
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
Ha nem szeretné az "onestart"-ot használni a Mongo indításakor, beállíthatja, hogy működjön starthelyette. Ehhez szerkessze /etc/rc.confa vi-val vagy kedvenc szerkesztőjével, és adja hozzá mongod_enable="YES"a fájlhoz. Ha elkészült, akkor a kiszolgáló indításakor elindul, és most már használhatja service mongod starta Mongo szolgáltatást. Más serviceparancsok is elérhetők lesznek , mint például a stopés status.