1.4 KiB
1.4 KiB
Server
Useful Links
- MongoDB Shell
mongosh->db.getMongo()to return the local ip
How to get MongoDB up and running linux
Installation
- Import the public key
sudo apt-get install gnupg curl
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor
- Create the list file
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
- Reload
sudo apt-get update
- Install MongoDB Community Server
sudo apt-get install -y mongodb-org
Start Process
My system uses systemd to manage processes. However, if you are not aware which your system uses run ps --no-headers -o comm 1 and that should tell you which to use.
- Start MongoDB
sudo systemctl start mongod
- Verify Success
sudo systemctl status mongod
- a. If you want mongo to start after reboot:
sudo systemctl enable mongod