Skip to main content

Command Palette

Search for a command to run...

Installing MongoDB on a VPS for beginners

Updated
2 min read
Installing MongoDB on a VPS for beginners
C

Eduardo Burko, aka Phantodev, i'm a skilled front-end developer with a focus on creating robust applications using the React framework. With extensive experience in implementing complex features, i create clean and organized code, ensuring his applications are scalable and easy to maintain. I'm a quick learner and proficient in other front-end technologies like HTML, CSS, and JavaScript, and back-end technologies like Node.js and Express. I have experience working with clients in various industries, developing custom solutions for them. I'm strength in communication and working in agile environments makes me flexible and adaptable to changing project requirements.

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!

Eduardo Burko - Fullstack Developer

Get in touch phantodev.com.br

29 views

More from this blog

Show me the code, Phantodev!

12 posts

I'm working with Front-End since to 2005 encompassing software development, architecture and UI Design. Get in Touch and let's work together? I'm open to work in new projects :-)