温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

linux 下安装mongodb

发布时间:2020-08-04 13:47:54 来源:网络 阅读:265 作者:一僧无悔 栏目:MongoDB数据库


[root@sc-wjg ~]# uname -a
Linux sc-wjg 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@sc-wjg ~]# cat /etc/redhat-release
CentOS release 6.4 (Final)

[root@sc-wjg ~]#  groupadd mongo
[root@sc-wjg ~]# useradd -g mongo mongo
[root@sc-wjg ~]#  mkdir -p /database/mongodb/data/
[root@sc-wjg ~]# chown -R mongo:mongo /database/mongodb/data/
[root@sc-wjg ~]# mkdir -p /var/applog/mongo_log/
[root@sc-wjg ~]# chown -R mongo:mongo /var/applog/mongo_log/

[root@sc-wjg ~]#
wget http://fastdl.mongodb.org/linux/mongodb-linux-x86_64-2.2.7.tgz
[root@sc-wjg ~]# tar zxf mongodb-linux-x86_64-2.2.7.tgz

[root@sc-wjg ~]# mv mongodb-linux-x86_64-2.2.7 /usr/local/mongodb
[root@sc-wjg ~]# cd /usr/local/mongodb/
[root@sc-wjg mongodb]# ll
total 64
drwxr-xr-x 2 root root  4096 Apr  7 16:00 bin
-rw------- 1  500  500 34520 Jan 11  2013 GNU-AGPL-3.0
-rw------- 1  500  500  1359 Jan 11  2013 README
-rw------- 1  500  500 16787 Jan 11  2013 THIRD-PARTY-NOTICES
[root@sc-wjg mongodb]# mkdir /var/mongodb/data -p
[root@sc-wjg mongodb]# mkdir /var/mongodb/logs -p
[root@sc-wjg mongodb]# /etc/init.d/iptables stop

启动mongodb

[root@sc-wjg mongodb]# /usr/local/mongodb/bin/mongod --dbpath=/var/mongodb/data --logpath /var/mongodb/logs/log.log -fork
forked process: 29117
all output going to: /var/mongodb/logs/log.log
child process started successfully, parent exiting


登入

[root@sc-wjg mongodb]# /usr/local/mongodb/bin/mongo
MongoDB shell version: 2.2.7
connecting to: test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
   http://docs.mongodb.org/
Questions? Try the support group
   http://groups.google.com/group/mongodb-user
> show dbs




向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI