Thursday, September 22, 2022

Configuring MongoDB on Kubuntu 22.10

sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.16_amd64.deb

sudo dpkg -i mongodb-org-server_6.0.1_amd64.deb

mongod --version

sudo cp -r /var/lib/mongodb /var/lib/mongodb.bak

sudo chown -R mongodb:mongodb /var/lib/mongodb

sudo chown mongodb:mongodb /tmp/mongodb-27017.sock

ls -la

sudo ufw allow 27017


sudo systemctl start mongod

sudo systemctl status mongod

[sudo] password for user: 

● mongod.service - MongoDB Database Server

     Loaded: loaded (/lib/systemd/system/mongod.service; disabled; preset: enabled)

     Active: active (running) since Thu 2022-09-22 18:42:48 EEST; 17min ago

       Docs: https://docs.mongodb.org/manual

   Main PID: 85323 (mongod)

     Memory: 68.2M

        CPU: 6.371s

     CGroup: /system.slice/mongod.service

             └─85323 /usr/bin/mongod --config /etc/mongod.conf


sudo systemctl enable mongod

sudo service mongod status

● mongod.service - MongoDB Database Server

     Loaded: loaded (/lib/systemd/system/mongod.service; enabled; preset: enabled)

     Active: active (running) since Thu 2022-09-22 18:42:48 EEST; 19min ago

       Docs: https://docs.mongodb.org/manual

   Main PID: 85323 (mongod)

     Memory: 68.2M

        CPU: 7.027s

     CGroup: /system.slice/mongod.service

             └─85323 /usr/bin/mongod --config /etc/mongod.conf

sep 22 18:42:48 PC systemd[1]: Started MongoDB Database Server.


cat /var/log/mongodb/mongod.log

sudo systemctl stop mongod

sudo nano /etc/mongod.conf

# mongod.conf

# for documentation of all options, see:
#   http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.
storage:
 dbPath: /var/lib/mongodb
 journal:
   enabled: true
#  engine:
#  wiredTiger:

# where to write logging data.
systemLog:
 destination: file
 logAppend: true
 path: /var/log/mongodb/mongod.log

# network interfaces
net:
 port: 27017
 bindIp: 127.0.0.1


# how the process runs
processManagement:
 timeZoneInfo: /usr/share/zoneinfo

#security:

#operationProfiling:

#replication:

#sharding:

## Enterprise-Only Options:

#auditLog:

#snmp:

Uncomment and add:

security:

  authorization: enabled

net:

  port: 27017

  bindIp: 127.0.0.1,YOUR IP ADDRESS



sudo systemctl restart mongod

sudo systemctl enable mongod

sudo systemctl enable mongod.service


https://stackoverflow.com/questions/37371081/what-does-the-bindip-configuration-option-in-mongodb-do

https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/

https://www.cloudbooklet.com/how-to-install-mongodb-on-ubuntu-22-04/

No comments:

Post a Comment