The tutorial in the link in references helped much for this. The steps are fairly straight forward
1. mkdir mongodb
2. cd mongodb/
3. curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.7.tgz
4. tar xvf mongodb-linux-x86_64-3.4.7.tgz
5. mv mongodb-linux-x86_64-3.4.7 mongodb
6. cd mongodb
7. echo $PATH
8. export PATH=$PATH:/home/journal/mongodb/mongodb/bin
9. mkdir data
10. cd bin
11. ./mongod --dbpath /home/journal/mongodb/mongodb/data &
That's it, the DB is up.
Now we can even check the connection using the steps below
root@dev [~]# cd /home/journal/mongodb/mongodb/bin/
root@dev [/home/journal/mongodb/mongodb/bin]# ./mongo
MongoDB shell version: 3.4.7
connecting to: test
> show dbs
admin (empty)
local 0.078GB
> use journaldev
switched to db journaldev
> db.names.save({"id":123,"name":"Pankaj"})
WriteResult({ "nInserted" : 1 })
> db.names.find()
{ "_id" : ObjectId("53df918adbef24e88560fa5b"), "id" : 123, "name" : "Pankaj" }
> db.datas.save({})
WriteResult({ "nInserted" : 1 })
> show collections
datas
names
system.indexes
> show dbs
admin (empty)
journaldev 0.078GB
local 0.078GB
> exit
bye
root@dev [/home/journal/mongodb/mongodb/bin]#
References
https://www.journaldev.com/3849/install-mongodb-linux
1. mkdir mongodb
2. cd mongodb/
3. curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.4.7.tgz
4. tar xvf mongodb-linux-x86_64-3.4.7.tgz
5. mv mongodb-linux-x86_64-3.4.7 mongodb
6. cd mongodb
7. echo $PATH
8. export PATH=$PATH:/home/journal/mongodb/mongodb/bin
9. mkdir data
10. cd bin
11. ./mongod --dbpath /home/journal/mongodb/mongodb/data &
That's it, the DB is up.
Now we can even check the connection using the steps below
root@dev [~]# cd /home/journal/mongodb/mongodb/bin/
root@dev [/home/journal/mongodb/mongodb/bin]# ./mongo
MongoDB shell version: 3.4.7
connecting to: test
> show dbs
admin (empty)
local 0.078GB
> use journaldev
switched to db journaldev
> db.names.save({"id":123,"name":"Pankaj"})
WriteResult({ "nInserted" : 1 })
> db.names.find()
{ "_id" : ObjectId("53df918adbef24e88560fa5b"), "id" : 123, "name" : "Pankaj" }
> db.datas.save({})
WriteResult({ "nInserted" : 1 })
> show collections
datas
names
system.indexes
> show dbs
admin (empty)
journaldev 0.078GB
local 0.078GB
> exit
bye
root@dev [/home/journal/mongodb/mongodb/bin]#
References
https://www.journaldev.com/3849/install-mongodb-linux
Thank you for sharing this post.
ReplyDeleteAWS Training in Chennai
AWS Training Institute in Chennai
AWS Training Center in Chennai
Best AWS Training in Chennai
AWS Training Courses in Chennai