몽고DB 설치하기


참고 페이지 : https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu-tarball/



나의 우분투버전은 Ubuntu 18.04 (Bionic 버전이다.)



MongoDB 를 설치하기위해서는 아래 패키지를 설치한다.


 sudo apt-get install libcurl4 openssl



1. 설치 파일 다운로드 :https://www.mongodb.com/download-center/community?jmp=docs



 2. 설치방법


1) 압축 파일 해제

  /home/db  $ tar xvf mongodb-linux-x86_64-ubuntu1804-4.0.4.tgz

2) 실행 폴더 환경변수 등록

export PATH=$PWD: (Mongodb/bin 패스)


나의 경우는 export PATH=$PWD:/home/kj/DB/mongodb-linux-x86_64-ubuntu1804-4.0.4/bin

환경변수 ~/.bashrc 파일안에 설정하였다.

3) data 와 log 디렉토리 생성

 sudo mkdir -p /MongoDB/db

 sudo mkdir -p /var/log/mongodb


4). 실행

sudo ./mongod --dbpath /MongoDB/db --logpath /var/log/mongodb/mongod.log --fork

 2018-12-19T15:06:28.614+0900 I CONTROL  [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols 'none'

about to fork child process, waiting until server is ready for connections.

forked process: 5739

child process started successfully, parent exiting




5.) ./mongo 를 통해 접속가능한지 확인

MongoDB shell version v4.0.4

connecting to: mongodb://127.0.0.1:27017

Implicit session: session { "id" : UUID("d1753a27-7745-47ef-9693-8696ca35a337") }

MongoDB server version: 4.0.4

Server has startup warnings: 

2018-12-19T15:06:28.622+0900 I STORAGE  [initandlisten] 

2018-12-19T15:06:28.622+0900 I STORAGE  [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine

2018-12-19T15:06:28.622+0900 I STORAGE  [initandlisten] **          See http://dochub.mongodb.org/core/prodnotes-filesystem

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] 

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] 

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server. 

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP 

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.

2018-12-19T15:06:29.847+0900 I CONTROL  [initandlisten] 

---

Enable MongoDB's free cloud-based monitoring service, which will then receive and display

metrics about your deployment (disk utilization, CPU, operation statistics, etc).


The monitoring data will be available on a MongoDB website with a unique URL accessible to you

and anyone you share the URL with. MongoDB may use this information to make product

improvements and to suggest MongoDB products and deployment options to you.


To enable free monitoring, run the following command: db.enableFreeMonitoring()

To permanently disable this reminder, run the following command: db.disableFreeMonitoring()




사용자 를 등록해준다.

> usb admin

2018-12-19T15:11:15.962+0900 E QUERY    [js] SyntaxError: missing ; before statement @(shell):1:4

> use admin

switched to db admin

> db.createUser({user: "root", pwd: "XXX!",roles:[{role: "root",db:"admin"}]});

Successfully added user: {

"user" : "root",

"roles" : [

{

"role" : "root",

"db" : "admin"

}

]

}



활용 테스트는 나중에. 

'Database' 카테고리의 다른 글

[Docker] MySQL 설치하기  (0) 2021.03.22
[MongoDB] 관련 정리  (0) 2018.12.19
[MongoDB] API 튜토리얼  (0) 2018.12.19
[MongoDB] mongocxx driver 설치  (0) 2018.12.19
[MongoDB] 설치하기 (webpage)  (0) 2018.12.19

+ Recent posts