How to Install MongoDB on Alpine?
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
Step 2: Install MongoDB and its tools
apk add mongodb mongodb-tools
Step 3: Enable and start the MongoDB server. To run automatically with system boot,
rc-update add mongodb default
Start the server,
rc-service mongodb start
Step 4: Verify that the server is running,
rc-service mongodb status
As you can see the server is running successfully.
Step 5: Access the MongoDB shell,
As you can see we’re able to access the shell which means that we’ve successfully installed MongoDB.
Contact Us