MongoDB 發佈團隊對全部軟件包進行數字簽名, 以便進行認證特定的 MongoDB 軟件包是有一個有效的而且未被改變 MongoDB 版本. 在安裝 MongoDB 以前, 你應該使用 PGP 簽名或者 SHA-256 校驗和來驗證軟件包.mongodb
PGP 簽名經過檢查文件的真實性和完整性來提供最好的保證, 防止篡改.shell
加密校驗和僅校驗文件的完整性, 以防止網絡傳輸錯誤.segmentfault
MongoDB 使用不一樣的 PGP 密鑰對每一個版本的分支進行簽名. 自 MongoDB 2.2 版本以來, 每一個版本的分支的公鑰文件能夠從密鑰服務器下載 .asc 和 .pub 格式的文件.服務器
根據你的環境從 https://www.mongodb.org/downl... 下載二進制文件.網絡
例如, 要經過 shell 下載 OS X 的 3.0.5 版本, 請輸入如下命令:curl
curl -LO https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.5.tgz
curl -LO https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.5.tgz.sig
若是你還沒有下載並導入 MongoDB 3.0 公鑰, 請輸入如下命令:加密
curl -LO https://www.mongodb.org/static/pgp/server-3.0.asc gpg --import server-3.0.asc
你應該會接收到這個消息:url
gpg: key 24F3C978: public key "MongoDB 3.0 Release Signing Key <packaging@mongodb.com>" imported gpg: Total number processed: 1 gpg: imported: 1
輸入這個命令:code
gpg --verify mongodb-osx-x86_64-3.0.5.tgz.sig mongodb-osx-x86_64-3.0.5.tgz
你應該會接收到這個消息:server
gpg: Signature made Mon 27 Jul 2015 07:51:53 PM EDT using RSA key ID 24F3C978 gpg: Good signature from "MongoDB 3.0 Release Signing Key <packaging@mongodb.com>" [unknown]
若是你收到了如下消息, 請確認你導入了正確的公鑰:
gpg: Signature made Mon 27 Jul 2015 07:51:53 PM EDT using RSA key ID 24F3C978 gpg: Can't check signature: public key not found
若是程序包已經正確的簽名, 可是你不信任當前本地 trustdb 的簽名, 則 gpg 將返回如下消息:
gpg: WARNING: This key is not certified with a trusted signature! gpg: There is no indication that the signature belongs to the owner. Primary key fingerprint: 89AE C6ED 5423 0831 793F 1384 BE0E B6AA 24F3 C978
根據你的環境從 https://www.mongodb.org/downl... 下載二進制文件.
例如, 要經過 shell 下載 OS X 的 3.0.5 版本, 請輸入如下命令:
curl -LO https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.5.tgz
curl -LO https://fastdl.mongodb.org/osx/mongodb-osx-x86_64-3.0.5.tgz.sha256
計算軟件包的校驗和:
shasum -c mongodb-osx-x86_64-3.0.5.tgz.sha256
若是校驗和與下載的軟件包相匹配, 則應該放回如下內容:
mongodb-osx-x86_64-3.0.5.tgz: OK
下一章: https://segmentfault.com/a/11...
本文地址: https://docs.mongodb.com/manu...