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 [email protected]:/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 "[email protected]"' > 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
.