[mongoDB] centos에 몽고DB 설치하기
1. yum Repository 추가
$ vim /etc/yum.repos.d/mongodb.repo |
[mongodb] name=MongoDB Repositiory baseurl=http://downloads- baseurl=http://downloads-distro.mongodb.org/repo/redhat/os/x86_64/ gpgcheck=0 enabled=1 |
2. yum으로 설치
$ yum -u install mongodb-org |
3. yum mongodb 업데이트 exclude
$ vi /etc/yum.conf |
exclude=mongodb-org,mongodb-org-server,mongodb-org-shell,mongodb-org-mongos,mongodb-org-tools |
4. 방화벽 오픈
$ iptables -I INPUT 1 -p tcp --dport 27017 -j ACCEPT $ service iptables save $ service iptables restart |
5. 실행
$ service mongod start |
6. 부팅시 자동 실행
$ chkconfig mongod on |
7. 테스트
$ mongo |
MongoDB shell version : 2.6.xx connecting to: test >db.users.insert({name : 'kim'}); WriteResult({"nInserted" : 1 }); >db.users.find(); { "_id" : ObjectId("55dbcbfa00015a58ddd9a11e"), "name" : "kim" } |