Today try to install MongoDB on the server, and learn some commands about the operation of the Linux process, summed up.
First copy the extracted MongoDB folder to the /usr/local/mongodb directory and create the data directory to hold the database
Next, run the Mongod command under /usr/local/mongodb/bin to start the MONGO service.
Start service to specify database data and log paths, for convenience, write parameters to the mongodb.conf file, as follows:
dbpath=/usr/local/mongodb/datalogpath=/usr/local/mongodb/data/mongodb.loglogappend=true
At this point, use the Mongod command to start the MongoDB service
/usr/local/mongodb/bin/mongod-f mongodb.conf &
My default current directory is the directory that holds mongodb.conf, so no absolute path is specified for mongodb.conf
It is worth mentioning that because the MongoDB service is always running in the background, add "&" after the command line
At this point the system will return your MongoDB process ID and it's running in the background.
If you want to see a detailed background process, you can use the following command
PS -E
At this point, you can see that the MongoDB service you just opened is already in the process of the system.
If you want to end the process,
Pkill Mongod
One more thing ...
If you want to enter MongoDB's shell, you need to run /usr/local/mongodb/bin/mongo
It's too much trouble to make such a long list of commands every time, so simply create a soft link in the system bin directory.
LN -s/usr/local/mongodb/bin/mongo/bin/mongo
That way, if you want to get into MongoDB's shell, you just need to hit the "MONGO" command, regardless of the directory.
Installing MongoDB on the server