//step 1. 檢查CentOS 版本
# cat /etc/os-release
//返回結(jié)果
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"
CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"
//step 2. 創(chuàng)建并編輯mongodb-org.repo文件
# vim /etc/yum.repos.d/mongodb-org-3.4.repo
[mongodb-org-3.4]
name=MongoDB Repository
#可選擇速度較快的鏡像,例如mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.5/x86_64
baseurl=https://repo.mongodb.org/yum/redhat/7Server/mongodb-org/3.5/x86_64/
gpgcheck=0
enabled=1
gpgcheck=1,需添加字段 gpgkey= https://www.mongodb.org/static/pgp/server-3.4.asc
//step 3. (推薦)清空yum緩存蓝牲,避免出現(xiàn)異常(例如蜓陌,沒有可用軟件包等)
# rm -rf /var/cache/yum
//step 4.安裝
# sudo yum install -y mongodb-org
#未測試aliyun等鏡像地址炫彩,速度未知
如果以上步驟未完成安裝改执,請參見:
https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/
MongoDB Community Edition 可分別安裝在以下系統(tǒng)中,可參考:
- Red Hat: https://docs.mongodb.com/master/tutorial/install-mongodb-on-red-hat/
- SUSE: https://docs.mongodb.com/master/tutorial/install-mongodb-on-suse/
- Amazon: https://docs.mongodb.com/master/tutorial/install-mongodb-on-amazon/
- Ubuntu: https://docs.mongodb.com/master/tutorial/install-mongodb-on-ubuntu/
- Debian: https://docs.mongodb.com/master/tutorial/install-mongodb-on-debian/
# vim /etc/mongod.conf
//對文件中的bindIp: 127.0.0.1 進行注釋
#sudo chkconfig mongod on
#sudo service mongod start
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者