dev/linux

[CentOS] Install mongodb 4.4 on CentOS7

재삐신생 2021. 2. 3. 14:21
반응형

1.  repo파일 추가

sudo vi /etc/yum.repos.d/mongodb-org-4.4.repo

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

 

2. 설치

sudo yum install -y mongodb-org

 

3. 초기설정

기본 디렉토리 생성

mkdir -p /var/lib/mongo

mkdir -p /var/log/mongodb

sudo chown -R mongod:mongod /var/lib/mongo

sudo chown -R mongod:mongod /var/log/mongodb

 

vi /etc/mongod.conf

bindIp 변경

 

THP 옵션 비활성화 (in RHEL7)

echo never > /sys/kernel/mm/transparent_hugepage/defrag

echo never > /sys/kernel/mm/transparent_hugepage/enabled

 

systemctl enable mongod

systemctl start mongod

 

방화벽

sudo firewall-cmd --zone=public --add-port=27017/tcp

 

 

 

ref: docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

반응형