1. Go to the official website and select the appropriate version to download
https://www.mongodb.com/download-center#community
2. Unzip
tar -zxvf mongodb-linux-x86_64-ubuntu1604-3.4.0.tgz
3. Move to the /usr/local/ directory
sudo mv -r mongodb-linux-x86_64-ubuntu1604-3.4.0/ /usr/local/mongodb
4. Add the executable to the PATH path
export PATH=/usr/local/mongodb/bin:$PATH
Server
- The command of the service is mongod, you can view all parameters through help
mongod --help
- The configuration file is in /etc/mongod.conf, the default port is 27017
- Recommended way to manage the service
- start up
sudo service mongod start 不同的版本可能是(
sudo service mongodb start
)
- stop
sudo service mongod stop
- reboot
sudo service mongod restart
- Check the process after startup to determine if the startup is successful
ps ajx|grep mongod
- If there is no mongod item in the process, the startup is not successful. You can check the log to determine the cause of the error. The log directory is /var/log/mongodb/mongod.log, and the latest information is at the bottom.
client
- The client command is mongo, you can view all parameters through help
- This shell is both the client of mongodb and the compiler of js
mongo --help
- Terminal exits connection
exit或ctrl+c
- GUI:robomongo
- Put the compressed package into ubuntu and unzip it
tar zxvf robomongo-0.9.0-linux-x86_64-0786489.tar.gz
- Enter the decompressed directory and find the running program in the bin directory
robomongo