安装mang DB on CENT OS

来源:互联网 发布:centos 自动获取ip 编辑:程序博客网 时间:2024/05/22 09:44

1 – Add MongoDB to Yum repo

vim /etc/yum.repos.d/mongodb.repo
[mongodb]name=MongoDB repobaseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/gpgcheck=0enabled=1

 2 – Install Mongodb packages

[root@unixmen-centos7 ~]# yum install mongodb-orgLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: mirror.denit.net * extras: mirror.denit.net * updates: mirror.denit.netResolving Dependencies--> Running transaction check---> Package mongodb-org.x86_64 0:2.6.4-1 will be installed--> Processing Dependency: mongodb-org-mongos = 2.6.4 for package: mongodb-org-2.6.4-1.x86_64--> Processing Dependency: mongodb-org-server = 2.6.4 for package: mongodb-org-2.6.4-1.x86_64--> Processing Dependency: mongodb-org-tools = 2.6.4 for package: mongodb-org-2.6.4-1.x86_64--> Processing Dependency: mongodb-org-shell = 2.6.4 for package: mongodb-org-2.6.4-1.x86_64--> Running transaction check---> Package mongodb-org-mongos.x86_64 0:2.6.4-1 will be installed---> Package mongodb-org-server.x86_64 0:2.6.4-1 will be installed---> Package mongodb-org-shell.x86_64 0:2.6.4-1 will be installed---> Package mongodb-org-tools.x86_64 0:2.6.4-1 will be installed--> Finished Dependency Resolution

3 – Enable and Start Mongodb Server

[root@unixmen-centos7 ~]# chkconfig  mongod  on
[root@unixmen-centos7 ~]# service   mongod startStarting mongod (via systemctl):                           [  OK  ]

 4 – check if its running

[root@unixmen-centos7 ~]# ps -ef  |  grep   mongomongod    2587     1  1 05:24 ?        00:00:08 /usr/bin/mongod -f /etc/mongod.confroot      2984  2270  0 05:34 pts/1    00:00:00 grep --color=auto mongo[root@unixmen-centos7 ~]# netstat  -an  |  grep   27017tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTENunix  2      [ ACC ]     STREAM     LISTENING     20600    /tmp/mongodb-27017.sock[root@unixmen-centos7 ~]#

5 – Open the port on firewall

[root@unixmen-centos7 ~]# firewall-cmd --zone=public --add-port=27017/tcp --permanentsuccess[root@unixmen-centos7 ~]# firewall-cmd --reloadsuccess

6 – check from other machine

[root@unixmen-centos7 ~]# telnet 10.1.1.99  27017Trying 10.1.1.99...Connected to 10.1.1.99.Escape character is '^]'.

Done.

0 0
原创粉丝点击