Install MongoDb on Ubuntu
Step 1 — Importing the Public Key
To do so, execute:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
To do so, execute:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10
Step 2 — Creating a List File
Issue the following command to create a list file for MongoDB.
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list
Step 3 — Installing and Verifying MongoDB
Now we can install the MongoDB package itself.
sudo apt-get install -y mongodb-org
After package installation MongoDB will be automatically started. You can check this by running the following command.
service mongod status
To start server at any time, issue command
mongod
To open server shell at any time, issue command
mongo
* If server is unable to connect to their path & having path error :
make directory data/db in root & set the path by this command :
mongod --dbpath path_root
Comments
Post a Comment