Open In App

How to Install MongoDB on Alpine?

Last Updated : 05 Jul, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

MongoDB is an open-source NoSQL database. NoSQL databases are quite useful for working with large sets of distributed data. It is a good choice when your data is document-centric and doesn’t fit well into the schema of a relational database. It provides full indexing support and replication with rich APIs. Let’s learn how to install it on alpine Linux. To know more about the working and features of MongoDB, please check What is MongoDB.

Installing MongoDB on Alpine Linux

Follow the below steps in order to install MongoDB,

Note: You need root privileges to perform the below actions.

Step 1: Add repository, If you’re using alpine 3.9 then you don’t need to add the repository, you can skip this step.

echo ‘http://dl-cdn.alpinelinux.org/alpine/v3.6/main’ >> /etc/apk/repositories
echo ‘http://dl-cdn.alpinelinux.org/alpine/v3.6/community’ >> /etc/apk/repositories

Adding-repository

 

Step 2: Install MongoDB and its tools

apk add  mongodb mongodb-tools

Installing-MongoDB-and-tools

 

Step 3: Enable and start the MongoDB server. To run automatically with system boot,

rc-update add mongodb default

Enabling-MongoDB-server

 

Start the server,

rc-service mongodb start

Starting-server

 

Step 4: Verify that the server is running,

rc-service mongodb status

Verifying-server

 

As you can see the server is running successfully.

Step 5: Access the MongoDB shell,

Accessing-MongoDB-shell

 

As you can see we’re able to access the shell which means that we’ve successfully installed MongoDB.


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads