First, download, install the corresponding version
The website downloads the following address:
Www.mongodb.org/downloads
#通过CURL下载
Curl-o https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-ubuntu1404-3.2.0.tgz
#解压
tar -ZXVF mongodb-linux-x86_64-ubuntu1404-3.2.0.tgz
#移动
mv mongodb-linux-x86_64-ubuntu1404-3.2.0//usr/local/ MongoDB
#添加环境变量
export path=/usr/local/mongodb/bin: $PATH
Second, the database directory creation
MongoDB data is stored in the DB directory of the data directory, but this directory is not created automatically during the installation process, so you will need to manually create a data directory and create a DB directory in the data directory.
Note: /data/db
is the MongoDB default startup database path (–dbpath).
Third, through the Apt-get installation
Configure public key
sudo apt-key adv--keyserver hkp://keyserver.ubuntu.com:80--recv 7f0ceb10
echo "Deb http:// Repo.mongodb.org/apt/ubuntu "$ (LSB_RELEASE-SC)"/mongodb-org/3.0 Multiverse | sudo tee/etc/apt/sources.list.d/mongodb-org-3.0.list
sudo apt-get update
sudo apt-get install-y mongodb-org< c5/>//complete the installation steps above configure the location of the MongoDB database
sudo mongod--dbpath/data/db
/start mongod
sudo service mongod start
Summarize
The above is the entire content of this article, I hope the content of this article for everyone's study or work can bring certain help, if you have questions you can message exchange.