#installingmongodbubuntu
Explore tagged Tumblr posts
nanywilson-blog · 8 years ago
Text
How to Install MongoDB on Debian/Ubuntu
Tumblr media
MongoDB is becoming more popular now-a-days.
How to Install MongoDB on Debian/Ubuntu
NoSQL (originally referring to “non SQL”, “non relational” or “not only SQL” as per Wikipedia.)
Due to its No Structured Language architecture, this is preferred by many Corporate Giants and Big Companies. They are migrating their storages to MongoDB because of its high performance and high-availability and easy scalability options.
The MongoDB stores the data not in a relational format, but through simple JSON format. The MongoDB calls it BSON. BSON is nothing but a binary form of storage of objects and arrays.
Tumblr media
Terms compared between MongoDB and MySQL DB
Following is the simple comparison of terms compared between MySQL DB and MongoDB.
MySQL DB                             MongoDB text
Database                                Database
Table                                       Collection
Rows                                      Document
Column                                   –
We do not have table columns in MongoDB, as it does not have a fixed table schema structure.
How to install MongoDB on Debian/Ubuntu
Following are the steps involved in installing MongoDB on Debian/Ubuntu servers. The following tutorial describes the installation of MongoDB version (3.2)
Importing Public Key We need to import the GPG public key for the Debian package management, in order to install using apt-get, done using following command
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927  
Creating Source List File We need to create the source list file, so that sources for installing MongoDB can be fetched while using apt-get install, done using following command.
echo "deb http://repo.mongodb.org/apt/ubuntu "$(lsb_release -sc)"/mongodb-org/3.2 multiverse"
 | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
This will fetch the right source list file based on your operating system distribution.
Update Source Repository Update the apt-get repository to reload the source repository changes using following command.
sudo apt-get update
Install MongoDB Install the latest stable version of MongoDB using following command.
sudo apt-get install -y mongodb-org
Running MongoDB You can use following commands to start / stop / restart and getting status regarding MongoDB service.
service mongod start       // To start MongoDB Service
 service mongod stop        // To stop running MongoDB Service
 service mongod restart     // To restart running MongoDB Service
 service mongod status      // To get status of running MongoDB Service
 Verify if MongoDB is running You can use the following command to see if MongoDB has started and is running fine.
netstat -nalp | grep mongod
 // This command will show you the output of mongod service running using port 27017
 tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN      35482/mongod
 The MongoDB by default uses port 27017 The default configuration path is /etc/mongod.conf The logs by default get stored in the path /var/log/mongodb/mongod.log
  By default MongoDB will listen to only 127.0.0.1,   If you want MongoDB to listen on your network interfaces,   you need to configure them manually in the configuration file.
 MongoDB Shell MongoDB shell can be opened using following command.
 mongo
In case, you get errors in opening MongoDB shell cli, then you need to export LC environment variables using following command
export LC_ALL=C
 mongo                 // Start Mongo shell after running export command
Note: The installation steps covered above are for the open-source community edition of MongoDB.
 MongoDB UI MongoDB does not include any User Interface or GUI for management. There are many 3rd party tools available like
MongoBooster RoboMongo
0 notes