The following content is reproduced from http://be-evil.org/install-mongodb-on-centos.html
1. Download The MongoDB database for Linux
Go to the official download page to download the Linux version of MongoDB. Choose either 32-bit or 64-bit based on your needs.
Http://www.mongodb.org/downloads
Or you can directly use wget to download it on the server.
Wget http://fastdl.mongodb.org/linux/mongodb-linux-i686-1.8.2.tgz
Decompress the package after the download is complete.
Tar zxf mongodb-linux-i686-1.8.2.tgz
2. Installation preparation
Move MongoDB to the/usr/local/mongdb folder
Music mongodb-linux-i686-1.8.2/usr/local/MongoDB
Create a database folder
Mkdir/usr/local/MongoDB/Data
Add the MongoDB startup project to RC. Local to ensure that MongoDB is started when the server is started.
Echo "/usr/local/MongoDB/bin/mongod -- dbpath =/usr/local/MongoDB/Data">/etc/rc. Local
Start MongoDB
/Usr/local/MongoDB/bin/mongod -- dbpath =/usr/local/MongoDB/Data
The output indicates that MongoDB is started.
If you are not at ease, run the following command:
/Usr/local/MongoDB/bin/Mongo
To enter the shell mode of MongoDB. If the following output is displayed, it indicates that MongoDB has been started successfully, have fun!
Additional content:
How to install the MongoDB production environment using yum
Create and edit
/Etc/yum. Repos. d/10gen. Repo
For 64-bit systems, enter the following content
[10gen]
Name = 10gen Repository
Base url = http://downloads-distro.mongodb.org/repo/redhat/ OS /x86_64
Gpgcheck = 0
For 32-bit systems, enter the following content:
[10gen]
Name = 10gen Repository
Base url = http://downloads-distro.mongodb.org/repo/redhat/ OS /i686
Gpgcheck = 0
Note that MongoDB has 2 GB Data capacity limit in a 32-bit System
Save and run the following command
Yum install mongo-10gen-server
MongoDB can be installed.