If you want to use Mongodb Atlas Cloud Database, you can skip this process. You can choose either locally installed Mongodb Database or Cloude Database which is free.
Use this tutorial to install MongoDB 6.0 Community Edition on LTS (long-term support) releases of Ubuntu Linux using the apt
package manager.
Type the command below on the terminal.
Copy sudo apt-get install gnupg curl
On your terminal, please copy and paste below code.
Copy curl -fsSL https://pgp.mongodb.com/server-6.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg \
--dearmor
Now copy and paste below code to the terminal. please use the code according to your operating system.
Ubuntu 22.04 Ubuntu 20.04 Ubuntu 18.04 Ubuntu 16.04
Copy echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Copy echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Copy echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Copy echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
Now update the repository.
Now Install the Mongodb.
Copy sudo apt-get install -y mongodb-org
Now start the mongodb service to your server.
Copy sudo systemctl start mongod
Type this command to start mongodb on every start on your server.
Copy sudo systemctl enable mongod
Check whether the mongodb service is running or not.
Copy sudo systemctl status mongod
This is show a success message like below.
Copy ● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled ; vendor pres e >
Active: active (running) since Mon 2023-08-07 09:38:45 UTC; 6s ago
Docs: https://docs.mongodb.org/manual
Main PID: 11249 (mongod)
Memory: 72.5M
CPU: 662ms
CGroup: /system.slice/mongod.service
└─11249 /usr/bin/mongod --config /etc/mongod.conf
That's it. Mongodb is now installed on your system.
Last updated 9 months ago