How to install Mongodb in Ubuntu ?
Install Mongodb in to your server using this script in 5mins
#!/bin/sh #import key apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6 #Adding Repo echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu 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 #restart service mongod restart
Important commands for mongodb
How to access mongodb remotely
vim /etc/mongo.conf
Comment
# bindIp: 127.0.0.1 service mongod restart
## Create User
mongo 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 192.168.10.18 --port 27017 -u advancetracker -p --verbose --authenticationDatabase admin