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. hdu1045 Fire Net

    在一张地图上建立碉堡(X),要求每行没列不能放两个,除非中间有强挡着.求最多能放多少个碉堡 #include<iostream> #include<cstdio> #inclu ...

  2. xml架构管理器

    http://technet.microsoft.com/zh-cn/dd489278

  3. JQuery 方法简写

    <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...

  4. MacOX-001- 远程连接 windows 客户端

    至如下地址下载 windows 远程工具: http://www.microsoft.com/zh-CN/download/confirmation.aspx?id=18140 下载完成后,依据向导进 ...

  5. c#上传文件(二)使用文件流保存文件

    1.html代码: <asp:FileUpload runat="server" ID="UpLoadFile"/> <asp:Button ...

  6. ubuntu 12.04安装jdk1.8

    转自http://blog.chinaunix.net/uid-26404477-id-3471246.html 在安装之前,系统没有任何jdk软件,也就是说在终端执行 java -version 将 ...

  7. 用MFC时,如果程序崩溃,检查内存,然后注意GDI数量,在任务管理器里选项-查看列-GDI数量

    用MFC时,如果程序崩溃,检查内存,然后注意GDI数量,在任务管理器里选项-查看列-GDI数量

  8. def文件格式

    模块定义   (.def)   文件    模块定义   (.def)   文件为链接器提供有关被链接程序的导出.属性及其他方面的  信息.生成   DLL   时,.def   文件最有用.由于存在 ...

  9. android中用Spannable在TextView中设置超链接、颜色、字体

    昨晚研读 ApiDemo 源码至 com.example.android.apis.text.Link 类.首先,看一下其运行效果:  要给 TextView 加上效果,方式主要有几种: 第一种,自动 ...

  10. Android图片压缩方法总结

    本文总结Android应用开发中三种常见的图片压缩方法,分别是:质量压缩法.比例压缩法(根据路径获取图片并压缩)和比例压缩法(根据Bitmap图片压缩).   第一:质量压缩方法:   ? 1 2 3 ...