DEV Community

Roby Cigar
Roby Cigar

Posted on

3 2

Cara Install MongoDB di Ubuntu

Berikut ini langkah2 menginstall mongodb mengunakan sistem operasi linux dengan distro ubuntu versi 22.10

  1. Import public key
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
Enter fullscreen mode Exit fullscreen mode

Jalankan kode tersebut, maka akan memunculkan output bertuliskan OK

  1. Membuat file list
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
Enter fullscreen mode Exit fullscreen mode
  1. Reload package local
sudo apt-get update
Enter fullscreen mode Exit fullscreen mode
  1. Install package mongoDB
sudo apt-get install -y mongodb-org
Enter fullscreen mode Exit fullscreen mode
  1. Start server mongodb
sudo systemctl daemon-reload
sudo systemctl start mongod
sudo systemctl status mongod
Enter fullscreen mode Exit fullscreen mode

Troubleshooting

Jika anda mendapatkan error Process: 8724 ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf (code=exited, status=14)
masukkan perintah berikut.

chown -R mongodb:mongodb /var/lib/mongodb
chown mongodb:mongodb /tmp/mongodb-27017.sock

sudo service mongod restart
Enter fullscreen mode Exit fullscreen mode

Sumber:

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/
https://askubuntu.com/questions/823288/mongodb-loads-but-breaks-returning-status-14

Sentry image

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay