mongodb 安装

在官方 网站上下载安装包,上传到服务器上。

[root@tes102 soft]# ll

total 24868

-rw-r--r-- 1 root root 25428891 Jul 6 15:43 mongodb-linux-x86_64-1.6.5.tar

[root@tes102 soft]# tar -xvf mongodb-linux-x86_64-1.6.5.tar

mongodb-linux-x86_64-1.6.5/

mongodb-linux-x86_64-1.6.5/THIRD-PARTY-NOTICES

[@more@]

在官方 网站上下载安装包,上传到服务器上。

[root@tes102 soft]# ll

total 24868

-rw-r--r-- 1 root root 25428891 Jul 6 15:43 mongodb-linux-x86_64-1.6.5.tar

[root@tes102 soft]# tar -xvf mongodb-linux-x86_64-1.6.5.tar

mongodb-linux-x86_64-1.6.5/

mongodb-linux-x86_64-1.6.5/THIRD-PARTY-NOTICES

mongodb-linux-x86_64-1.6.5/GNU-AGPL-3.0

mongodb-linux-x86_64-1.6.5/README

mongodb-linux-x86_64-1.6.5/bin/

mongodb-linux-x86_64-1.6.5/bin/mongo

mongodb-linux-x86_64-1.6.5/bin/mongos

mongodb-linux-x86_64-1.6.5/bin/mongodump

mongodb-linux-x86_64-1.6.5/bin/mongostat

mongodb-linux-x86_64-1.6.5/bin/mongofiles

mongodb-linux-x86_64-1.6.5/bin/mongoimport

mongodb-linux-x86_64-1.6.5/bin/mongosniff

mongodb-linux-x86_64-1.6.5/bin/mongorestore

mongodb-linux-x86_64-1.6.5/bin/mongod

mongodb-linux-x86_64-1.6.5/bin/bsondump

mongodb-linux-x86_64-1.6.5/bin/mongoexport

[root@tes102 soft]# ll

total 24872

drwxr-xr-x 3 500 500 4096 Dec 8 2010 mongodb-linux-x86_64-1.6.5

-rw-r--r-- 1 root root 25428891 Jul 6 15:43 mongodb-linux-x86_64-1.6.5.tar

新建mongodb 用户, 解压文件的用户和属组均属于mongodb

[root@tes102 soft]# vim /etc/passwd

[root@tes102 soft]# useradd mongodb

[root@tes102 soft]# passwd mongodb

Changing password for user mongodb.

New UNIX password:

Retype new UNIX password:

passwd: all authentication tokens updated successfully.

[root@tes102 soft]# ll

total 24872

drwxr-xr-x 3 mongodb mongodb 4096 Dec 8 2010 mongodb-linux-x86_64-1.6.5

-rw-r--r-- 1 root root 25428891 Jul 6 15:43 mongodb-linux-x86_64-1.6.5.tar

[root@tes102 soft]# su –mongodb

[mongodb@tes102 ~]$ cd /soft/mongodb-linux-x86_64-1.6.5/bin/

bsondump mongo mongod mongodump mongoexport mongofiles mongoimport mongorestore mongos mongosniff mongostat

暂时无法使用mongodb 因为 mongod 还没有启动

[mongodb@tes102 bin]$ ./mongo

MongoDB shell version: 1.6.5

connecting to: test

Wed Jul 6 15:53:48 Error: couldn't connect to server 127.0.0.1 (anon):1154

exception: connect failed

由于是新手,走了不少弯路,呵呵

**********************************************************************

[root@tes102 soft]# cd /data/db/

[root@tes102 db]# mkdir /data/log

[root@tes102 db]# touch richinfo.js

[root@tes102 db]# cd ../log/

[root@tes102 log]# touch richinfo.log

[root@tes102 log]# cd /data

[root@tes102 data]# chown mongodb.mongodb /data/ -R

[root@tes102 data]# chmod 755 /data/ -R

[root@tes102 data]# cd ./db/

[root@tes102 db]# rm richinfo.js

rm: remove regular empty file `richinfo.js'? y

[root@tes102 db]# ll

total 0

****************************************************************************

启动 ./mongod 数据库启动成功

[root@tes102 db]# su - mongodb

[mongodb@tes102 ~]$ cd /data/db/

[mongodb@tes102 db]$ mkdir richinfo

[mongodb@tes102 bin]$ ./mongod --port 10001 --dbpath /data/db/richinfo/ --logpath /data/log/richinfo.log &

[1] 2673

[mongodb@tes102 bin]$ all output going to: /data/log/richinfo.log

[mongodb@tes102 bin]$ vim /data/log/richinfo.log

­使用 mongo 连接到 mongodb

[mongodb@tes102 bin]$ ./mongo 192.168.18.102:10001

MongoDB shell version: 1.6.5

connecting to: 192.168.18.102:10001/test

> show dbs

admin

local

终于可以正常的使用 mongodb了,呵呵~~~~~~~~

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/8117479/viewspace-1052108/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/8117479/viewspace-1052108/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值