Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux

   2023-02-10 学习力0
核心提示:OverviewUse this tutorial to install MongoDB on Red Hat Enterprise Linux, CentOS Linux, Fedora Linux, or a related system. The tutorial uses .rpm packages to install. While some of these distributions include their own MongoDB packages, t

Overview

Use this tutorial to install MongoDB on Red Hat Enterprise Linux, CentOS Linux, Fedora Linux, or a related system. The tutorial uses .rpm packages to install. While some of these distributions include their own MongoDB packages, the official MongoDB packages are generally more up to date.

Packages

The MongoDB package repository contains five packages:

Control Scripts

The mongodb-org package includes various control scripts, including the init script/etc/rc.d/init.d/mongod.

The package configures MongoDB using the /etc/mongod.conf file in conjunction with the control scripts.

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

WARNING

With the introduction of systemd in Fedora 15, the control scripts included in the packages available in the MongoDB downloads repository are not compatible with Fedora systems. A correction is forthcoming, see SERVER-7285 for more information, and in the mean time use your own control scriptsor install using the procedure outlined in Install MongoDB on Linux Systems.

Install MongoDB

For production deployments, always run MongoDB on 64-bit systems.

1

Configure the package management system (YUM).

Create a /etc/yum.repos.d/mongodb.repo file to hold the following configuration information for the MongoDB repository:

If you are running a 64-bit system, use the following configuration:

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/
gpgcheck=0
enabled=1

If you are running a 32-bit system, which is not recommended for production deployments, use the following configuration:

[mongodb]
name=MongoDB Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686/
gpgcheck=0
enabled=1
2

Install the MongoDB packages and associated tools.

When you install the packages, you choose whether to install the current release or a previous one. This step provides the commands for both.

To install the latest stable version of MongoDB, issue the following command:

sudo yum install mongodb-org

To install a specific release of MongoDB, specify each component package individually and append the version number to the package name, as in the following example that installs the 2.6.1` release of MongoDB:

sudo yum install mongodb-org-2.6.1 mongodb-org-server-2.6.1 mongodb-org-shell-2.6.1 mongodb-org-mongos-2.6.1 mongodb-org-tools-2.6.1

You can specify any available version of MongoDB. However yum will upgrade the packages when a newer version becomes available. To prevent unintended upgrades, pin the package. To pin a package, add the following exclude directive to your /etc/yum.conf file:

exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools

Previous versions of MongoDB packages use different naming conventions. See the 2.4 version of documentation for more information.

Run MongoDB

IMPORTANT

You must configure SELinux to allow MongoDB to start on Fedora systems. Administrators have two options:

  • enable access to the relevant ports (e.g. 27017) for SELinux. See Configuration Options for more information on MongoDB’s default ports.
  • disable SELinux entirely. This requires a system reboot and may have larger implications for your deployment.

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

1

Start MongoDB.

You can start the mongod process by issuing the following command:

sudo service mongod start
2

Verify that MongoDB has started successfully

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

You can optionally ensure that MongoDB will start following a system reboot by issuing the following command:

sudo chkconfig mongod on
3

Stop MongoDB.

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

sudo service mongod stop
4

Restart MongoDB.

You can restart the mongod process by issuing the following command:

sudo service mongod restart

You can follow the state of the process for errors or important messages by watching the output in the/var/log/mongo/mongod.log file.

5

Begin using MongoDB.

To begin using MongoDB, see Getting Started with MongoDB.

 
反对 0举报 0 评论 0
 

免责声明:本文仅代表作者个人观点,与乐学笔记(本网)无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
    本网站有部分内容均转载自其它媒体,转载目的在于传递更多信息,并不代表本网赞同其观点和对其真实性负责,若因作品内容、知识产权、版权和其他问题,请及时提供相关证明等材料并与我们留言联系,本网站将在规定时间内给予删除等相关处理.

  • [转]Fedora 15 安装与配置一览
    Fedora 15 将于2011.5.24日发布,今日离正式版发布还有4天。笨兔兔这里提前给大家支招用好Fedora 15。下面是笨兔兔在安装、配置Fedora 15 过程中的小结,希望给大家配置自己的Fedora 15 带来方便。仅供参考,如有错误,敬请指出。『一』安装介绍Fedora 15 Bet
    03-08
  • 新换的 Fedora Core Linux 桌面,来秀一秀(多
    1、桌面、终端、文件浏览器,已经设置好字体、自动挂载硬盘,不是很麻烦2、即时通讯:QQ,Skype3、firefox4、D4X、BT、电驴5、开发工具:eclipse netbeans6、openoffice 大开 word 公式文档,输出 PDF7、小企鹅输入法,支持微软双拼8、星际译王,linux 下免费
    02-10
  • Fedora 14添加RPM Fusion源
    RPM Fusion 是 Fedora 和 Red Hat 企业版的软件仓库,是由Dribble, Freshrpms 和 RPM Fusion 合并而来的。各种各样的应用程序包含在这个软件仓库中,比如MP3、未加密的DVD 、Mplayer, VLX, Xine 等多媒体应用程序使用的解码库,以及闭源的 Nvidia 和 ATI 显卡
    02-10
  • Fedora中安装VMtools步骤 vmware虚拟机安装fedo
      第一次玩Fedora的系统,通过VMware工具安装的一个虚拟机,由于公司要求尽可能的留有足够空间,所以安装的时候就没选开发环境选项。安装成功后,又要准备安装VMware--tools工具,在此记录安装的过程,以及安装过程中遇到的一些问题。一、准备工作  确保
    02-10
  • Fedora 23 配置
    刻到u盘上下好iso后准备刻录到u盘...可是查了一下只能在用一个叫dd的东西刻= =于是学了下...然而就是一句话:dd if=/path/xxx.iso of=/dev/sdx其中前面是文件,后面是盘,注意是整个盘sdx而不是什么sdx1啥的,注意这样做会格式化整个盘...请不要乱实验...。(
    02-10
  • Fedora 9安装说明 Fedor
     Fedora 9 安装手册◆准备工作硬件       硬盘空间:5G以上;       内存容量:384 M以上(256M也可以,但在分区后会提示您启用swap分区);       光盘介质:Fedora 9 安装光盘(1张DVD);设置BIOS为从光盘引导;启动计算机,将安装盘的
    02-10
  • fedora linux源代码下载
    fedora linux源代码下载
    yumdownloader --source kernel如果是下载insight就是 yumdownloader --source insight下载到的是当前目录.然后在用rpm2cpio 生成 压缩文件rpm2cpio insight-7.4.50-8.20120403cvs.fc17.src.rpm|cpio -idrpm2cpio 的使用 在 http://www.rpm.org/max-rpm/s1-rp
    02-10
  • Fedora 7系统安装配置心得(转)(有图哦)
    Fedora 7系统安装配置心得(转)(有图哦)
    计算机基本配置如下: CPU:Intel Core 2 Duo E4300 显卡:NVidia GeForce 7600GS 主板:ABit IB9(P965+ICH8) 内存2G/硬盘160G 安装时选择用户定制,加上开发环境,以防止编译时找不到相关的模块. 系统内核为默认的2.6.21-1.3194.fc7. 以下配置基于Gnome环境. 来
    02-10
  • fedora27安装DB2 Express-C 11
    首先在官网下载对应的安装包和语言包两个文件。然后通过tar -zxvf命令将下载的两个文件解压。其中一个文件解压后是名为expc的文件,进入这个文件。里面有一个名为db2setup的文件。在命令行下首先通过命令su切换到超级用户,然后通过./db2setup进入图形化界面
    02-10
  • Red Hat Linux、rhel 和 Fedora Core 以及 Cent
    Red Hat Linux、rhel 和 Fedora Core 以及 Centos 区别与联系1. Red Hat LinuxLinux是GNU/Linux的缩写,通常指各种Linux发行版的通称,Red Hat Linux是redhat最早发行的个人版本的linux, 其1。0版本于1994年11月3日发行。虽然其历史不及其它linux发行
    02-10
点击排行