Comment pouvons-nous vous aider ?

Recherchez dans nos guides et tutoriels, ou parcourez les catégories ci-dessous.

How to Install MongoDB on Ubuntu VPS

1k vues 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

Cet article vous a-t-il été utile ?

Merci pour votre retour !

Besoin d'aide supplémentaire ?

Notre équipe d'assistance est disponible 24h/24 pour tout ce que vous ne trouvez pas ci-dessus.