MongoDB Website: http://www.mongodb.org/
1: Installing MongoDB
Centos7 version of MongoDB without installation, as long as the decompression can be used. MONGODB provides pre-compiled binaries for both 32-bit and 64-bit systems, which you can download from MongoDB website, MongoDB precompiled binary package: https://www.mongodb.com/download-center#community
TAR-ZXVF mongodb-linux-x86_64-rhel70-3.6.4.tgz
MV Mongodb-linux-x86_64-rhel70-3.6.4/opt/mongodb
Then add MongoDB to the path of the system environment variable. Vim/etc/profile export Path=/opt/mongodb/bin: $PATH source/etc/profile
MongoDB stores the data directory in the DB directory. However, this data directory is not actively created, and we need to create it after the installation is complete.
Mkdir-p/data/db
You can then execute the mongod command to start the MONGDB service by executing the bin directory in the MongoDB installation directory of the command line.
If you need to make a directory, Mongod--dbpath=/opt/mongodb/data/db directly starts
If you need to go into MongoDB background management, execute the MONGO command file. The MongoDB Shell is an interactive JavaScript shell that comes with MongoDB and is used to manipulate and manage MongoDB. When you enter MongoDB background, it is linked to the test document (database) by default.
Set up MongoDB boot-Custom Service
Create a new mongodb.conf configuration file under the/opt/mongodb directory, as follows:
Create a log directory under Data
Then under/ETC/RC.D/INIT.D with VI new file Mongod, the contents are as follows:
Finally increase boot start:
chmod +x/etc/rc.d/init.d/mongod
Chkconfig--add Mongod
Chkconfig--level 345 Mongod on
Chkconfig--list Mongod
Service Mongod Start
After executing the script, you can start start|stop|restart|list your service.
After the shutdown and restart will automatically start MONGO, if the same machine needs to start more than Mongod this method.
Reference documents: 51441579
Centos7 Installing MongoDB