# Server ## Useful Links - [MongoDB Shell](https://www.mongodb.com/docs/mongodb-shell/) - `mongosh` -> `db.getMongo()` to return the local ip ## How to get MongoDB up and running linux ### Installation 1. Import the public key ```bash sudo apt-get install gnupg curl ``` ```bash curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ --dearmor ``` 2. Create the list file ```bash 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 ``` 3. Reload ```bash sudo apt-get update ``` 4. Install MongoDB Community Server ```bash 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. 1. Start MongoDB ```bash sudo systemctl start mongod ``` 2. Verify Success ```bash sudo systemctl status mongod ``` 2. a. If you want mongo to start after reboot: `sudo systemctl enable mongod` [Reference](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/) ### If Mongo is failing to start with exit code 14 [StackExchange](https://askubuntu.com/questions/823288/mongodb-loads-but-breaks-returning-status-14)