How to install Mongodb in Ubuntu ?


Install Mongodb in to your server using this script in 5mins


#import key
apt-key adv --keyserver hkp:// --recv 0C49F3730359A14518585931BC711F9BA15703C6
#Adding Repo
echo "deb [ arch=amd64,arm64 ] xenial/mongodb-org/3.4 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-3.4.list`
#Database update for new repo
apt-get update
#command to install mongodb
apt-get install -y mongodb-org
#start service
service mongod start
service mongod restart

Important commands for mongodb

How to access mongodb remotely

vim /etc/mongo.conf


# bindIp:

service mongod restart

## Create User

use admin

db.createUser( { user: Important commands for mongodb"advancetracker", pwd: "B6g3940huwMB1Vp", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] })

## connect mongodb remotely using this command

mongo --host --port 27017 -u advancetracker -p --verbose --authenticationDatabase admin

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.