1. Download
Go to the official website https://www.mongodb.com find the corresponding version of MongoDB
Such a: https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-4.0.0.tgz
2. Go to the Linux server to download it
1) Download: Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel62-4.0.0.tgz
2) move to where you want to put it: mv mongodb-linux-x86_64-rhel62-4.0.0.tgz /usr/local/MongoDB
3) Go to the folder to unzip it:
CD/usr/local/mongodb
-zxvf MongoDB-linux-x86_64-3.0. 6.tgz
4) Adding MongoDB to the environment variable is to add the address of the bin directory under the folder of the MongoDB decompression to the environment variable, as follows:
Export PATH=/usr/local/mongodb/mongodb-linux-x86_64- rhel62-4.0.0/bin:$PATH
Now it's installed.
3. Configure the data storage location for MongoDB
The default storage address for MongoDB is under the/data/db folder in the root directory, but this folder needs to be created by the user,
You can also modify this path by command, like this:
-/data/DBDB
After the configuration, you can try to start it.
4. Start MongoDB
In the DB directory of the MongoDB installation directory, execute the./mongod command, you can start MongoDB, you can see something like this when you start
This is started, and then you can use it, and the way to use it is listed in my ' Personal blog Development ' series.
Installing MongoDB under Linux