Installing MongoDB under Centos
First, installation method
Method (i)
1 Configuration Package Management system
Create the /etc/yum.repos.d/mongodb.repo file, of course we use a 64-bit system, 32-bit situation is no longer considered. The contents of the file are:
[Mongodb]name=MongoDB repositorybaseurl=http://Downloads-distro.mongodb.org/repo /redhat/os/x86_64/gpgcheck=0enabled=1
2 Install MongoDB package and associated tools.
sudo yum install mongodb-org
Method (ii)
1 If you install the specified version of MongoDB, or install to the specified directory, you can manually download the MongoDB program, such as the latest version of the MongoDB program for MONGODB-LINUX-X86_64-2.6.4.TGZ.
I am here to download the installer files to this machine, and then upload to the server. The command is as follows
SCP Mongodb-linux-x86_64-2.6.4.tar [Email protected]:/home/tools
2 Decompression Program
Tar zxf mongodb-linux-x86_64-2.6.4.tar/home/mongodb/
3 MongoDB default database files are stored under/DATA/DB, if you use the default, you must create this folder in advance and have write permission, if you change the location of the database file, you can use the –dbpath option to specify the location, the command is as follows:
Mongod--dbpath/home/databases/sdkstat
Second, start
1 Start MongoDB
sudo service Mongod start
2 Stop MongoDB
sudo service Mongod stop
3 Restarting MongoDB
sudo service mongod restart
Official Installation Documentation: Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux
http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/
Installing MongoDB under Centos