利用阿里云的源yum方式安装Mongodb

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 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] 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值