阿里云的源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
根据自己的系统版本选择填写的5  6  7版本的源
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]

发表评论

电子邮件地址不会被公开。