Centos7下快速安裝Mongo3.2
**一般安裝Mongo推薦源碼安裝,有時候為了快部署測試環境,或者僅僅是想裝個mongo shell,這時候yum安裝是最合適的方式,
下面介紹一下如何在Centos 7 下用yum的方式快速安裝Mongo。
**
MongoDB 3.2 一共有五個包:
mongodb-org-3.2.10-1.el7.x86_64.rpm #元數據包 上面記錄下以下4個包的依賴關系
mongodb-org-server-3.2.10-1.el7.x86_64.rpm #mongod服務端程序,以及相關的配置和初始化腳本。
mongodb-org-shell-3.2.10-1.el7.x86_64.rpm #mongo shell 客戶端環境
mongodb-org-tools-3.2.10-1.el7.x86_64.rpm #最大的一個包,有關Mongo的工具:包括 mongoimport mongostat等
mongodb-org-mongos-3.2.10-1.el7.x86_64.rpm #mongos程序 用來分片的路由
1.配置yum源
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
2.yum 安裝 MongoDB
yum -y install mongodb-org
#我這里只安裝mogno shell
[root@localhost scripts]# yum install mongodb-org-shell
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.sohu.com
* extras: mirrors.sohu.com
* updates: mirrors.sohu.com
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 mongodb-org-shell.x86_64.0.3.2.16-1.el7 將被 安裝
--> 解決依賴關系完成
依賴關系解決
=============================================================================================================================
Package 架構 版本 源 大小
=============================================================================================================================
正在安裝:
mongodb-org-shell x86_64 3.2.16-1.el7 mongodb-org-3.2 6.8 M
事務概要
=============================================================================================================================
安裝 1 軟件包
總下載量:6.8 M
安裝大小:20 M
Is this ok [y/d/N]: y
Downloading packages:
No Presto metadata available for mongodb-org-3.2
警告:/var/cache/yum/x86_64/7/mongodb-org-3.2/packages/mongodb-org-shell-3.2.16-1.el7.x86_64.rpm: 頭V3 RSA/SHA1 Signature, 密鑰 ID ea312927: NOKEY
mongodb-org-shell-3.2.16-1.el7.x86_64.rpm 的公鑰尚未安裝
mongodb-org-shell-3.2.16-1.el7.x86_64.rpm | 6.8 MB 00:02:15
從 https://www.mongodb.org/static/pgp/server-3.2.asc 檢索密鑰
導入 GPG key 0xEA312927:
用戶ID : "MongoDB 3.2 Release Signing Key <packaging@mongodb.com>"
指紋 : 42f3 e95a 2c4f 0827 9c49 60ad d68f a50f ea31 2927
來自 : https://www.mongodb.org/static/pgp/server-3.2.asc
是否繼續?[y/N]:y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安裝: mongodb-org-shell-3.2.16-1.el7.x86_641/1
驗證中 : mongodb-org-shell-3.2.16-1.el7.x86_641/1
已安裝:
mongodb-org-shell.x86_64 0:3.2.16-1.el7
完畢!
3.驗證安裝
[root@localhost scripts]# mongo --host xx.x.xxx.xxx
MongoDB shell version: 3.2.16
connecting to: xx.x.xxx.xxx:27017/test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user