Install MongoDB in Amazon Linux VM

Share via:

Install MongoDB in Amazon Linux VM:

Step-1: Create a Linux virtual machine in AWS.
Step-2: After creating it connect it through the putty or mobaXterm.
Step-3: Run “sudo su“ to get all the root privileges.

Step-4: To know about the version and its details which is required for installing MongoDB. run “uname -srm”. From this choose the platform in step5.

Step-5: Go to the link “ then choose the platform that you need like Amazon Linux, RedHat and package as tgz or server.

Step-6: After choosing the platform and package copy the link which is beside download.

Step-7: Run “curl -O It will connect to the site and download the files from the given site.

It shows that the software we download has a size of 60.5 MB.
Step-8: Run “ll -lhtr” to get the file name and its size which used to install it.

Step-9: To install the files that you have downloaded Run the below command “tar -zxvf mongodb-linux-x86_64-amazon2023-7.0.0.tgz”. This installs the software.

Step-10: Change directory to the blue color text which is highlighted in 8th step to do this run “cd mongodb-linux-x86_64-amazon2023-7.0.0”.

Step-11: List all the files inside that directory by running “ll -lhtr” command.

Step-12: Change the directory to bin by running “cd bin/” and to list all the files run “ll -lhtr” command.

Step-13: Now create one directory by running “mkdir daata”. which is used to store all the database files in the directory which we create.
Step-14: Run “. /mongod -dbpath dataa/ –port 27017 –logpath ./mongod.log–fork”.to connect to MongoDB through the given port number and save the files in the given path.

The child process is running shows that our service is running in the background.
Step-15: Run “ ps -ef | grep mongo” to know if the service is running or not.

Step-16: Now run “mongo” or run “. /mongo –port 27017” to start and work in MongoDB.


Author    : Teja
LinkedIn :
Thank you for giving your valuable time to read the above information. Please click here to subscribe for further updates.
KTExperts is always active on social media platforms.
Facebook  :
LinkedIn    :
Twitter       :
YouTube   :
Instagram  :
Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)

Add Comment