The detailed steps to download and install Centos7 MongoDB

The detailed steps to download and install Centos7 MongoDB


environment herein is centos7, MongoDB installed version 3.6.13
1. Download and extract

the direct use wget download centos:

weget https://fastdl.mongodb.org/linux/mongodb-linux- x86_64-3.6.13.tgz

create the directory / usr / local / mongodb, then unzip the file into the folder:

    tar -zxvf MongoDB-Linux-x86_64-3.6.13.tgz # decompression
     
    mv mongodb-linux-x86_64-3.6 .13 / / usr / local / MongoDB

2. configuration content

(1) configure the environment variables

    Vim / etc / Profile
    # environment variable added
    MONGODB_HOME = / usr / local / MongoDB / MongoDB-Linux-x86_64-3.6.13
    the PATH = $ the PATH: $ MONGODB_HOME / bin

(2) create a database directory and log directory

    mkdir -p / usr / local / MongoDB / the Data
    mkdir -p / usr / local / MongoDB / logs

(3) create a configuration file

    mkdir / usr / local / mongodb /mongo.conf
     
    mongo.conf vim
    # add the following
    dbpath = / usr / local / MongoDB / the Data
    logpath = / usr / local / MongoDB / logs / mongo.log # create the file in advance
    logappend = to true
    . TECHNOLOGY INFORMATION = to true
    quiet to true =
    Port = 27017
    fork = true # running in the background
    bind_ip = 0.0.0.0 # allow any IP connection

(4) to start the service

    # to enter the root directory
    cd /usr/local/mongodb/mongodb-linux-x86_64-3.6.13
    # using a configuration file to start the service
    bin / -f /usr/local/mongodb/mongo.conf the mongod

(. 5) to enter the shell

bin / Mongo

Guess you like

Origin www.cnblogs.com/kofsony/p/12502364.html