From a previous post we talked about the MySQL data base. From this post I’m going to talk about another data base, MongoDB, which is an open source document data base. Document data base means that a record in MongoDB is a document. If you can remember in MySQL all the records were in relations or tables. MongoDB document, which is a data structure composed of field and value pairs will store data. MongoDB provides high performance, high availability and automatic scaling as well. Below there is an example of a document in MongoDB.
Now let’s see how to install MongoDB on LINUX.
- You can download ‘.tgz‘ file from this url.
- Next extract it anywhere you like.
tar -zxvf <mongodb-install-directory>/mongodb-linux-x86_64ubuntu1404-3.2.1.tgz
- Add path variables to the ‘./bashrc’.
sudo gedit $HOME/.bashrc
- Now we have to create the ‘data’ directory.
sudo mkdir -p /data/db
- Next change the permissions of created directories.
chmod a+rwx -R /data/db
- Now we are ready to go, to check whether the MongoDB has installed successfully, type the following command.
- Then let’s start the MongoDB server.
- Then open a new terminal and type the following command to connect to the server as a client.
- Now you can work on MongoDB.
- When you are finished working, exit the client.
- Finally you can shutdown the server by pressing ‘Ctrl + C‘.
This is how to successfully install MongoDB on your computer and work with it. Hope now you could be able to install it by yourself. Thank You!