In this article, we will share with you how to install MongoDB in ubuntu. MongoDB is one of the open-source database and currently most used in modern web applications for high performance. MongoDB is JSON based database you can use MongoDB in most off programing language but it mostly uses with nodejs.
We are here show you all installation process step by step so, please follow this step and easily configure and install MongoDB in your local system.
Before installing MongoDB you should install these repositories for a new updated version, in ubuntu is already included. simply run following command in your Ubuntu terminal.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
After running this command you make sure you get the following output in the terminal.
Executing: /tmp/tmp.3JTuFvsumc/gpg.1.sh --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927 gpg: requesting key EA312927 from hkp server keyserver.ubuntu.com gpg: key EA312927: public key "Totally Legit Signing Key <[email protected]>" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1)
Now run following command.
sudo apt-get update
Now, run the following command to install MongoDB.
sudo apt-get install -y mongodb-org OR sudo apt-get install mongodb
This command will install the latest several packages for MongoDB.
After doing this process then go this directory root
/etc/systemd/system/ and run the following command.
sudo nano /etc/systemd/system/mongodb.service
When you run this command then
mongodb.service file open in ubuntu's nano editor and you show output looks like this.
[Unit] Description=High-performance, schema-free document-oriented database After=network.target [Service] User=mongodb ExecStart=/usr/bin/mongod --quiet --config /etc/mongod.conf [Install] WantedBy=multi-user.target
Next, start the newly created service with systemctl.
sudo systemctl start mongodb
After running this command then check
systemctl status this started properly or not using the following command.
sudo systemctl status mongodb
Then check your output look like this.
● mongodb.service - An object/document-oriented database Loaded: loaded (/lib/systemd/system/mongodb.service; enabled; vendor preset: enabled) Active: active (running) since Mon 2019-12-16 12:25:28 IST; 4min 4s ago Docs: man:mongod(1) Main PID: 13931 (mongod) CGroup: /system.slice/mongodb.service └─13931 /usr/bin/mongod --config /etc/mongodb.conf Dec 16 12:25:28 dell-Vostro-15-3568 systemd: Started An object/document-oriented database. Dec 16 12:29:21 dell-Vostro-15-3568 systemd: Started An object/document-oriented database.
Now check your MongoDB is installed successfully or not. so, simple check MongoDB version run by the following command.
After running this command you show something that look like the output in your terminal.
db version v2.6.10 2019-12-16T12:31:13.714+0530 git version: nogitversion 2019-12-16T12:31:13.714+0530 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
You can see Install the MongoDB in Ubuntu is very easy. You can check I hope you will like this article.
Laravel 8 - Create Contact in ZOHO Crm Tutorial ExampleIn this article, I will share with you h...
JWT - Authentication API in Laravel7This is a comprehensive Laravel 7 JWT Au...
How to reverse a string in PHPUse the PHP strrev() function...
How to Check IP Address is Private or Public in PHP?In this article, I will share with you H...