今天線上上伺服器上安裝MongoDB,從Mongo官網直接下載連結,結果在下載時發覺速度慢的可憐。迫於無奈,只能找國內的映象下載。這裡選擇阿里雲的源進行安裝,記錄如下:
1)在/etc/yum.repos.d 建立一個mongodb-org.repo 原始檔 [root@qd-vpc-dev-op01 ~]$ cd /etc/yum.repos.d/ [root@qd-vpc-dev-op01 yum.repos.d]$ touch mongodb-org.repo [root@qd-vpc-dev-op01 yum.repos.d]$ cat mongodb-org.repo [mongodb-org] name=MongoDB Repository baseurl=http://mirrors.aliyun.com/mongodb/yum/redhat/7Server/mongodb-org/3.2/x86_64/ gpgcheck=0 enabled=1 2)更新yum源 [root@qd-vpc-dev-op01 yum.repos.d]$ yum update 3) 安裝MongoDB [root@qd-vpc-dev-op01 yum.repos.d]$ yum install -y mongodb-org 4)啟動MongoDB [root@qd-vpc-dev-op01 yum.repos.d]$ service mongod start [root@qd-vpc-dev-op01 yum.repos.d]$ chkconfig mongod on 5)配置遠端訪問 [root@qd-vpc-dev-op01 yum.repos.d]$cat /etc/mongod.conf|grep -v "#"|grep -v "^$" systemLog: destination: file logAppend: true path: /var/log/mongodb/mongod.log storage: dbPath: /var/lib/mongo journal: enabled: true processManagement: net: port: 27017 [root@qd-vpc-dev-op01 yum.repos.d]$ service mongod restart Restarting mongod (via systemctl): [ OK ] 6)開啟MongoDB [root@qd-vpc-dev-op01 yum.repos.d]$ mongo 127.0.0.1:27017