Ubuntu Install MongoDB

Source: Internet
Author: User
Tags connect mongo install mongodb

First step : Install

#setp 1. Import the public key used by the package management system. sudo apt-key adv--keyserver HKP://keyserver.ubuntu.com:80--recv 0c49f3730359a14518585931bc711f9ba15703c6

2 file  for MongoDB Echo " Deb [arch=amd64,arm64] Http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 Multiverse " sudo Tee /etc/apt/sources.list.d/mongodb-org-3.4. List

3 . Reload Local Package databasesudo apt-get update

4 . Install the latest stable version of MongoDBsudoinstall -y mongodb-org

Step two : Start the service

Start MongoDB service, after default installation, is to start the MongoDB service

sudo Service Mongod Stop #停止服务 sudo service mongod start #启动服务
sudo service mongod restart #重新启动服务
sudo service mongod status #查看状态

Allow boot start, default when the server is restarted, MongoDB service will stop, need to set up start MongoDB service

sudo systemctl enable Mongod

Step three : Connect

This machine connects to the MongoDB service and uses the MONGO command to connect

Mongo

MongoDB configuration file

 Less/etc/mongod.conf

Client connection, MONGO after the installation is complete, the default is only the native connection, outside the server is not able to connect MONGO

#切换至root用户 sudo -/etc/mongod.conf

After the modification is complete, save the file and restart MONGO

#退出root用户exit # Restart service sudo service mongod restart

Client Connection succeeded

Fourth Step : Delete MongoDB

sudo apt-get purge mongodb-org*

Ubuntu Install MongoDB

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.