下载mongodb最新版本:
下载链接:http://pan.baidu.com/s/1kTDnkyz
curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.4.8.tgz
解包mongodb:
tar -zxvf mongodb-linux-x86_64-2.4.8.tgz
复制mongodb至预定安装文件夹下:
mkdir -p mongodb cp -R -n mongodb-linux-x86_64-2.4.8/ mongodb
一般来说,你需要配置系统"PATH"变量,将mongod命令程序的路径加入"PATH"变量中,或者创建mongod等命令的指向 /usr/local/bin符号链接.
创建mongdodb运行所需的用户组及用户
groupadd mongodb
useradd -g mongodb mongodb
创建数据存储目录
mkdir -p /data/db chown mongodb /data/db
mongod 默认使用/data/db作为其数据存储目录,如果不使用任何参数,MongoDB就会将数据写这个目录(/data/db).
如需要特别指定一个目录作为数据存储地址,可以使用--dbpath选项,作为mongod启动参数:
mongod --dbpath /data/db
停掉MongoDB
为了停止mongod,可以在mongod运行的终端上,直接按Control+C键,终止mongod的运行.
MongoDb web 用户界面 在比MongoDB服务的端口多1000的端口上,
你可以访问到MondoDB的web用户界面。
如:如果你的MongoDB运行端口使用默认的27017,你可以在端口号为28017访问web用户界面。
附Mongodb学习教程: http://www.w3cschool.cc/mongodb/mongodb-tutorial.html