¿Cómo podemos ayudarle?

Busque en nuestras guías y tutoriales o explore las categorías de abajo.

How to Install MongoDB on Ubuntu VPS

985 visitas Markdown

1.Install Required Tools (gnupg & curl)

sudo apt-get update
sudo apt-get install -y gnupg curl

These are needed to import MongoDB’s GPG key.

2. Import the MongoDB GPG Key

curl -fsSL https://pgp.mongodb.com/server-8.0.asc \
| sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg --dearmor

3. Add the MongoDB APT Repository

Create the repo file:

echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] \
https://repo.mongodb.org/apt/ubuntu $(lsb_release -sc)/mongodb-org/8.0 multiverse" \
| sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

This tells Ubuntu where to fetch official MongoDB packages.

4. Update Package Index

sudo apt-get update

5. Install MongoDB

sudo apt-get install -y mongodb-org

6. Start & Enable MongoDB Service

Start MongoDB:

sudo systemctl start mongod

Enable on boot:

sudo systemctl enable mongod

Check status:

sudo systemctl status mongod

7. Verify MongoDB is Running

mongosh

¿Le ha resultado útil?

¡Gracias por sus comentarios!

¿Todavía necesita ayuda?

Nuestro equipo de soporte está disponible las 24 horas para ayudarle con lo que no encuentre aquí.