Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Installing Mongodb in Fedora

0.00/5 (No votes)
5 Apr 2015 1  
Installing Mongodb

Introduction

There are two steps for installing Mongodb in Linux operating system.

  1. Creating a directory the mongodb server can write to.
  2. Choosing a correct version of mongodb base on your operating system.

For Step #1

The mongodb will use /data/db directory as the default path for the data storing.

We can use the following commands to create the directory and set related permissions:

$ mkdir -p /data/db

$ chown -R $USER:$USER /data/db

And instead of using the default path, we can create a directory in our home folder for storing data. I prefer this way because there are no permisson issues under our home folder.

We can use the following commands to create the directory under our home folder:

$ cd ~

$ mkdir mongodb

For Step #2

Go to http://www.mongodb.org to get the correct version base on your system.

I am using a 32bits Fedora system, so I use the following command to get and decompress the tgz file :

$ wget https://fastdl.mongodb.org/linux/mongodb-linux-i686-3.0.1.tgz

$ tar -zxf mongodb-linux-i686-3.0.1.tgz

After the above commands have been executed successfully, we can get the bin/mongod command to start the database server. And in order to call the mongod command more conveniently, let's put the path which contains mongod command into PATH:

    $ echo "the path which decompress the tgz file 
to"/mongodb-linux-i686-3.0.1/bin >> /etc/profile (this need root permission)

    $ source /etc/profile

After all these have been done, we can start the database server now:

$ mongod    //for /data/db

OR:

$ mongod --dbpath "the directories you created for store the mongodb data"

And we have reached the end of this installation, thanks for reading.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here