本文整理自网络,侵删。
一、准备工作:
运行yum命令查看MongoDB的包信息
[root@vm ~]# yum info mongo-10gen
(提示没有相关匹配的信息,)
说明你的centos系统中的yum源不包含MongoDB的相关资源,所以要在使用yum命令安装MongoDB前需要增加yum源,也就是在 /etc/yum.repos.d/目录中增加 *.repo yum源配置文件,以下分别是针对centos 64位和32位不同的系统的MongoDB yum 源配置内容:
我们这里就将该文件命名为:/etc/yum.repos.d/10gen.repo
For 64-bit yum源配置:
vi /etc/yum.repos.d/10gen.repo
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64
gpgcheck=0
For 32-bit yum源配置:
vi /etc/yum.repos.d/10gen.repo
[10gen]
name=10gen Repository
baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/i686
gpgcheck=0
根据自己的系统选择相应的配置内容
查看系统是32位还是64位的方法:
$ uname -a
含有x86_64的那说明是64位的,例如我的centos6.0 64bit系统执行这个命令后显示:
Linux vm.centos6 2.6.32-71.29.1.el6.x86_64 #1 SMP Mon Jun 27 19:49:27 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
做好yum源的配置后,如果配置正确执行下面的命令便可以查询MongoDB相关的信息:
查看mongoDB的服务器包的信息
[root@vm ~]# yum info mongo-10gen-server
****(省略多行不重要的信息)*********
Available Packages
Name : mongo-10gen-server
Arch : x86_64
Version : 1.8.2
Release : mongodb_1
Size : 4.7 M
Repo : 10gen
Summary : mongo server, sharding server, and support scripts
URL : http://www.mongodb.org
License : AGPL 3.0
Description: Mongo (from “huMONGOus”) is a schema-free document-oriented
: database.
:
: This package provides the mongo server software, mongo sharding
: server softwware, default configuration files, and init.d scripts.
[root@vm ~]#
查看客户端工具的信息
[root@vm ~]# yum info mongo-10gen
Loaded plugins: fastestmirror
**(省略多行不重要的信息)**
Installed Packages
Name : mongo-10gen
Arch : x86_64
Version : 1.8.2
Release : mongodb_1
Size : 55 M
Repo : 10gen
Summary : mongo client shell and tools
URL : http://www.mongodb.org
License : AGPL 3.0
Description: Mongo (from “huMONGOus”) is a schema-free document-oriented
: database. It features dynamic profileable queries, full indexing,
: replication and fail-over support, efficient storage of large
: binary data objects, and auto-sharding.
:
: This package provides the mongo shell, import/export tools, and
: other client utilities.
[root@vm ~]#
二、安装MongoDB的服务器端和客户端工具
1.安装服务器端:
[root@vm ~]# yum install mongo-10gen-server
[root@vm ~]# ls /usr/bin/mongo(tab键)
mongo mongod mongodump mongoexport mongofiles mongoimport mongorestore mongos mongostat
———————————————–
这些就是MongoDB的程序文件
因为mongo-10gen-server包依赖于mongo-10gen,所以安装了服务器后就不需要单独安装客户端工具包mongo-10gen了
2.单独安装可客户端:
[root@vm ~]# yum install mongo-10gen
3.检查
[root@vm ~]# /etc/init.d/mongod
Usage: /etc/init.d/mongod {start|stop|status|restart|reload|force-reload|condrestart}
[root@vm ~]# /etc/init.d/mongod status
mongod (pid 1341) is running…
[root@vm ~]#
说明安后服务器端已经在运行了
相关阅读 >>
centos7安装mongo数据库的方法(mongo4.2.8)
更多相关阅读请进入《mongodb》频道 >>
数据库系统概念 第6版
本书主要讲述了数据模型、基于对象的数据库和XML、数据存储和查询、事务管理、体系结构等方面的内容。
相关推荐
评论
管理员已关闭评论功能...
- 欢迎访问木庄网络博客
- 可复制:代码框内的文字。
- 方法:Ctrl+C。