This tutorial aims to teach people who are at the beginning of their learning and want to know how to install MongoDB on a VPS. Hope you like it!
1st step: Connect in your DEBIAN VPS e type this command line below, will add GPD KEY to debian check if all the packages from mongoDB is secure.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4
2nd step: Download the REPO to your VPS:
wget https://repo.mongodb.org/apt/debian/dists/bookworm/mongodb-org/7.0/main/binary-amd64/mongodb-org-server_7.0.11_amd64.deb
3rd step: Install the package now:
sudo dpkg -i mongodb-org-server_7.0.11_amd64.deb
4th step: We need change the bindIp in mongo.conf from 127.0.0.1 to 0.0.0.0. Edit this line and save the file.
sudo nano /etc/mongod.conf
5th step: Now we need start our MongoDB:
sudo systemctl start mongod
6th step: Check your MongoDB status now:
sudo systemctl status mongod
7th step: Now you can Download MongoDB Compass from this URL:
https://www.mongodb.com/try/download/compass
8th step: After you install MongoDB Compass on your machine following all the standard steps, open it:
9th step: Now you're seeing a screen called New Connection and it has a field called URI. Just enter the IP of your VPS and press the connect button.
That's it my friends. These are the steps that seem simple, but there are small details that can vary and complicate your life.
Be careful with the version of Linux you are using on your machine.
See you next time and follow me for more tips!