文档章节

yum安装Mongodb-server

王孟君
 王孟君
发布于 2017/02/15 09:32
字数 1411
阅读 746
收藏 0

本文记录一下在CentOS 6.7上,yum安装Mongodb-server

安装Mongodb-server

使用yum install mongodb-server命令安装mongodb server~~~

[root@dev18 ~]# yum install mongodb-server
Loaded plugins: fastestmirror, security
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mongodb-server.x86_64 0:2.4.14-4.el6 will be installed
--> Processing Dependency: v8 for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libv8.so.3()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libtcmalloc.so.4()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_thread-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_system-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_program_options-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_iostreams-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Processing Dependency: libboost_filesystem-mt.so.5()(64bit) for package: mongodb-server-2.4.14-4.el6.x86_64
--> Running transaction check
---> Package boost-filesystem.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-iostreams.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-program-options.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-system.x86_64 0:1.41.0-27.el6 will be installed
---> Package boost-thread.x86_64 0:1.41.0-27.el6 will be installed
---> Package gperftools-libs.x86_64 0:2.0-11.el6.3 will be installed
--> Processing Dependency: libunwind.so.8()(64bit) for package: gperftools-libs-2.0-11.el6.3.x86_64
---> Package v8.x86_64 1:3.14.5.10-25.el6 will be installed
--> Processing Dependency: libicuuc.so.42()(64bit) for package: 1:v8-3.14.5.10-25.el6.x86_64
--> Processing Dependency: libicui18n.so.42()(64bit) for package: 1:v8-3.14.5.10-25.el6.x86_64
--> Processing Dependency: libicudata.so.42()(64bit) for package: 1:v8-3.14.5.10-25.el6.x86_64
--> Running transaction check
---> Package libicu.x86_64 0:4.2.1-12.el6 will be installed
---> Package libunwind.x86_64 0:1.1-3.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================================================
 Package                              Arch                  Version                              Repository           Size
===========================================================================================================================
Installing:
 mongodb-server                       x86_64                2.4.14-4.el6                         epel                5.1 M
Installing for dependencies:
 boost-filesystem                     x86_64                1.41.0-27.el6                        ISO                  47 k
 boost-iostreams                      x86_64                1.41.0-27.el6                        ISO                  39 k
 boost-program-options                x86_64                1.41.0-27.el6                        ISO                 108 k
 boost-system                         x86_64                1.41.0-27.el6                        ISO                  26 k
 boost-thread                         x86_64                1.41.0-27.el6                        ISO                  43 k
 gperftools-libs                      x86_64                2.0-11.el6.3                         epel                246 k
 libicu                               x86_64                4.2.1-12.el6                         ISO                 4.9 M
 libunwind                            x86_64                1.1-3.el6                            epel                 55 k
 v8                                   x86_64                1:3.14.5.10-25.el6                   epel                3.0 M

Transaction Summary
===========================================================================================================================
Install      10 Package(s)

Total download size: 14 M
Installed size: 46 M
Is this ok [y/N]: y

输入y

Is this ok [y/N]: y
Downloading Packages:
(1/10): gperftools-libs-2.0-11.el6.3.x86_64.rpm                                                     | 246 kB     00:00     
(2/10): libunwind-1.1-3.el6.x86_64.rpm                                                              |  55 kB     00:00     
(3/10): mongodb-server-2.4.14-4.el6.x86_64.rpm                                                      | 5.1 MB     00:00     
(4/10): v8-3.14.5.10-25.el6.x86_64.rpm                                                              | 3.0 MB     00:00     
(5/10): boost-iostreams-1.41.0-27.el6.x86_64.rpm                                                    |  39 kB     00:00     
(6/10): boost-filesystem-1.41.0-27.el6.x86_64.rpm                                                   |  47 kB     00:00     
(7/10): boost-thread-1.41.0-27.el6.x86_64.rpm                                                       |  43 kB     00:00     
(8/10): boost-program-options-1.41.0-27.el6.x86_64.rpm                                              | 108 kB     00:00     
(9/10): boost-system-1.41.0-27.el6.x86_64.rpm                                                       |  26 kB     00:00     
(10/10): libicu-4.2.1-12.el6.x86_64.rpm                                                             | 4.9 MB     00:00     
---------------------------------------------------------------------------------------------------------------------------
Total                                                                                      4.8 MB/s |  14 MB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : boost-system-1.41.0-27.el6.x86_64                                                                      1/10 
  Installing : boost-filesystem-1.41.0-27.el6.x86_64                                                                  2/10 
  Installing : libicu-4.2.1-12.el6.x86_64                                                                             3/10 
  Installing : 1:v8-3.14.5.10-25.el6.x86_64                                                                           4/10 
  Installing : boost-program-options-1.41.0-27.el6.x86_64                                                             5/10 
  Installing : boost-thread-1.41.0-27.el6.x86_64                                                                      6/10 
  Installing : boost-iostreams-1.41.0-27.el6.x86_64                                                                   7/10 
  Installing : libunwind-1.1-3.el6.x86_64                                                                             8/10 
  Installing : gperftools-libs-2.0-11.el6.3.x86_64                                                                    9/10 
  Installing : mongodb-server-2.4.14-4.el6.x86_64                                                                    10/10 
  Verifying  : mongodb-server-2.4.14-4.el6.x86_64                                                                     1/10 
  Verifying  : gperftools-libs-2.0-11.el6.3.x86_64                                                                    2/10 
  Verifying  : libunwind-1.1-3.el6.x86_64                                                                             3/10 
  Verifying  : 1:v8-3.14.5.10-25.el6.x86_64                                                                           4/10 
  Verifying  : boost-iostreams-1.41.0-27.el6.x86_64                                                                   5/10 
  Verifying  : boost-filesystem-1.41.0-27.el6.x86_64                                                                  6/10 
  Verifying  : boost-thread-1.41.0-27.el6.x86_64                                                                      7/10 
  Verifying  : boost-program-options-1.41.0-27.el6.x86_64                                                             8/10 
  Verifying  : boost-system-1.41.0-27.el6.x86_64                                                                      9/10 
  Verifying  : libicu-4.2.1-12.el6.x86_64                                                                            10/10 

Installed:
  mongodb-server.x86_64 0:2.4.14-4.el6                                                                                     

Dependency Installed:
  boost-filesystem.x86_64 0:1.41.0-27.el6                         boost-iostreams.x86_64 0:1.41.0-27.el6                   
  boost-program-options.x86_64 0:1.41.0-27.el6                    boost-system.x86_64 0:1.41.0-27.el6                      
  boost-thread.x86_64 0:1.41.0-27.el6                             gperftools-libs.x86_64 0:2.0-11.el6.3                    
  libicu.x86_64 0:4.2.1-12.el6                                    libunwind.x86_64 0:1.1-3.el6                             
  v8.x86_64 1:3.14.5.10-25.el6                                   

Complete!

可以看到安装Complete!

启动mongodb-server

使用service mongod start命令来启动mongo-server。

[root@dev18 ~]# service mongod start
Starting mongod:                                           [  OK  ]
[root@dev18 ~]# 

验证MongoDB是否成功启动

我们可以检查日志内容来看,MongoDB是否成功启动~~

日志文件路径/var/log/mongodb/mongod.log,如果可以看到类似如下的结果:

[initandlisten] waiting for connections on port <port>

则表明MongoDB已经成功启动。

Wed Feb 15 08:16:08.784 [initandlisten] MongoDB starting : pid=4782 port=27017 dbpath=/var/lib/mongodb 64-bit host=dev18.gzhl.zhhl
Wed Feb 15 08:16:08.784 [initandlisten] db version v2.4.14
Wed Feb 15 08:16:08.784 [initandlisten] git version: nogitversion
Wed Feb 15 08:16:08.784 [initandlisten] build info: Linux buildvm-11.phx2.fedoraproject.org 4.7.2-201.fc24.x86_64 #1 SMP Fri Aug 26 15:58:40 UTC 2016 x86_64 BOOST_LIB_VERSION=1_41
Wed Feb 15 08:16:08.784 [initandlisten] allocator: tcmalloc
Wed Feb 15 08:16:08.784 [initandlisten] options: { bind_ip: "127.0.0.1", command: [ "run" ], config: "/etc/mongodb.conf", dbpath: "/var/lib/mongodb", fork: "true", journal: "true", logpath: "/var/log/mongodb/mongodb.log", nohttpinterface: "true", pidfilepath: "/var/run/mongodb/mongodb.pid", port: 27017, quiet: true }
Wed Feb 15 08:16:08.787 [initandlisten] journal dir=/var/lib/mongodb/journal
Wed Feb 15 08:16:08.787 [initandlisten] recover : no journal files present, no recovery needed
Wed Feb 15 08:16:08.863 [initandlisten] allocating new ns file /var/lib/mongodb/local.ns, filling with zeroes...
Wed Feb 15 08:16:08.909 [FileAllocator] allocating new datafile /var/lib/mongodb/local.0, filling with zeroes...
Wed Feb 15 08:16:08.909 [FileAllocator] creating directory /var/lib/mongodb/_tmp
Wed Feb 15 08:16:08.912 [FileAllocator] done allocating datafile /var/lib/mongodb/local.0, size: 64MB,  took 0 secs
Wed Feb 15 08:16:08.913 [initandlisten] waiting for connections on port 27017

通过上述的日志文件内容,我们可以知道MongoDB已经成功启动~~

GUI工具连接MongoDB

本文采用mongobooster可视化工具来连接MongoDB,输入相关的ip地址,localhost改成MongoDB安装的机器ip即可。

遇到连接Mongo服务失败的错误信息。

遇到如上信息是因为mongodb的配置文件中bind_ip的默认ip地址为127.0.0.1,而我的客户端和mongo服务器不是同一台机器,最终导致失败~~

可以通过vim /etc/mongodb.conf命令来打开配置文件查看。

为了方便测试,我们先注释掉bind_ip。不过在实际使用中,为了安全性,不应该注释掉这个配置项~~~

注释掉bind_ip之后,我们可以重启服务~~

[root@dev18 usr]# service mongod stop
Stopping mongod:                                           [  OK  ]
[root@dev18 usr]# service mongod start
Starting mongod:                                           [  OK  ]
[root@dev18 usr]# 

重新连接,连接成功~~~

 

 

 

© 著作权归作者所有

共有 人打赏支持
王孟君

王孟君

粉丝 214
博文 94
码字总数 221044
作品 0
杭州
高级程序员
使用yum安装MongoDB及服务器端配置

安装MongoDB的方法有很多种,可以源代码安装,在CentOS也可以用yum源安装的方法。由于MongoDB更新得比较快,我比较喜欢用yum源安装的方法。64位Centos下的安装步骤如下: 1、准备工作 运行y...

SunnyWu
2014/11/06
0
0
CentOS7下使用yum安装Mongodb3.4

1.创建mongodb3.4的yum源文件 在yum源文件目录中创建mongodb-org-3.4.repo 写入仓库文件 2.验证yum源文件是否有效 查看mongodb所需安装文件 3.安装mongodb所需包 MongoDB提供的官方安装文件包...

hengbao5
08/07
0
0
CentOS 6 nodejs mongodb 安装

wget http://nodejs.org/dist/v0.8.7/node-v0.8.7.tar.gz (稳定版) //wget http://nodejs.org/dist/v0.10.22/node-v0.10.22.tar.gz (最新版) 2、解压 tar -xvf node-v0.10.22-linux-x64.t......

千山万水
2015/05/06
0
0
Linux 系统安装 Mongodb 数据库

一、通过rpm方式安装 1、系统准备 我们的系统版本为 2、安装包下载 下载地址:http://mirrors.aliyun.com/mongodb/yum/redhat/ ,可以根据自己的系统版本选择。 我选择的路径:http://mirror...

wzlinux
07/31
0
0
centos 7 yum 安装mongodb3.6(卸载)

centos 7 yum 安装mongodb3.6(卸载) 2018年03月05日 15:58:20 阅读数:2653 yum下载安装好mongodb3.6之后,切记把mongodb-org-3.6.repo文件删掉或重命名,否则yum之后下载其他东西都会失败...

linjin200
07/02
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

jquery创建类似于java的map

var map = {}; // Map map = new HashMap(); map[key] = value; // map.put(key, value); var value = map[key]; // Object value = map.get(key); var has = key in map; // boolean has = ......

SuperDabai
43分钟前
0
0
java大数据转换16进制转10进制

public static void main(String[] args) {String hex = "0xdbf3accc683297cf0000";BigInteger amount = new BigInteger(hex.substring(2), 16);System.out.println(amount);......

任梁荣
昨天
2
0
OSChina 周六乱弹 —— 目测我们程序员丁克的几率不大

Osc乱弹歌单(2018)请戳(这里) 【今日歌曲】 @真Skr小机灵鬼儿:8.13分享Jocelyn Pook/Russian Red的单曲《Loving Strangers》 《Loving Strangers》- Jocelyn Pook/Russian Red 手机党少...

小小编辑
昨天
10
3
TypeScript基础入门 - 函数 - 剩余参数

转载 TypeScript基础入门 - 函数 - 剩余参数 项目实践仓库 https://github.com/durban89/typescript_demo.gittag: 1.2.1 为了保证后面的学习演示需要安装下ts-node,这样后面的每个操作都能...

durban
昨天
1
0
OpenCV边缘检测算子原理总结及实现

1. 拉普拉斯算子 原理:是一种基于图像导数运算的高通线性滤波器。它通过二阶导数来度量图像函数的曲率。 拉普拉斯算子是最简单的各向同性微分算子,它具有旋转不变性。一个二维图像函数的拉...

漫步当下
昨天
0
0

没有更多内容

加载失败,请刷新页面

加载更多

下一页

返回顶部
顶部