Click here to Skip to main content
15,890,897 members
Articles / Database Development / MongoDB
Tip/Trick

Installing Mongodb in Fedora

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
5 Apr 2015CPOL1 min read 10.4K   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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
China China
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
-- There are no messages in this forum --