centos7 mongodb3.2与3.4版本安装(转)
一、安装环境及配置yum
vi /etc/yum.repos.d/mongodb-org-3.2.repo [mongodb-org-3.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.2/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.2.asc
以上是3.2版本
vi /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-3.4.asc
以上是3.4版本
二、安装MongoDB
yum -y install mongodb-org
三、验证安装结果
# rpm -qa |grep mongodb mongodb-org-3.2.10-1.el7.x86_64 mongodb-org-mongos-3.2.10-1.el7.x86_64 mongodb-org-shell-3.2.10-1.el7.x86_64 mongodb-org-server-3.2.10-1.el7.x86_64 mongodb-org-tools-3.2.10-1.el7.x86_64 # rpm -ql mongodb-org-server /etc/init.d/mongod /etc/mongod.conf /etc/sysconfig/mongod /usr/bin/mongod /usr/share/doc/mongodb-org-server-3.2.10 /usr/share/doc/mongodb-org-server-3.2.10/GNU-AGPL-3.0 /usr/share/doc/mongodb-org-server-3.2.10/MPL-2 /usr/share/doc/mongodb-org-server-3.2.10/README /usr/share/doc/mongodb-org-server-3.2.10/THIRD-PARTY-NOTICES /usr/share/man/man1/mongod.1 /var/lib/mongo /var/log/mongodb /var/log/mongodb/mongod.log /var/run/mongodb 3.2 [root@localhost ~]# /etc/init.d/mongod start Starting mongod (via systemctl): [ OK ]
3.4 /etc/init.d/下没有mongod,启动的话用下面的方式启动
查看修改配置文件 : vi /etc/mongod.conf
启动mongod :systemctl start mongod.service
停止mongod :systemctl stop mongod,service
[root@localhost ~]# netstat -nltp|grep mongo tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 89958/mongod # mongo MongoDB shell version: 3.2.10 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 > db.version() 3.2.10
转自http://blog.csdn.net/leshami/article/details/53171375