zoukankan      html  css  js  c++  java
  • mongoDB yum安装

    yum安装mongoDB

    官方网站

    http://www.mongodb.org/

    http://www.mongodb.org/downloads



    环境:CentOS6.5 x64

    以下截取至mongodb官网
    一.配置yum源

    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

    提示:可以使用国内源
    CentOS6 http://mirrors.aliyun.com/mongodb/yum/redhat/6/mongodb-org/stable/x86_64/
    
    CentOS7 http://mirrors.aliyun.com/mongodb/yum/redhat/7/mongodb-org/stable/x86_64/
    


    二.安装mongoDB

    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 -y 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 -y 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.

    通过标准的yum源安装完成后,会生成如下几个目录

    /var/lib/mongo  #数据库目录

    /var/log/mongdb  #日志目录

    /etc/mongodb.conf #主配置文件

    提示:对于大批量安装,可以将安装包缓存到本地,在内网上搭一个mongodb yum源。
    yum --downloadonly --downloaddir=/mongodb
    mongodb-org   #静默下载指定的软件包到指定的目录


    三.启动mongoDB

    注意:如果启用了selinux,则需要解决非标准端口访问问题。

    You must configure SELinux to allow MongoDB to start on Red Hat Linux-based systems (Red Hat Enterprise Linux, CentOS, Fedora). Administrators have three options:

    • enable access to the relevant ports (e.g. 27017) for SELinux. See Default MongoDB Port for more information on MongoDB’s default ports. For default settings, this can be accomplished by running

      semanage port -a -t mongodb_port_t -p tcp 27017
      
      
    1.启动mongoDB
    service mongod start

    2.加入开机启动项
    chkconfig mongod on

    3.查看日志
    tail -f /var/log/mongodb/mongod.log


  • 相关阅读:
    Linux vi或vim替换
    Linux vi或vim统计字符出现次数
    Pycharm 操作Git
    离线安装 Python三方包
    Python 列表排序,sort函数,分组排序
    执行shell脚本,并把执行结果存入文件
    Git 拉取近期提交的代码
    Python base64编码和解码
    媒体信息源
    每日随笔
  • 原文地址:https://www.cnblogs.com/lixuebin/p/10814481.html
Copyright © 2011-2022 走看看