centos7 安装mongodb

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

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42836351/article/details/82989386