Boela kwa blog
Motsheganong 23, 2026Dikaelo

Jang go Kenya MongoDB mo Linux VPS

MongoDB Community mo Ubuntu le CentOS, authentication le ditaelo tsa motheo.

Jang go Kenya MongoDB mo Linux VPS

MongoDB ke database ya NoSQL e e tumileng bakeng sa di-app le API. Kenya mo Hiddence VPS le tshireletso ya motheo.

Kenya mo Ubuntu 22.04+

bash
curl -fsSL https://www.mongodb.org/static/pgp/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongod
mongosh --eval "db.runCommand({ ping: 1 })"

Kenya mo RHEL / CentOS / Alma / Rocky

bash
cat <<EOF | sudo tee /etc/yum.repos.d/mongodb-org-7.0.repo
[mongodb-org-7.0]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/\$releasever/mongodb-org/7.0/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-7.0.asc
EOF
sudo yum install -y mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongod

Nolofatsa authentication

Tlhama admin pele ga network access:

bash
mongosh

use admin
db.createUser({
  user: "admin",
  pwd: "StrongPasswordHere",
  roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "readWriteAnyDatabase" ]
})

# Edit /etc/mongod.conf — set:
# security:
#   authorization: enabled

sudo systemctl restart mongod

Ditaelo tsa motheo

bash
mongosh -u admin -p --authenticationDatabase admin

show dbs
use myapp
db.users.insertOne({ name: "test", email: "a@b.com" })
db.users.find()

Ditiro tsa botlhale

  • Kopanya MongoDB le 127.0.0.1 ntle le fa go tlhokega remote access
  • Thibela port 27017 mo firewall
  • Di-backup tsa nako le nako ka mongodump
  • Lokela lefelo la disk
  • Production — replica set bakeng sa availability e e kwa godimo