Skip to content

Instantly share code, notes, and snippets.

@velopert
Last active July 31, 2018 17:21
Show Gist options
  • Save velopert/60918109ba89a0f89d659db8df8b8daf to your computer and use it in GitHub Desktop.
Save velopert/60918109ba89a0f89d659db8df8b8daf to your computer and use it in GitHub Desktop.
MongoDB 운영체제별 설치하기

MongoDB 서버 준비하기

설치하기

MongoDB 서버를 사용하기 위해서는, 우선 설치를 해주어야 합니다.

macOS

macOS 에서는 Homebrew 를 통하여 간편하게 설치 할 수 있습니다.

$ brew update
$ brew install mongodb
# 서버 실행하기
$ brew services start mongodb
==> Successfully started `mongodb` (label: homebrew.mxcl.mongodb)

Windows

윈도우에서는 MongoDB 공식홈페이지(https://www.mongodb.com/download-center?jmp=homepage#community) 의 인스톨러를 다운로드 해서 설치하세요. 데이터베이스가 저장되는 기본 경로는 C:\data\db 입니다. MongoDB 의 기본 설치 경로는 C:\Program Files\MongoDB\Server\버전\bin\ 입니다. 터미널을 열어서 해당 디렉토리로 이동하고, mongod 명령어를 입력해서 서버를 실행시키세요.

만약에, 데이터베이스 디렉토리를 임의로 설정하고 싶다면, 디렉토리를 먼저 만들고, mongod –-dbpath “c:\custom_folder” 의 형식으로 명령어를 실행시키면 됩니다.

또한, 만약에 MongoDB 를 실행 할 때마다 MongoDB 의 설치경로로 이동하는것이 번거롭다면, 다음과 같이 설치 경로를 환경변수의 PATH 에 추가하세요.

시스템 창 고급 시스템 설정 환경변수 PATH 선택 편집 새로만들기 C:\Program Files\MongoDB\Server\버전\bin 입력 확인 순으로 진행을 하시면 됩니다.

Linux

리눅스를 사용하신다면, 공식 홈페이지의 설치방법(https://docs.mongodb.com/manual/administration/install-on-linux/) 을 참조하세요.

설치 확인

설치가 잘 되었는지 확인하려면 터미널에서 mongo 를 입력해보세요.

$ mongo
MongoDB shell version v3.4.4
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.4
Server has startup warnings: 
2017-10-04T21:52:02.427+0900 I CONTROL  [initandlisten] 
2017-10-04T21:52:02.427+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2017-10-04T21:52:02.427+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2017-10-04T21:52:02.427+0900 I CONTROL  [initandlisten] 
> version()
3.4.4

연결이 잘 되었다면, version() 을 실행해서 버전이 잘 나타나는지 확인해보세요.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment