sudo apt-get install gnupg
wget -qO - https://pgp.mongodb.com/server-6.0.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/mongodb-6.0.gpg
echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.com/apt/ubuntu jammy/mongodb-enterprise/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-enterprise.list
sudo apt-get update
sudo apt-get install -y mongodb-enterprise
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
snap version
sudo systemctl enable mongod
sudo systemctl start mongod
if everthing works it will look like this
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2023-02-08 01:37:15 CST; 35s ago
Docs: https://docs.mongodb.org/manual
Main PID: 98 (mongod)
Memory: 79.1M
CGroup: /system.slice/mongod.service
└─98 /usr/bin/mongod --config /etc/mongod.conf
Feb 08 01:37:15 TestUSER systemd[1]: Started MongoDB Database Server.
every restart u need to execute this
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
sudo systemctl start mongod