centos7安装mongodb(压缩包版)

103 阅读1分钟

安装依赖

sudo yum install cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-plain krb5-libs libcurl net-snmp openldap openssl xz-libs

补充openssl缺少依赖(重点)

sudo rpm -ivh compat-openssl10-1.0.2o-3.el8.x86_64.rpm

解压

tar -zxvf mongodb-linux-*-5.0.23.tgz

编写mongod.conf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# where to write logging data.
systemLog:
  destination: file
  logAppend: true
  path: /**/mongodb-linux-x86_64-rhel70-5.0.22/log/mongod.log

# Where and how to store data.
storage:
  dbPath: /**/mongodb-linux-x86_64-rhel70-5.0.22/data
  journal:
    enabled: true
#  engine:
#  wiredTiger:

# how the process runs
processManagement:
  timeZoneInfo: /usr/share/zoneinfo
  fork: true

# network interfaces
net:
  port: 27017
  bindIp: 127.0.0.1  # Enter 0.0.0.0,:: to bind to all IPv4 and IPv6 addresses or, alternatively, use the net.bindIpAll setting.


#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options

#auditLog:

#snmp:

创建log目录以及log文件,创建dbPath目录

启动mongod

./mongod -f ./mongod.conf