MongoDB是深受广大开源爱好者支持和研究的NoSQL数据库之一,它基于灵活的JSON文档方式,非常适合敏捷开发,其高可用功能强大,支持水平扩展等众多关键特性。一如其简约而不简单的MySQL一样,安装起来也非常方便,支持源码编译安装,rpm安装以及yum安装等众多方式。本文主要讲述在CentOS 7下yum方式快速安装MongoDB。
一、安装环境及配置yum
# 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=https://www.mongodb.org/static/pgp/server-3.2.asc
二、安装MongoDB
# yum -y install mongodb-org
Loaded plugins: fastestmirror, langpacks
base | 3.6 kB 00:00:00
epel/x86_64/metalink | 5.2 kB 00:00:00
extras | 3.4 kB 00:00:00
mongodb-org-3.2 | 2.5 kB 00:00:00
updates | 3.4 kB 00:00:00
mongodb-org-3.2/7/primary_db | 50 kB 00:00:03
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.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 = 3.2.10 for package: mongodb-org-3.2.10-1.el7.x86_64
--> Processing Dependency: mongodb-org-shell = 3.2.10 for package: mongodb-org-3.2.10-1.el7.x86_64
--> Processing Dependency: mongodb-org-server = 3.2.10 for package: mongodb-org-3.2.10-1.el7.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.2.10 for package: mongodb-org-3.2.10-1.el7.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.2.10-1.el7 will be installed
---> Package mongodb-org-server.x86_64 0:3.2.10-1.el7 will be installed
---> Package mongodb-org-shell.x86_64 0:3.2.10-1.el7 will be installed
---> Package mongodb-org-tools.x86_64 0:3.2.10-1.el7 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package Arch Version Repository Size
===================================================================================================
Installing:
mongodb-org x86_64 3.2.10-1.el7 mongodb-org-3.2 5.8 k
Installing for dependencies:
mongodb-org-mongos x86_64 3.2.10-1.el7 mongodb-org-3.2 5.6 M
mongodb-org-server x86_64 3.2.10-1.el7 mongodb-org-3.2 12 M
mongodb-org-shell x86_64 3.2.10-1.el7 mongodb-org-3.2 6.7 M
mongodb-org-tools x86_64 3.2.10-1.el7 mongodb-org-3.2 41 M
Transaction Summary
===================================================================================================
Install 1 Package (+4 Dependent packages)