centos7下安装mongodb-4.0.2
1、下载解压安装包
curl -O https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-4.0.2.tgz
tar -zxvf mongodb-linux-x86_64-rhel70-4.0.2.tgz
mv mongodb-linux-x86_64-rhel70-4.0.2/ /usr/local/mongodb
2、创建数据存储目录和日志文件目录
mkdir -p /usr/local/mongodb/data/db
mkdir -p /usr/local/mongodb/logs
3、修改环境变量
vim /etc/profile
source /etc/profile
添加路径如下
4、编辑.conf配置文件
cd /usr/local/mongodb/bin
vi mongodb.conf
参数设置如下
5、启动
cd /usr/local/mongodb/bin
mongod -f mongodb.conf