본인은 CentOS 7 기준으로 설명 해보도록 하겠다
파일다운로드
> http://www.mongodb.org/downloads
위 URL 접속후 본인의 서버 환경에 맞추어 다운로드를 받도록 한다.
본인의 가상서버의 환경은 CetnOS7 (64bit) 이므로 Linux 64-bit를 받음
위와같이 페이지 전환이 되면서 다운로드 시작이 될 것이다.
(오늘기준 다운로드 버전 : mongodb-linux-x86_64-2.6.3.tgz)
다운로드 완료하였다면 실서버에 ftp 툴을 이용하여 UPLOAD
(본인은 /usr/local/ 디렉토리에 업로드함)
업로드 하였다면 shell에서 다음과 같이 작업 해보도록 하자
압축해제
[root@localhost ~]# cd /usr/local/ [root@localhost local]# tar -zxvf mongodb-linux-x86_64-2.6.3.tgz
디렉토리명 변경
[root@localhost local]# mv mongodb-linux-x86_64-2.6.3 mongo
서브디렉토리 생성
[root@localhost local]# cd mongo/ [root@localhost mongo]# mkdir data [root@localhost mongo]# mkdir config [root@localhost mongo]# mkdir log
config 파일 생성
[root@localhost mongo]# vi config/mongodb.conf
mongodb.conf 내용작성
dbpath=/usr/local/mongo logpath=/usr/local/mongo/mongo.log logappend=true port=7070 verbose=true fork=true rest=true
몽고DB 데몬실행
[root@localhost mongo]# /usr/local/mongo/bin/mongod --config config/mongodb.conf 2014-08-07T09:39:22.849+0900 ** WARNING: --rest is specified without --httpinterface, 2014-08-07T09:39:22.849+0900 ** enabling http interface about to fork child process, waiting until server is ready for connections. forked process: 3152 child process started successfully, parent exiting [root@localhost mongo]#
테스트 접속
[root@localhost mongo]# /usr/local/mongo/bin/mongod --config config/mongodb.conf 2014-08-07T09:39:22.849+0900 ** WARNING: --rest is specified without --httpinter face, 2014-08-07T09:39:22.849+0900 ** enabling http interface about to fork child process, waiting until server is ready for connections. forked process: 3152 child process started successfully, parent exiting [root@localhost mongo]# /usr/local/mongo/bin/mongo localhost:7070 MongoDB shell version: 2.6.3 connecting to: localhost:7070/test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user Server has startup warnings: 2014-08-07T09:39:22.849+0900 ** WARNING: --rest is specified without --httpinter face, 2014-08-07T09:39:22.849+0900 ** enabling http interface 2014-08-07T09:39:22.856+0900 [initandlisten] 2014-08-07T09:39:22.856+0900 [initandlisten] ** WARNING: Readahead for /usr/loca l/mongo is set to 4096KB 2014-08-07T09:39:22.856+0900 [initandlisten] ** We suggest setting it t o 256KB (512 sectors) or less 2014-08-07T09:39:22.856+0900 [initandlisten] ** http://dochub.mongodb.o rg/core/readahead >
위와같이 접근이 정상적으로 된다면 설치 및 접속 성공!!
※ 위 과정은 테스트 형식으로 몽고DB 설치 + 접속을 위해서 간단하게 설치해본것이다.
아마 제대로 사용하고자 한다면 config 파일에 대한 정보를 추가적으로 알아봐야 할것이다.