Linux - install MongoDB

Download the installation package official website: https: //www.mongodb.com/download-center#community

1 Download

curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.6.tgz

2 Extract

tar -zxvf mongodb-linux-x86_64-3.0.6.tgz

3 will be copied to the specified directory extract package

mv  mongodb-linux-x86_64-3.0.6/ /home/hadoop/apps/mongodb

4 MongoDB executable file located in the bin directory, add it to the path PATH

sudo vi /etc/profile

Add Content:

export MONGODB_HOME=/home/hadoop/apps/mongodb
export PATH=$PATH:$MONGODB_HOME/bin

5 Create a database directory

mkdir -p /home/hadoop/data/db

Run 6 MongoDB service

cd /home/hadoop/apps/mongodb/bin
mongod --dbpath=/home/hadoop/data/db --rest

-rest parameters: a simple HTTP-enabled user interface

7 newly opened window MongoDB database connection

mongo

8 Test

> db.runoob.insert({x:10})
WriteResult({ "nInserted" : 1 })
> db.runoob.find()
{ "_id" : ObjectId("5d701477606f043f48e5329e"), "x" : 10 }

Reference article link: https: //www.runoob.com/mongodb/mongodb-linux-install.html

Published 544 original articles · won praise 289 · Views 230,000 +

Guess you like

Origin blog.csdn.net/BlessingXRY/article/details/100546043