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 metapackage that will automatically install the four component packages listed below. |
mongodb-org-server |
Contains the mongod daemon and associated configuration and init scripts. |
mongodb-org-mongos |
Contains the mongos daemon. |
mongodb-org-shell |
Contains the mongo shell. |
mongodb-org-tools |
Contains the following MongoDB tools: mongoimport bsondump , mongodump ,mongoexport , mongofiles , mongooplog , mongoperf , mongorestore , mongostat , and mongotop . |
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
-
Copy
echo "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
-
Copy
echo "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
-
Copy
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
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/mongodb
by 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: ...
随机推荐
- Java并发编程之CountDownLatch,CyclicBarrier实现一组线程相互等待、唤醒
java多线程应用场景不少,有时自己编写代码又不太容易实现,好在concurrent包提供了不少实现类,还有google的guava包更是提供了一些最佳实践,这让我们在面对一些多线程的场景时,有了不少 ...
- 关于HTTPS理论和实践
Summary: HTTP 通信时,可能信息被监听.服务器或客户端身份伪装等安全问题,HTTPS 则能有效解决这些问题. 原始的HTTP连接的时候,因服务器与用户之间是直接进行明文传输,导致用户面临着 ...
- js之瀑布流的实现
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Linux服务器运行环境搭建(三)——MySQL数据库安装
官网:http://www.mysql.com/ 官网下载地址:http://dev.mysql.com/downloads/mysql/ 说明:官网下载页面的“Select Platform” 选择 ...
- Centos kvm+ceph
Centos kvm+ceph 一. centos6.5 安装kvm 1. disable selinux 2. 确认支持intel虚拟化 3. 安装需要的包 4.设置桥接网络 5.运行kvm ins ...
- javascript 小代码
if(!("a" in window)){ var a =1; } alert(a); //undefined var a = 1,b=function a (x){ x & ...
- RUAL1519 Formula 1 【插头DP】
RUAL1519 Formula 1 Background Regardless of the fact, that Vologda could not get rights to hold the ...
- 《DSP using MATLAB》示例Example 8.5
- 【Netty】netty学习之nio了解
[一]五种IO模型: (1)阻塞IO(2)非阻塞IO(任务提交,工作线程处理,委托线程等待工作线程处理结果的同时,也可以做其他的事情)(3)IO复用模型.(委托线程接收多个任务,将任务提交给工作线程. ...
- IO流-文件夹的拷贝
文件夹的拷贝操作 要求: 完成文件夹的拷贝,包括子目录的拷贝和所有文件的拷贝 分析: 首先,得在目标目录下创建一个与源文件夹名称相同的文件夹 遍历源文件夹中的所有文件对象,判断子文件是目录还是文件 如 ...