16 lines
465 B
Bash
16 lines
465 B
Bash
|
#!/bin/bash
|
||
|
|
||
|
wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
|
||
|
echo "deb http://repo.mongodb.org/apt/debian bookworm/mongodb-org/6.0 main" > /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||
|
apt update
|
||
|
apt install -y mongodb-org
|
||
|
|
||
|
DBPATH=/srv/mongodb
|
||
|
mkdir -p ${DBPATH}
|
||
|
chown mongodb:mongodb ${DBPATH}
|
||
|
chmod 700 ${DBPATH}
|
||
|
sed -i "/dbPath/c\ dbPath: ${DBPATH}" /etc/mongod.conf
|
||
|
|
||
|
systemctl enable mongod.service
|
||
|
systemctl restart mongod.service
|