利用阿里雲的源yum方式安裝Mongodb

1)在/etc/yum.repos.d 建立一個mongodb-org.repo 源文件mongodb

[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 clean all
[root@qd-vpc-dev-op01 yum.repos.d]$ yum make cache
#更新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
MongoDB shell version: 3.2.16
connecting to: 127.0.0.1:27017/test
Server has startup warnings: 
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] 
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'.
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] 
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] 
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 4096 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.
2017-09-30T18:27:19.681+0800 I CONTROL  [initandlisten] 
相關文章
相關標籤/搜索