How do I install the MongoDB database on Ubuntu (I to install MongoDB on Ubuntu)Published:may, Updated:may, Author:mkyong
The following will describe how to install MongoDB in your ubuntu11.10
Summary of steps:
In your source.list add 10 gen Packs (add 10gen package to Source.list) Upgrade the System Package (update package) with sudo apt-get Update
Add GPG key (add GPG key) Install Mongodb-10gen
Done
1. ADD 10gen package to Source.list
The 10gen package contains the latest MongoDB version, append below line to the end of the file/etc/apt/sources.list "
Deb Http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen
For example, your can vim the "source.list" and append the 10gen package like this:
$ sudo vim/etc/apt/sources.list
File:/etc/apt/sources.list
#...content omitted
...
# # This software isn't part of Ubuntu, but are offered by Third-party
# # developers who want to ship their latest Software.
Deb Http://extras.ubuntu.com/ubuntu Natty main
deb-src http://extras.ubuntu.com/ubuntu Natty main
# MONGO Repo ############## #new line
deb Http://downloads-distro.mongodb.org/repo/ubuntu-upstart Dist 10gen
2. Update Package
Update the modified "/etc/apt/sources.list":
sudo apt-get update
Now, the A new "Mongodb-10gen –an object/document-oriented database" is available for install. 3. Add GPG Key
10gen package Required GPG key, import it:
sudo apt-key adv--keyserver keyserver.ubuntu.com--recv 7F0CEB10
4. Install Mongodb-10gen
Everything is ready, now you can Install the MongoDB package:
sudo apt-get install Mongodb-10gen
5. Post-Installation
Now, MongoDB are installed, started, and auto start MongoDB script is generated to "/etc/init/mongo" and "/etc /init.d/mongo". In addition, all mongoDB the files are copied to "/usr/bin" folder.
The main configuration file "mongodb.conf" is located at "/etc/mongodb.conf", and the change of the values to Custo Mize your MongoDB server.
File:mongodb.conf
# mongodb.conf
# Where to store the data.
# Note:if You run MongoDB as a non-root user (recommended) your may
# need to the Create and set permissions for this directory manually,
# e.g., if the parent directory isn ' t mutable by the MongoDB user.
Dbpath=/var/lib/mongodb
#where to log
logpath=/var/log/mongodb/mongodb.log
logappend= True
#port = 27017
# ...
6. Verification
To verify it, just connect it with "MONGO"
$ MONGO
MongoDB shell version:1.8.1
connecting to:test
>