1. mongodb-org-3.0.repo을 생성하여 yum 저장소에 추가합니다.
경로 : /etc/yum.repos.d/
[root@trandent2 ~]# vim /etc/yum.repos.d/mongodb-org-3.0.repo
2. mongodb-org-3.0.repo 의 내용
[mongodb-org-3.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.0/x86_64/
gpgcheck=0
enabled=1
3. 파일을 만들었으면 mongodb를 설치 합니다.
[root@trandent2 yum.repos.d]# yum install -y mongodb-org
Loaded plugins: fastestmirror, priorities
Setting up Install Process
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: data.nicehosting.co.kr
* extras: data.nicehosting.co.kr
* jpackage: ftp.heanet.ie
* updates: data.nicehosting.co.kr
base | 3.7 kB 00:00
extras | 3.4 kB 00:00
http://ftp.heanet.ie/pub/jpackage/6.0/generic/free/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
Trying other mirror.
To address this issue please refer to the below knowledge base article
https://access.redhat.com/articles/1320623
If above article doesn't help to resolve this issue please open a ticket with Red Hat Support.
jpackage | 1.9 kB 00:00
mongodb-org-3.0 | 2.5 kB 00:00
mongodb-org-3.0/primary_db | 76 kB 00:00
mysql-connectors-community | 2.5 kB 00:00
mysql-tools-community | 2.5 kB 00:00
mysql56-community | 2.5 kB 00:00
nodesource | 2.5 kB 00:00
updates | 3.4 kB 00:00
215 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package mongodb-org.x86_64 0:3.0.14-1.el6 will be installed
--> Processing Dependency: mongodb-org-tools = 3.0.14 for package: mongodb-org-3.0.14-1.el6.x86_64
--> Processing Dependency: mongodb-org-shell = 3.0.14 for package: mongodb-org-3.0.14-1.el6.x86_64
--> Processing Dependency: mongodb-org-server = 3.0.14 for package: mongodb-org-3.0.14-1.el6.x86_64
--> Processing Dependency: mongodb-org-mongos = 3.0.14 for package: mongodb-org-3.0.14-1.el6.x86_64
--> Running transaction check
---> Package mongodb-org-mongos.x86_64 0:3.0.14-1.el6 will be installed
---> Package mongodb-org-server.x86_64 0:3.0.14-1.el6 will be installed
---> Package mongodb-org-shell.x86_64 0:3.0.14-1.el6 will be installed
---> Package mongodb-org-tools.x86_64 0:3.0.14-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===========================================================================================================================================================================================================================================
Package Arch Version Repository Size
===========================================================================================================================================================================================================================================
Installing:
mongodb-org x86_64 3.0.14-1.el6 mongodb-org-3.0 5.8 k
Installing for dependencies:
mongodb-org-mongos x86_64 3.0.14-1.el6 mongodb-org-3.0 4.7 M
mongodb-org-server x86_64 3.0.14-1.el6 mongodb-org-3.0 9.8 M
mongodb-org-shell x86_64 3.0.14-1.el6 mongodb-org-3.0 5.0 M
mongodb-org-tools x86_64 3.0.14-1.el6 mongodb-org-3.0 38 M
Transaction Summary
===========================================================================================================================================================================================================================================
Install 5 Package(s)
Total download size: 57 M
Installed size: 166 M
Downloading Packages:
(1/5): mongodb-org-3.0.14-1.el6.x86_64.rpm | 5.8 kB 00:00
(2/5): mongodb-org-mongos-3.0.14-1.el6.x86_64.rpm | 4.7 MB 00:00
(3/5): mongodb-org-server-3.0.14-1.el6.x86_64.rpm | 9.8 MB 00:00
(4/5): mongodb-org-shell-3.0.14-1.el6.x86_64.rpm | 5.0 MB 00:00
(5/5): mongodb-org-tools-3.0.14-1.el6.x86_64.rpm | 38 MB 00:01
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 57 MB 00:05
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : mongodb-org-shell-3.0.14-1.el6.x86_64 1/5
Installing : mongodb-org-mongos-3.0.14-1.el6.x86_64 2/5
Installing : mongodb-org-tools-3.0.14-1.el6.x86_64 3/5
Installing : mongodb-org-server-3.0.14-1.el6.x86_64 4/5
Installing : mongodb-org-3.0.14-1.el6.x86_64 5/5
Verifying : mongodb-org-3.0.14-1.el6.x86_64 1/5
Verifying : mongodb-org-server-3.0.14-1.el6.x86_64 2/5
Verifying : mongodb-org-tools-3.0.14-1.el6.x86_64 3/5
Verifying : mongodb-org-mongos-3.0.14-1.el6.x86_64 4/5
Verifying : mongodb-org-shell-3.0.14-1.el6.x86_64 5/5
Installed:
mongodb-org.x86_64 0:3.0.14-1.el6
Dependency Installed:
mongodb-org-mongos.x86_64 0:3.0.14-1.el6 mongodb-org-server.x86_64 0:3.0.14-1.el6 mongodb-org-shell.x86_64 0:3.0.14-1.el6 mongodb-org-tools.x86_64 0:3.0.14-1.el6
Complete!
3. 설치가 끝났으면 실행시켜 봅니다.
[root@trandent2 ~]# service mongod start
Starting mongod: [ OK ]
[root@trandent2 ~]#
4. 외부 접속 허용
[root@trandent2 ~]# vim /etc/mongod.conf
29번째 줄의 bindIp 를 0.0.0.0 으로 설정하면 anyopen 특정 아피를 넣으면 특정 아이피만 허용 합니다
여러개의 아이피를 설정할 경우 , 로 구분합니다.
bindIp: 0.0.0.0 # Listen to local interface only, comment to listen on all interfaces.
저장 후 mongodb를 재시작 해줍니다.
[root@trandent2 ~]# service mongod restart
Stopping mongod: [ OK ]
Starting mongod: [ OK ]
[root@trandent2 ~]#