ubuntu 安装 mongodb 3

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6



Install MongoDB Community Edition on Ubuntu

Overview

Use this tutorial to install MongoDB Community Edition on LTS Ubuntu Linux systems from.debpackages. 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 theglibcpackage on Ubuntu 16.04 for POWER,you must upgrade theglibcpackage to at leastglibc2.23-0ubuntu5before running MongoDB. Systems with older versions of theglibcpackage 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 AMetapackagethat will automatically install the four component packages listed below.
mongodb-org-server Contains themongoddaemon and associated configuration and init scripts.
mongodb-org-mongos Contains themongosdaemon.
mongodb-org-shell Contains themongoshell.
mongodb-org-tools Contains the following MongoDB tools:mongoimportbsondump,mongodump,mongoexport,mongofiles,mongooplog,mongoperf,mongorestore,mongostat,andmongotop.

Themongodb-org-serverpackage provides an initialization script that startsmongodwith the/etc/mongod.confconfiguration file.

SeeRun MongoDB Community Editionfor details on using this initialization script.

These packages conflict with themongodb,mongodb-server,andmongodb-clientspackages provided by Ubuntu.

The default/etc/mongod.confconfiguration file supplied by the packages havebind_ipset to127.0.0.1by default. Modify this setting as needed for your environment before initializing areplica set.

Install MongoDB Community Edition
NOTE

To install a different version of MongoDB,please refer to that version’s documentation. For example,see version3.2.

MongoDB only provides packages for 64-bit LTS (long-term support) Ubuntu releases. For example,they are not supported.

1

Import the public key used by the package management system.

The Ubuntu package management tools (i.e.dpkgandapt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys. Issue the following command to import theMongoDB public GPG Key:

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
2

Create a list file for MongoDB.

Create the/etc/apt/sources.list.d/mongodb-org-3.4.listlist file using the command appropriate for your version of Ubuntu:

Ubuntu 12.04
@H_403_199@ 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
Ubuntu 16.04
3

Reload local package database.

Issue the following command to reload the local package database:

sudo apt-get update
4

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. SeeUNIX ulimit Settingsfor more information.

The MongoDB instance stores its data files in/var/lib/mongodband its log files in/var/log/mongodbby default,and runs using themongodbuser account. You can specify alternate log and data file directories in/etc/mongod.conf. SeesystemLog.pathandstorage.dbPathfor additional information.

If you change the user that runs the MongoDB process,youmustmodify the access control rights to the/var/lib/mongodband/var/log/mongodbdirectories to give this user access to these directories.

1

Start MongoDB.

Issue the following command to startmongod:

sudo service mongod start
2

Verify that MongoDB has started successfully

Verify that themongodprocess has started successfully by checking the contents of the log file at/var/log/mongodb/mongod.logfor a line reading

[initandlisten] waiting for connections on port <port>

where<port>is the port configured in/etc/mongod.conf,0)">27017by default.

3

Stop MongoDB.

As needed,you can stop themongodprocess by issuing the following command:

sudo service mongod stop
4

Restart MongoDB.

Issue the following command to restartsudo service mongod restart

5

Begin using MongoDB.

To help you start using MongoDB,MongoDB providesGetting Started Guidesin varIoUs driver editions. SeeGetting Startedfor the available editions.

Before deploying MongoDB in a production environment,consider theProduction Notesdocument.

Later,to stop MongoDB,pressControl+Cin the terminal where themongodinstance 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 willcompletelyremove MongoDB,its configuration,andalldatabases. This process is not reversible,so ensure that all of your configuration and data is backed up before proceeding.

1

Stop MongoDB.

Stop the 2

Remove Packages.

Remove any MongoDB packages that you had prevIoUsly installed.

sudo apt-get purge mongodb-org*
3

Remove Data Directories.

Remove MongoDB databases and log files.

sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb

相关文章

1.安装过程出现0x00000000指令引用的0x00000000内存该内存不能为written 如果你安装的是inux系统 需要在...
写在全面:如果根据以下教程涉及到只读文件需要更改文件权限才能需修改文件内容,参考我的另一篇博客:...
写在前面:以下步骤中需要在终端输入命令,电脑端查看博客的朋友可以直接复制粘贴到终端,手机端查看的...
ubuntu16.04和18.04更换国内源 写在前面:安装好ubuntu双系统后,默认的软件更新源是国外的,在国内使用...
ubuntu双系统启动时卡死解决办法(在ubuntu16.04和18.04测试无误) 问题描述: 在安装完ubuntu双系统后...
又来造轮子了。。。。。。。。。。。。。。。。 今天使用w3af向文件中写入的时候,发现没有write权限,...