下载安装包:
安装依赖包
[root@mongo ]
解压安装包
[root@mongo ]
迁移目录到指定位置
[root@mongo ]
[root@mongo ]
为目录赋权
[root@mongo ]
切换普通用户
[root@mongo ]
添加环境变量
[dev@mongo ]
MONGODB_HOME=/home/dev/mongodb
PATH=$MONGODB_HOME/bin:$PATH
创建目录
[dev@mongo ]
[dev@mongo ]
创建配置文件
[dev@mongo ]
systemLog:
destination: file
path: "/home/dev/mongodb/mongod.log"
logAppend: true
storage:
dbPath: /home/dev/mongodb/data
journal:
enabled: true
wiredTiger:
engineConfig:
cacheSizeGB: 8
processManagement:
fork: true
net:
bindIp: 127.0.0.1
port: 20000
setParameter:
enableLocalhostAuthBypass: false
启动服务
[dev@mongo ]
验证服务
[root@mongo ]
dev 3819 1 0 21:43 ? 00:00:12 /home/dev/mongodb/bin/mongod -f /home/dev/mongodb/conf/mongo.conf
dev 3925 3899 0 23:40 pts/0 00:00:00 grep --color=auto mongo
连接 mongo
[dev@mongo ]