How To Install MongoDB
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
In this blog post, we will discuss how to install MongoDB in different operating systems on Cloud platforms like AWS, GCP, or Azure. MongoDB installation process changes based on OS and not Cloud service providers. Hence the installation process given for one Cloud service provider for a particular OS will also work in other cloud service providers.
What Is MongoDB:
MongoDB is a cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas. MongoDB is developed by MongoDB Inc. and licensed under the Server Side Public License (SSPL).
How To Install MongoDB On AWS EC2 Instance With RHEL or CentOS or Oracle Linux Version 7 AMI:
Step 1: Create an EC2 instance with any RHEL based AMI.
Step 2: Connect to your EC2 instance and update the OS packages.
1 2 3 4 5 6 7 8 9 10 |
############################ ## How To Install mongoDB ## ############################ ##----------------------------------------- ## RHEL | CentOS | Oracle Linyx : Version 7 ##----------------------------------------- ## Update your OS packages sudo yum update -y |
Step 3: Install MongoDB On AWS EC2 Instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
## Create a mongoDB repository sudo vi /etc/yum.repos.d/mongodb-org-4.4.repo ----------------------------------- [mongodb-org-4.4] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/ gpgcheck=1 enabled=1 gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc ----------------------------------- ## Install latest version of mongoDB sudo yum install -y mongodb-org ## Start and enable mongoDB service sudo systemctl start mongod sudo systemctl enable mongod ## Start your mongo shell mongo |
How To Install MongoDB On Google Compute Engine VM Instance With Ubuntu 18 Image:
Step 1: Create a Google Compute Engine VM instance with Ubuntu 18 Image.
Step 2: Connect to your Compute Engine VM instance.
Step 3: Install MongoDB On Google Compute Engine VM Instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
##-------------------- ## Ubuntu : Version 18 ##-------------------- ## Create mongoDB repository echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list ## Import the repository signing key wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - ## Update your OS packages sudo apt-get update ## Install latest version of mongoDB sudo apt-get install -y mongodb-org ## Enable automatic start of mongoDB service during start up sudo systemctl enable mongod sudo systemctl start mongod ## Start your mongo shell mongo |
How To Install MongoDB On Azure VM Instance With Windows Server 2012 R2 Image.
Step 1: Create An Azure VM Instance With Windows Server 2012 R2 Image.
Step 2: Log in to your Azure VM Instance And Download MongoDB Version 10 using the below link.
https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-ssl-4.0.20-signed.msi
Step 3: Double click on the downloaded installer package and click “Run”.
Step 4: Follow the installation wizard and complete the installation.
Step 5: Open your mongo shell.
1 2 3 |
## Open a command prompt and execute below commands cd C:\Program Files\MongoDB\Server\4.0\bin mongo.exe |
How To Install MongoDB On Alibaba Cloud ECS Instance With Debian Image:
Step 1: Create an Alibaba Cloud EC2 instance with Debian 10 Image.
Step 2: Connect to your ECS instance.
Step 3: Install MongoDB On Alibaba Cloud ECS Instance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
##------------ ## Debian : 10 ##------------ ## Create mongoDB repository echo "deb http://repo.mongodb.org/apt/debian buster/mongodb-org/4.4 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list ## Import the repository signing key wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - ## Update your OS packages sudo apt-get update ## Install latest version of mongoDB sudo apt-get install -y mongodb-org ## Enable automatic start of mongoDB service during start up sudo systemctl enable mongod sudo systemctl start mongod ## Start your mongo shell mongo |
Hope you have enjoyed this blog post. Please refer to MongoDB documentation for more detail.
https://docs.mongodb.com/manual/installation/
Its even easier to setup the latest version of MongoDB Server now straight from the AWS marketplace, there is a MongoDB image available: https://aws.amazon.com/marketplace/pp/prodview-t2fk7vzqwuf2i