CentOS 安装MongoDB
最近在研究学习NoSQL,好久没有写博客了。今天看到了MongoDB,熟悉了一下,便动手开始安装,在安装过程中遇到了一系列的问题,在此分享给大家,一来为自己做一个记录,二来方便大家遇到相同的问题时能够顺利解决。废话少说,直接进入正题吧。
本人的实验环境为CentOS5.5 ,32位系统,CentOS下,我们一般都会通过yum来安装相关软件,二话不说,我们先yum一下:
[root@h3 /]# yum install mongo-10gen-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * addons: centos.ustc.edu.cn * base: centos.ustc.edu.cn * epel: mirror.neu.edu.cn * extras: centos.ustc.edu.cn * updates: centos.ustc.edu.cn Setting up Install Process No package mongo-10gen-server available. Nothing to do [root@h3 /]#出现的错误是:找不到yum源,很简单,我们给它配置一份yum源吧。
我们在/etc/yum.repos.d目录下新建一个yum源文件,10gen.repo
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64 gpgcheck=0注意32位的操作系统配置如下:
[10gen] name=10gen Repository baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686 gpgcheck=0
[root@h3 yum.repos.d]# getconf LONG_BIT 32 [root@h3 yum.repos.d]#
[root@h3 yum.repos.d]# yum clean all Loaded plugins: fastestmirror Cleaning up Everything Cleaning up list of fastest mirrors [root@h3 yum.repos.d]#接下来,那么,接下来就是见证奇迹的时候了,在这里,我们直接yum insall mongo-10gen-server ,在这里稍作赘述,因为mongo分为客户端和服务端,而服务端依赖于客户端,因此我们直接安装 mongo-10gen-server就行了。
[root@h3 yum.repos.d]# yum install mongo-10gen-server Loaded plugins: fastestmirror Determining fastest mirrors * addons: mirror.esocc.com * base: mirror.esocc.com * epel: mirrors.hust.edu.cn * extras: mirror.esocc.com * updates: mirror01.idc.hinet.net 10gen | 951 B 00:00 10gen/primary | 11 kB 00:00 10gen 96/96 addons | 1.9 kB 00:00 addons/primary_db | 1.1 kB 00:00 base | 1.1 kB 00:00 base/primary | 983 kB 00:00 base 2770/2770 epel | 3.6 kB 00:00 epel/primary_db | 3.1 MB 00:02 extras | 2.1 kB 00:00 extras/primary_db | 167 kB 00:00 updates | 1.9 kB 00:00 updates/primary_db | 525 kB 00:00 Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package mongo-10gen-server.i686 0:2.4.5-mongodb_1 set to be updated --> Processing Dependency: mongo-10gen for package: mongo-10gen-server --> Running transaction check ---> Package mongo-10gen.i686 0:2.4.5-mongodb_1 set to be updated --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package Arch Version Repository Size ================================================================================ Installing: mongo-10gen-server i686 2.4.5-mongodb_1 10gen 12 M Installing for dependencies: mongo-10gen i686 2.4.5-mongodb_1 10gen 71 M Transaction Summary ================================================================================ Install 2 Package(s) Upgrade 0 Package(s) Total download size: 83 M Is this ok [y/N]: y Downloading Packages: (1/2): mongo-10gen-server-2.4.5-mongodb_1.i686.rpm | 12 MB 00:09 (2/2): mongo-10gen-2.4.5-mongodb_1.i686.rpm | 71 MB 00:48 -------------------------------------------------------------------------------- Total 1.4 MB/s | 83 MB 00:58 Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction Installing : mongo-10gen 1/2 Installing : mongo-10gen-server 2/2 Installed: mongo-10gen-server.i686 0:2.4.5-mongodb_1 Dependency Installed: mongo-10gen.i686 0:2.4.5-mongodb_1 Complete! [root@h3 yum.repos.d]#
安装完成。