各个版本: https://www.mongodb.org/dl/linux/x86_64
本次安装使用: http://downloads.mongodb.org/linux/mongodb-linux-x86_64-rhel70-v4.2-latest.tgz
操作系统: Centos7
1. 下载
2. 解压
3. 创建配置文件(mongodb.conf)
/soft/mongodb4.2 安装根目录
dbpath=/soft/mongodb4.2/data/db # 数据存储目录
logpath=/soft/mongodb4.2/log/mongodb.log #日志文件
logappend=true
bind_ip=0.0.0.0 # 任意IP可连接
fork=true #后台
port=5000 #指定端口 默认端口:27017
auth=true #认证
- 创建上面指定的文件目录和日志文件
- 指定配置文件启动 ./mongod --config …/conf/mongodb.conf #在bin目录下执行,不在该目录下调整路径,–config 指定配置文件目录
- 指定端口启动 ./mongo 127.0.0.1:5000 (mongo,安装目录/bin) 命令: mongo IP:PORT
报错
./mongo: error while loading shared libraries: libcrypto.so.1.1: cannot open…
检查版本.例如:勿将Ubuntu的版本安装在Centos上