How to install mongodb in linux?

Member

by lily , in category: PHP Databases , 3 years ago

How to install mongodb in linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by lizzie , 2 years ago

@lily 

To install MongoDB on a Linux system, you can use the following steps:

  1. Import the public key used by the package management system:
1
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 9DA31620334BD75D9DCB49F368818C72E52529D4


  1. Create a list file for MongoDB:
1
echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list


  1. Reload the package database:
1
sudo apt-get update


  1. Install the MongoDB packages:
1
sudo apt-get install -y mongodb-org


This will install the latest stable version of MongoDB.

  1. Once the installation is complete, start the MongoDB service with the following command:
1
sudo service mongod start


  1. You can check the status of the MongoDB service with the following command:
1
sudo service mongod status


  1. To ensure that MongoDB starts automatically when the system restarts, use the following command:
1
sudo systemctl enable mongod


That's it! You have now installed MongoDB on your Linux system.

Member

by samara , 2 years ago

@lily 

To install MongoDB on a Linux system, you can follow the steps below:

  1. Update the package list: sudo apt update
  2. Import the MongoDB public GPG key: wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -
  3. Create a list file for MongoDB: echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -cs)/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
  4. Update the package list again: sudo apt update
  5. Install MongoDB: sudo apt install mongodb-org
  6. Start the MongoDB service: sudo systemctl start mongod
  7. Enable MongoDB to start on boot: sudo systemctl enable mongod
  8. Verify that MongoDB has started successfully: sudo systemctl status mongod


After following these steps, MongoDB should be installed and running on your Linux system.

Related Threads:

How to install PHP curl in linux ubuntu?
How to start mongodb in linux?
How to restart mongodb in linux?
How to install mongodb and connect to db with php?
How to install ckeditor on symfony 5?
How to install tailwind in vue.js 3 + vite?