2026-03-12 21:01:38
This commit is contained in:
87
tiddlywiki/MongoDB - install on CentOS8.txt
Executable file
87
tiddlywiki/MongoDB - install on CentOS8.txt
Executable file
@@ -0,0 +1,87 @@
|
||||
# Linux packages
|
||||
dnf -y wget install net-snmp-agent-libs
|
||||
|
||||
groupadd mongod
|
||||
useradd mongod -g mongod -G mongod
|
||||
mkdir -p /app/mongodb
|
||||
chown -R mongod:mongod /app/mongodb
|
||||
|
||||
# disable selinux
|
||||
# in /etc/selinux/config -->
|
||||
SELINUX=disabled
|
||||
# <-------------------------
|
||||
|
||||
# Disable Transparent Huge Pages (THP) following https://docs.mongodb.com/manual/tutorial/transparent-huge-pages/
|
||||
|
||||
su - mongod
|
||||
cd /app/mongodb
|
||||
mkdir product conf data log
|
||||
cd product
|
||||
wget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel80-4.2.3.tgz
|
||||
gunzip -c mongodb-linux-x86_64-rhel80-4.2.3.tgz | tar -xvf -
|
||||
rm -rf mongodb-linux-x86_64-rhel80-4.2.3.tgz
|
||||
ln -s mongodb-linux-x86_64-rhel80-4.2.3 current_version
|
||||
|
||||
# create configuration file
|
||||
# /app/mongodb/conf/mongod.conf -->
|
||||
storage:
|
||||
dbPath: "/app/mongodb/data"
|
||||
journal:
|
||||
enabled: true
|
||||
|
||||
net:
|
||||
port: 27017
|
||||
bindIp: 127.0.0.1,192.168.0.127
|
||||
# <-------------------------------
|
||||
|
||||
# Test MongoDB server startup (press Ctrl-C to stop)
|
||||
/app/mongodb/product/current_version/bin/mongod --config=/app/mongodb/conf/mongod.conf --logpath=/app/mongodb/log/mongod.log
|
||||
|
||||
# Add to systemd as service
|
||||
# create /etc/systemd/system/mongod.service -->
|
||||
[Unit]
|
||||
Description=MongoDB
|
||||
After=multi-user.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# (file size)
|
||||
LimitFSIZE=infinity
|
||||
# (cpu time)
|
||||
LimitCPU=infinity
|
||||
# (virtual memory size)
|
||||
LimitAS=infinity
|
||||
# (locked-in-memory size)
|
||||
LimitMEMLOCK=infinity
|
||||
# (open files)
|
||||
LimitNOFILE=64000
|
||||
# (processes/threads)
|
||||
LimitNPROC=64000
|
||||
|
||||
User=mongod
|
||||
Group=mongod
|
||||
|
||||
ExecStart=/app/mongodb/product/current_version/bin/mongod --config /app/mongodb/conf/mongod.conf --logpath=/app/mongodb/log/mongod.log
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
# <--------------------------------------------
|
||||
|
||||
systemctl daemon-reload
|
||||
systemctl status mongod
|
||||
systemctl start mongod
|
||||
systemctl status mongod
|
||||
systemctl stop mongod
|
||||
systemctl status mongod
|
||||
systemctl start mongod
|
||||
systemctl enable mongod
|
||||
|
||||
# check listening port
|
||||
lsof -i -P | grep -i "listen"
|
||||
|
||||
# Test mongo shell
|
||||
/app/mongodb/product/current_version/bin/mongo --host ajara
|
||||
|
||||
# In order to avoid the message [Browserslist: caniuse-lite is outdated. Please run: npx browserslist@latest --update-db] when running MongoShell:
|
||||
export BROWSERSLIST_IGNORE_OLD_DATA=1
|
||||
|
||||
Reference in New Issue
Block a user