CentOS 7 yum方式快速安装MongoDB

前端之家收集整理的这篇文章主要介绍了CentOS 7 yum方式快速安装MongoDB前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

http://blog.csdn.net/leshami/article/details/53171375


一、安装环境及配置yum

 
 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
# more /etc/redhat-release CentOS Linux release 7.2.1511 (Core) # 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=/www.mongodb.org/static/pgp/server-3.2.asc

二、安装MongoDB

  
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    # yum -y install mongodb-org Loaded plugins: fastestmirror,langpacks base | 3.6 kB 00:00 epel/x86_64/Metalink | 5.2 kB 00 extras | 3.4 kB 00 mongodb-org-3.2 | 2.5 kB 00 updates | 3.2/7/primary_db | 50 kB 03 Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * epel: mirrors.tuna.tsinghua.edu.cn * extras: mirrors.com * updates: mirrors.com Resolving Dependencies --> Running transaction check ---> Package mongodb-org.x86_64 0:3.2.10-1.el7 will be installed --> Processing Dependency: mongodb-org-tools = .10 for package: mongodb-org-1.el7.x86_64 --> Processing Dependency: mongodb-org-shell = .x86_64 --> Processing Dependency: mongodb-org-server = .x86_64 --> Processing Dependency: mongodb-org-mongos = .x86_64 --> Running transaction check ---> Package mongodb-org-mongos1.el7 will be installed ---> Package mongodb-org-server1.el7 will be installed ---> Package mongodb-org-shell1.el7 will be installed ---> Package mongodb-org-tools1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================== Package Arch Version Repository Size =================================================================================================== Installing: mongodb-org x86_64 1.el7 mongodb-org-3.2 5.8 k Installing for dependencies: mongodb-org-mongos x86_64 5.6 M mongodb-org-server x86_64 3.2 12 M mongodb-org-shell x86_64 6.7 M mongodb-org-tools x86_64 41 M Transaction Summary =================================================================================================== Install 1 Package (+4 Dependent packages) Total download size: 65 M Installed size: 201 M Downloading packages: warning: /var/cache/yum/x86_64/7/mongodb-org-3.2/packages/mongodb-org-.x86_64.rpm: Header V3 RSA/SHA1 Signature,key ID ea312927: NOKEY ] Public key for mongodb-org-.rpm is not installed (1/5): mongodb-org-.rpm | 5.8 kB 04 (2/5): mongodb-org-server-.rpm | 12 MB 11 (3/5): mongodb-org-shell-.rpm | 6.7 MB 06 (4/5): mongodb-org-tools-.rpm | 41 MB 36 (5/5): mongodb-org-mongos-.rpm | 5.6 MB 03:28 --------------------------------------------------------------------------------------------------- Total 322 kB/s | 65 MB 28 Retrieving key from https://www.mongodb.org/static/pgp/server-3.2.asc Importing GPG key 0xEA312927: Userid : "MongoDB 3.2 Release Signing Key <packaging@mongodb.com>" Fingerprint: 42f3 e95a 2c4f 0827 9c49 60ad d68f a50f ea31 2927 From : https://www.asc Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mongodb-org-tools-.x86_64 5 Installing : mongodb-org-mongos-.x86_64 5 Installing : mongodb-org-shell-5 Installing : mongodb-org-server-5 Installing : mongodb-org-.x86_64 5 Verifying : mongodb-org-server-5 Verifying : mongodb-org-5 Verifying : mongodb-org-shell-5 Verifying : mongodb-org-mongos-5 Verifying : mongodb-org-tools-5 Installed: mongodb-org1.el7 Dependency Installed: mongodb-org-mongos1.el7 #Author : Leshami mongodb-org-server#Blog : http://blog.csdn.net/leshami mongodb-org-shell1.el7 mongodb-org-tools1.el7 Complete!

    三、验证安装结果

      
      
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    # rpm -qa |grep mongodb mongodb-org-.x86_64 mongodb-org-mongos-.x86_64 mongodb-org-shell-.x86_64 mongodb-org-server-.x86_64 mongodb-org-tools-.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-.10 /usr/share/doc/mongodb-org-server-.10/GNU-AGPL-3.0 /usr/share/doc/mongodb-org-server-.10/MPL-2 /usr/share/doc/mongodb-org-server-.10/README /usr/share/doc/mongodb-org-server-.10/THIRD-PARTY-NOTICES /usr/share/man/man1/mongod.1 /var/lib/mongo /var/log/mongodb /var/log/mongodb/mongod.log /var/run/mongodb [root@localhost ~]# /etc/init.d/mongod start Starting mongod (via systemctl): [ OK ] [root@localhost ~]# netstat -nltp|grep mongo tcp 0 0 127.0.0.1:27017 0.0.0:* LISTEN 89958/mongod # mongo MongoDB shell version: .10 connecting to: test Welcome to the MongoDB shell. For interactive help,type "help". For more comprehensive documentation,see http://docs.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user > db.version() .10

    netstat -tunlp //查看所有tcp、udp应用端口;

    kill -9 <pid> //根据pid杀掉线程

     netstat -lanp | grep "27017"   //查看mongodb是否启动

    四、其它参考

    Linux下快速安装MongoDB
    Windows平台下安装MongoDB
    MongoDB 启动与停止

    原文链接:https://www.f2er.com/centos/376570.html

    猜你在找的CentOS相关文章