Centos 6.9安装配置MongoDB

注意:centos6上就不要装mongo3了,容易出错。

 

1. 下载

curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.3.tgz

 

2.解压

tar -zxvf mongodb-linux-x86_64-2.6.3.tgz

 

3.将解压内容移动到/server/mongodb中

mkdir -p /server/mongodb

cp -Rf mongodb-linux-x86_64-2.6.3/*  /server/mongodb

 

4.新建mongo数据库文件夹

mkdir /data/mongodb

 

5.修改环境变量,在/etc/profile最后一行添加

$PATH=/server/mongodb/bin:$PATH

export PATH

(然后,esc 输入 : 输入wq!保存后,执行source /etc/profile)

 

6.执行mongod

 (./mongod --dbpath /data/mongodb)-->这里设定了数据库位置,最好直接写个脚本,方便使用

7.(在另一终端)执行mongo

 ./mongo 或者 直接Web架设起来。

 

完成。

 

如果在执行mongod是报错:

exception in initAndListen std::exception: locale::facet::_S_create_c_locale name not valid, terminating

修改语系:

export LC_ALL=C

posted @ 2017-11-22 09:39  JokerJason  阅读(1512)  评论(0)    收藏  举报

It's not who you are underneath, it's what you do that defines you

Brick walls are there for a reason :they let us prove how badly we want things