Heim  >  Artikel  >  Datenbank  >  CentOS6.5安装二进制版本的MongoDB2.6

CentOS6.5安装二进制版本的MongoDB2.6

WBOY
WBOYOriginal
2016-06-07 15:55:09927Durchsuche

CentOS 6.5安装二进制版本的MongoDB 2.6 作者:chszs,转载需注明。博客主页:http://blog.csdn.net/chszs 1、下载MongoDB 2.6.0二进制发行版 2、解压MongoDB的压缩包 3、简化目录名 4、配置PATH环境变量 5、运行MongoDB 6、验证MongoDB是否正常运行

CentOS 6.5安装二进制版本的MongoDB 2.6

作者:chszs,转载需注明。博客主页:http://blog.csdn.net/chszs

MongoDB的国外镜像访问非常慢,以至于选择MongoDB官网的在线安装很不靠谱。那么,我们可以选择安装MongoDB 2.6的二进制发布包。

下面我们在CentOS 6.5 x64系统上安装最新的MongoDB 2.6.0二进制发行版。

1、下载MongoDB 2.6.0二进制发行版
$ curl -O http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.0.tgz

2、解压MongoDB的压缩包
$ tar zvxf mongodb-linux-x86_64-2.6.0.tgz

3、简化目录名
$ mv mongodb-linux-x86_64-2.6.0 mongodb

4、配置PATH环境变量
要确保MongoDB的bin目录包含在PATH环境变量中。
或者初级符号连接到/usr/local/bin目录。
$ sudo vi /etc/profile
添加下面的内容:
export PATH=$PATH:/home/chuser/mongodb/bin
让环境变量生效:
$ source /etc/profile
验证环境变量是否生效:
$ mongod -version
db version v2.6.0
2014-04-14T02:53:01.082+0000 git version: 1c1c76aeca21c5983dc178920f5052c298db616c

5、运行MongoDB
创建数据目录
$ mkdir -p mongodb/data/db
要确保mongod对数据目录有读写权限。
运行MongoDB(指定建立的数据目录)
$ mongod --dbpath /home/chuser/mongodb/data &

6、验证MongoDB是否正常运行
$ mongo
MongoDB shell version: 2.6.0
connecting to: test
2014-04-14T03:40:59.560+0000 [initandlisten] connection accepted from 127.0.0.1:39014 #1 (1 connection now open)
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 databases;
admin (empty)
local 0.078GB
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn