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. Android模拟器disconnected问题

    具体原因不明,偶尔会出现 window -> Show Views -> device -> view menu -> Reset adb  一般可以解决该问题

  2. python和pywin32实现窗口查找、遍历和点击

    Pywin32是一个Python库,为python提供访问Windows API的扩展,提供了齐全的windows常量.接口.线程以及COM机制等等. 1.通过类名和标题查找窗口句柄,并获得窗口位置和 ...

  3. JS-004-判断元素显示状态

    在日常的 web 编程或 UI自动化脚本编写过程中,经常会遇到判断页面元素的显示状态,以对应的执行相应的操作.此文主要以 js 判断页面元素的存在状态为例,简单叙述一下 js 是如何判断元素的显示状态 ...

  4. 2.TCP_IP互联线缆_TCP_UDP报文抓包详解

    TCP_IP互联线缆_TCP_UDP报文抓包详解 2.1网线标准 直通线 交叉线 异种设备互联使用直通线 同种设备互联使用交叉线 TCP和UDP 端口寻址 TCP数据格式 TCP三次握手 UDP数据格 ...

  5. [BS-14] 打印NSArray和NSDictionary的3种方法

    打印NSArray和NSDictionary的3种方法 NSArray *arr = @[@"奔驰",@"宝马",@"路虎",@" ...

  6. iOS小技巧2

    这段代码是实现了类似QQ空间"我的空间"里面的圆形头像 //圆形的头像 UIImageView * headImage = [[UIImageView alloc]initWith ...

  7. Java控制语句——break和continue

    在任何循环语句的主体部分,均可用break控制循环的流程. break用于强行退出循环,不执行循环中剩余的语句.(break语句还可用于多支语句switch中) continue 语句用于循环语句体中 ...

  8. Linux 基本收集

    ifconfig eth0 192.168.1.223 切换到root账号开始是$符号输入su输入root密码转换成# 就变成了root账号 dr 查看盘符ls /etc/ 查看etc文件夹下面的文件 ...

  9. Hive -- 基于Hadoop的数据仓库分析工具

    Hive是一个基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,通过类SQL语句快速实现简单的MapReduce统计,不必开发专门的MapReduce应用,十分适合数据仓库 ...

  10. MVC4 数据验证、特性、自动属性总结

    最近悟出来一个道理,在这儿分享给大家:学历代表你的过去,能力代表你的现在,学习代表你的将来. 十年河东十年河西,莫欺少年穷 学无止境,精益求精    最近在做自学MVC,遇到的问题很多,索性一点点总结 ...