| by Arround The Web | No comments

How to install MongoDB on Raspberry Pi

MongoDB, commonly referred to as Mongo, is an open-source, cross-platform document-oriented database management system that uses flexible documents instead of tables and rows to store and process any form of data. It’s a non-relational database management system that doesn’t require an SQL database, enabling the users to store multi-variables data through an elastic data storage model.

In this article, we will let you install MongoDB on a Raspberry Pi device so that you can use this database to store a large amount of data.

Installing MongoDB on Raspberry Pi

The MongoDB installation on Raspberry Pi is easy which you can complete within couple of minutes by following the below mentioned steps:

Step 1: Update Raspberry Pi Packages

To begin installing MongoDB on your Raspberry Pi device, ensure that the packages on your system are up to date and you can use the following command to update them.

$ sudo apt update && sudo apt upgrade -y

Step 2: Add GPG Key for MongoDB

Now, add GPG key through the following command as this is required for adding MongoDB repository into the Raspberry Pi list.

$ wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -

The output “OK” confirms that the GPG key is successfully added.

Step 3: Add MongoDB Repository

After adding the GPG key, you can now apply the below-mentioned command to add the MongoDB repository to the Raspberry Pi repository list.

$ echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list

The above command adds the MongoDB repository into the Raspberry Pi source list.

Step 4: Update Source List

After adding the repository, you will need to update Raspberry repository list through the following command:

$ sudo apt update

Step 5: Install MongoDB on Raspberry Pi

Once the Raspberry Pi source list is updated, you can use the below-given command to install MongoDB on your device:

$ sudo apt install mongodb-org -y

Once the MongoDB installation is completed, you can use the following command to ensure that the latest version is installed on your device.

$ mongo --version

Step 6: Start MongoDB service on Raspberry Pi

After completing the installation, you will need to install MongoDB service on your Raspberry Pi device using the following command:

$ sudo systemctl start mongod

Step 7: Check Status of MongoDB service on Raspberry Pi

To ensure that MongoDB service is up and running on your Raspberry Pi device, you can execute the following command:

$ sudo systemctl status mongod

The “active (running)” status ensures that MongoDB service is running completely fine on your Raspberry Pi device.

Step 8: Run MongoDB on Raspberry Pi

With the service running on your device, you can use the following command to run MongoDB on your Raspberry Pi device:

$ mongo

Now, from here on, you can create several databases with ease using the MongoDB database management system.

Conclusion

MongoDB is a robust database management system better than MySQL in terms of performance and speed due to its less restrictive format. From the above guidelines, you can easily install MongoDB on your Raspberry Pi device by adding the GPG key and repository to the Raspberry Pi source list. Afterwards, use the installation command to install the latest version of MongoDB on Raspberry Pi and begin creating several databases with ease.

Share Button

Source: linuxhint.com

Leave a Reply