Install MongoDB on Debian

This tutorial outlines the steps to install MongoDB on Debian systems. The tutorial uses .deb packages to install. While some Debian distributions include their own MongoDB packages, the official MongoDB packages are generally more up to date.

NOTE

This tutorial applies to both Debian systems and versions of Ubuntu Linux prior to 9.10 “Karmic” which do not use Upstart. Other Ubuntu users will want to follow the Install MongoDB on Ubuntu tutorial.

Package Options

The downloads repository provides the mongodb-10gen package, which contains the latest stablerelease. Additionally you can install previous releases of MongoDB.

You cannot install this package concurrently with the mongodbmongodb-server, or mongodb-clients packages that your release of Debian may include.

Install MongoDB

Configure Package Management System (APT)

The Debian package management tools (i.e. dpkg and apt) ensure package consistency and authenticity by requiring that distributors sign packages with GPG keys.

1

Import MongoDB PGP key.

Issue the following command to add the MongoDB public GPG Key to the system key ring.

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv 7F0CEB10
2

Create a sources.list file for MongoDB.

Create a /etc/apt/sources.list.d/mongodb.list file

echo 'deb http://downloads-distro.mongodb.org/repo/debian-sysvinit dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list
3

Reload local package database.

Issue the following command to reload the local package database:

sudo apt-get update

Install Packages

Issue the following command to install the latest stable version of MongoDB:

sudo apt-get install mongodb-10gen

When this command completes, you have successfully installed MongoDB!

Manage Installed Versions

You can use the mongodb-10gen package to install previous versions of MongoDB. To install a specific release, append the version number to the package name, as in the following example:

apt-get install mongodb-10gen=2.2.3

This will install the 2.2.3 release of MongoDB. You can specify any available version of MongoDB; however apt-get will upgrade the mongodb-10gen package when a newer version becomes available. Use the following pinning procedure to prevent unintended upgrades.

To pin a package, issue the following command at the system prompt to pin the version of MongoDB at the currently installed version:

echo "mongodb-10gen hold" | sudo dpkg --set-selections

Control Scripts

The packages include various control scripts, including the init script /etc/rc.d/init.d/mongodb. These packages configure MongoDB using the /etc/mongodb.conf file in conjunction with the control scripts.

As of version 2.4.9, there are no control scripts for mongosmongos is only used in sharding deployments. You can use the mongod init script to derive your own mongos control script.

Run MongoDB

The MongoDB instance stores its data files in the /var/lib/mongo and its log files in/var/log/mongo, and run using the mongod user account. If you change the user that runs the MongoDB process, you must modify the access control rights to the /var/lib/mongo and /var/log/mongodirectories.

Start MongoDB

Issue the following command to start mongod:

sudo /etc/init.d/mongodb start

You can verify that mongod has started successfully by checking the contents of the log file at/var/log/mongodb/mongodb.log.

Stop MongoDB

Issue the following command to stop mongod:

sudo /etc/init.d/mongodb stop

Restart MongoDB

Issue the following command to restart mongod:

sudo /etc/init.d/mongodb restart

[Mongo] How to Install Mongo on Debian(不要安装)的更多相关文章

  1. 学习mongo系列(一) win/mac安装 解析 连接

    一.安装mongo数据库 下载链接https://www.mongodb.org/downloads, 在执行如下命令的时候事先按照目录新建如下的目录:(如果数据库安装在D盘就在D盘的根目录下建)&q ...

  2. MongoDB - The mongo Shell, Configure the mongo Shell

    Customize the Prompt You may modify the content of the prompt by setting the variable prompt in the  ...

  3. 【转载】Debian 6安装小记

    转载自:http://unix-cd.com/vc/www/22/2011-06/18022.html 今天终于装上了 debian6,代号叫squeeze是吧?前几天的时候在Microhu’s Bl ...

  4. pycharm 4.5在debian下安装

    1.去官网下载linux下的Tar包,下载后解压. 2.直接进入解压后的folder里面找bin下面的pycharm.sh,执行后发现没有任何反应. 3.查询资料发现是因为pycharm需要sun j ...

  5. Debian 入门安装与配置2

    Debian 入门安装与配置2 1. C/C++开发必装软件 atp-get install gcc    这个不用说,用来编译C程序 apt-get install g++ 用来编译C++程序 ap ...

  6. Debian 入门安装与配置1

    Debian 入门安装与配置1 最近安装了多个发行版本的Linux,包括Ubuntu.Fedora.Centos和Debian,发现只有Debian在界面和稳定性等综合特性上表现最优,自己也最喜欢,所 ...

  7. 在Debian中安装VMware Workstatption 12

    在Debian中安装VMware Workstatption 12-----------------------------------------------> 下载文件:    *vmwar ...

  8. Mosquitto安装_Ubuntu/Debian上安装消息队列Mosquitto

    Mosquitto安装_Ubuntu/Debian上安装消息队列Mosquitto MQTT是IBM开发的一个即时通讯协议.MQTT是面向M2M和物联网的连接协议,采用轻量级发布和订阅消息传输机制.M ...

  9. debian上安装lua编辑器

    Debian服务器上安装lua 1)下载压缩包 wget http://www.lua.org/ftp/lua-5.1.4.tar.gz 2)解压文件 tar  zxvf lua-5.1.4.tar. ...

随机推荐

  1. node express 学习2

    上次我们的express已经安装好了 接下来我们修改渲染引擎为html // view engine setup app.set('views', path.join(__dirname, 'view ...

  2. Magento Error – The directory is not writable by server.

    When trying to use the insert image functionality in Magento if you receive an error saying: “The di ...

  3. 如何设置启动页 LaunchImage

  4. JavaScript实现在页面上的文本框中输入小写字母自动变为大写字母

    <script language="javascript" type="text/javascript"> $(function () { $(&q ...

  5. 一个例子深入理解ClassLoader

    文件类加载器,该加载器重载了loadClass方法,逻辑是只读取文件来加载类,不委托给父类加载器进行加载 package com.ydd.study.hello.classloader; import ...

  6. FTP文件夹打开错误,Windows无法访问此文件夹

    错误提示: Windows 无法访问此文件夹,请确保输入的文件夹是正确的,并且你有权访问此文件夹.    解决方法/步骤如下    1.请确保输入的文件夹是正确的,并且你有权访问此文件夹.可以在浏览器 ...

  7. day04-java-循环结构(while、do-while、for)

    循环结构(while.do-while.for) 任何复杂的程序逻辑都可以通过三种结构来实现:1)顺序结构:从上往下逐行执行,每句必走2)分支结构:有条件的执行某语句一次,并非每句必走3)循环结构:有 ...

  8. 网页加载图片问题 插件lazyload

    有些项目的,是满屏的背景图片 ,导致页面加载的速度,有简单处理的方法有两个: 1.将背景分割成几分

  9. linux web服务器静态资源的处理 unison+inotify双向同步

    linux web服务器静态资源的处理 unison+inotify双向同步 http://monkeyzhu.blog.51cto.com/5764358/1324391 简介 unison可以使两 ...

  10. linux 文件权限 初级

    sudo lsattr /etc/sudoers  查看属性 sudo vi index.html 以root权限编辑文件