How to install MongoDB under Linux ubuntu _mongodb

Source: Internet
Author: User
Tags install mongodb mongodb

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.