While trying to install mongod
on my Cloud9 AWS, I ran into some troubles. For my own future reference and posterity, I'm making this post.
https://docs.mongodb.com/manual/reference/program/mongod/
mongod
is the primary daemon process for the MongoDB system. It handles data requests, manages data access, and performs background management operations.
Setup
Create an AWS account & go through all the verification steps.
Under services on the AWS dashboard do a search for "Cloud9".
Spin up a new free tier Cloud9 server - be sure to select the ubuntu/linux option instead of amazon's linux (see image below).
In the terminal run node -v
(Note: at the time of writing this the version is v10.17.0
)
Run: npm init
(you can add the -y flag to auto finish and edit the package.json file later if you like).
Do The Needful
Run: sudo apt install mongodb-clients
- this will install mongo. You will be prompted to type Y⏎
to continue.
Run: sudo apt install mongodb-server-core
Run: cd
to go to the root folder above the workspace. If you type pwd
you should see /home/ubuntu
Now for the next bits you will need to be logged in as a super user but not just sudo.
Run: sudo su
- your prompt should change showing something like root@ip-172-31-30-86:/home/ubuntu#
While a super user you will need to run the following commands:
# mkdir -p /data/db #echo 'mongod --bind_ip=$IP --dbpath=data --nojournal --rest "$@"' > mongod
#chmod a+x mongod
# mongod
Your mongod
should start running now allowing you to access mongo
with a final line reading something like this:2019-12-14T06:11:39.395+0000 I NETWORK [initandlisten] waiting for connections on port 27017
. Note you will need to stay logged in as sudo u
on that terminal window to run mongod again.
Leave that terminal alone - don't touch it, it's just going to run in the background. Create a new terminal ⌥T
.
Now run mongo
then create a new terminal ⌥T
.
Drew is a seasoned DevOps Engineer with a rich background that spans multiple industries and technologies. With foundational training as a Nuclear Engineer in the US Navy, Drew brings a meticulous approach to operational efficiency and reliability. His expertise lies in cloud migration strategies, CI/CD automation, and Kubernetes orchestration. Known for a keen focus on facts and correctness, Drew is proficient in a range of programming languages including Bash and JavaScript. His diverse experiences, from serving in the military to working in the corporate world, have equipped him with a comprehensive worldview and a knack for creative problem-solving. Drew advocates for streamlined, fact-based approaches in both code and business, making him a reliable authority in the tech industry.