Install MongoDB Community Edition on Ubuntu
- Install MongoDB >
- Install MongoDB Community Edition >
- Install MongoDB Community Edition on Linux >
- Install MongoDB Community Edition on Ubuntu
Install MongoDB Community Edition on Ubuntu
On this page
Overview
Use this tutorial to install MongoDB Community Edition on LTS Ubuntu Linux systems from .deb packages. While Ubuntu includes its own MongoDB packages, the official MongoDB Community Edition packages are generally more up-to-date.
PLATFORM SUPPORT
MongoDB only provides packages for 64-bit LTS (long-term support) Ubuntu releases. For example, 12.04 LTS (precise), 14.04 LTS (trusty), 16.04 LTS (xenial), and so on. These packages may work with other Ubuntu releases, however, they are not supported.
PACKAGE UPDATES REQUIRED ON UBUNTU 16.04 FOR IBM POWER SYSTEMS
Due to a lock elision bug present in older versions of the glibc package on Ubuntu 16.04 for POWER, you must upgrade the glibc package to at least glibc 2.23-0ubuntu5 before running MongoDB. Systems with older versions of the glibc package will experience database server crashes and misbehavior due to random memory corruption, and are unsuitable for production deployments of MongoDB
Packages
MongoDB provides officially supported packages in their own repository. This repository contains the following packages:
| Package Name | Description | 
|---|---|
| mongodb-org | A metapackagethat will automatically install the four component packages listed below. | 
| mongodb-org-server | Contains the mongoddaemon and associated configuration and init scripts. | 
| mongodb-org-mongos | Contains the mongosdaemon. | 
| mongodb-org-shell | Contains the mongoshell. | 
| mongodb-org-tools | Contains the following MongoDB tools: mongoimportbsondump,mongodump,mongoexport,mongofiles,mongooplog,mongoperf,mongorestore,mongostat, andmongotop. | 
The mongodb-org-server package provides an initialization script that starts mongod with the/etc/mongod.conf configuration file.
See Run MongoDB Community Edition for details on using this initialization script.
These packages conflict with the mongodb, mongodb-server, and mongodb-clients packages provided by Ubuntu.
The default /etc/mongod.conf configuration file supplied by the packages have bind_ip set to127.0.0.1 by default. Modify this setting as needed for your environment before initializing a replica set.
Install MongoDB Community Edition
NOTE
To install a different version of MongoDB, please refer to that version’s documentation. For example, see version 3.2.
MongoDB only provides packages for 64-bit LTS (long-term support) Ubuntu releases. For example, 12.04 LTS (precise), 14.04 LTS (trusty), 16.04 LTS (xenial), and so on. These packages may work with other Ubuntu releases, however, they are not supported.
Import the public key used by the package management system.
The Ubuntu package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import the MongoDB public GPG Key:
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
Create a list file for MongoDB.
Create the /etc/apt/sources.list.d/mongodb-org-3.4.list list file using the command appropriate for your version of Ubuntu:
- Ubuntu 12.04
- 
Copyecho "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list 
- Ubuntu 14.04
- 
Copyecho "deb [ arch=amd64 ] http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list 
- Ubuntu 16.04
- 
Copyecho "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 
Reload local package database.
Issue the following command to reload the local package database:
sudo apt-get update
Install the MongoDB packages.
Install the latest stable version of MongoDB.
Issue the following command:
sudo apt-get install -y mongodb-org
Run MongoDB Community Edition
Most Unix-like operating systems limit the system resources that a session may use. These limits may negatively impact MongoDB operation. See UNIX ulimit Settings for more information.
The MongoDB instance stores its data files in /var/lib/mongodb and its log files in /var/log/mongodbby default, and runs using the mongodb user account. You can specify alternate log and data file directories in/etc/mongod.conf. See systemLog.path and storage.dbPath for additional information.
If you change the user that runs the MongoDB process, you must modify the access control rights to the/var/lib/mongodb and /var/log/mongodb directories to give this user access to these directories.
Verify that MongoDB has started successfully
Verify that the mongod process has started successfully by checking the contents of the log file at/var/log/mongodb/mongod.log for a line reading
[initandlisten] waiting for connections on port <port>
where <port> is the port configured in /etc/mongod.conf, 27017 by default.
Stop MongoDB.
As needed, you can stop the mongod process by issuing the following command:
sudo service mongod stop
Begin using MongoDB.
To help you start using MongoDB, MongoDB provides Getting Started Guides in various driver editions. See Getting Started for the available editions.
Before deploying MongoDB in a production environment, consider the Production Notes document.
Later, to stop MongoDB, press Control+C in the terminal where the mongod instance is running.
Uninstall MongoDB Community Edition
To completely remove MongoDB from a system, you must remove the MongoDB applications themselves, the configuration files, and any directories containing data and logs. The following section guides you through the necessary steps.
WARNING
This process will completely remove MongoDB, its configuration, and all databases. This process is not reversible, so ensure that all of your configuration and data is backed up before proceeding.
Remove Packages.
Remove any MongoDB packages that you had previously installed.
sudo apt-get purge mongodb-org*
Remove Data Directories.
Remove MongoDB databases and log files.
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
© MongoDB, Inc 2008-present. MongoDB, Mongo, and the leaf logo are registered trademarks of MongoDB, Inc
Install MongoDB Community Edition on Ubuntu的更多相关文章
- Install MongoDB on Windows
		Overview Use this tutorial to install MongoDB on a Windows systems. PLATFORM SUPPORT Starting in ver ... 
- Install MongoDB on Windows  (Windows下安装MongoDB)
		Install MongoDB on Windows Overview Use this tutorial to install MongoDB on a Windows systems. PLATF ... 
- Install MongoDB driver for PHP on XAMPP for Mac OSX
		试了不少方法,最后还是这个最有效. [转自:http://thatsimplecode.com/install-mongodb-driver-for-php-on-xampp-for-mac-osx] ... 
- Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux
		Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux¶ Overview Use this tutorial t ... 
- Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10(转)
		Install Cocos2d-x v3.3 on Ubuntu 14.04 & Ubuntu 14.10 1 get the source code sudo apt-get install ... 
- installation - How to install Synaptic Package Manager? - Ask Ubuntu
		installation - How to install Synaptic Package Manager? - Ask Ubuntu How to install Synaptic Package ... 
- sudo brew install mongodb报错
		报错信息如下: Error: Running Homebrew as root is extremely dangerous and no longer supported. As Homebrew ... 
- Install Redis 3.2 on Ubuntu
		Install Redis 3.2 on Ubuntu It’s very easy to install Redis 3 on Ubuntu 16, just need to add PPA rep ... 
- NLP--- How to install the tool NLTK in Ubuntu ?
		NLP--- How to install the tool NLTK in Ubuntu ? 1. open the website of NLTK and download it. https: ... 
随机推荐
- React Native组件(三)Text组件解析
			相关文章 React Native探索系列 React Native组件系列 前言 此前介绍了最基本的View组件,接下来就是最常用的Text组件,对于Text组件的一些常用属性,这篇文章会给出简单的 ... 
- Suffix(hash+lcp+二分)
			题目链接: Suffix Consider n given non-empty strings denoted by s1 , s2 , · · · , sn . Now for each of th ... 
- css工具类封装
			温馨提示:一下css封装,建议按需使用,否则会造成很大的代码冗余,且很多样式会造成不符合预期的效果,建议合理使用 <a href="https://meyerweb.com/eric/ ... 
- 分布式版本控制系统Git——图形化Git客户端工具TortoiseGit
			本篇导读: 上篇介绍了一款Windows环境下的Git服务器工具GitStack ,搭建了最简单的Windows下的Git服务器,需要再次提醒的是GitStack是打包了相对较稳定的Git原生版本的, ... 
- Hadoop2.x下安装HBase
			1.安装好 hadoop 集群,并启动 [grid@hadoop4 ~]$ /sbin/start-dfs.sh [grid@hadoop4 ~]$ /sbin/start-yarn.sh 查看 ha ... 
- Win10 Backup&Restore Start Menu(备份还原开始菜单)
			Win10 的开始菜单,不是很稳定!系统装完4天,开始乱了3次,要知道我的开始菜单全屏并且进过尽心布局的,很是心酸! 连着找了几天备份开始菜单的方法,无果!后来发现了下边两个PowerShell命令, ... 
- spring加载jar包中多个配置文件(转载)
			本文转载自:http://www.cnblogs.com/GarfieldTom/p/3723915.html 
- BZOJ2687 交与并/BZOJ2369 区间【决策单调性优化DP】【分治】
			Description 对于一个区间集合 {A1,A2--Ak}(K>1,Ai不等于Aj(i不等于J),定义其权值 S=|A1∪A2∪--AK|*|A1∩A2--∩Ak| 即它们的交区间的长度乘 ... 
- 我常用的几个第三方 Python 库
			转自:http://blog.csdn.net/gzlaiyonghao/article/details/2966811 wxPython 如果你之前是 windows 程序员,用 MFC 或者 WI ... 
- 相对导入中Attempted relative import in non-package问题
			这一篇应该是解释的比较清楚: http://stackoverflow.com/questions/14664313/attempted-relative-import-in-non-package- ... 
