Issues installing MongoDB in Cloud9 environment

Hey,

I recently wanted to start the MongoDB tutorial, but I get stuck at the very beginning - I fail to install MongoDB. If I type

sudo apt-get install -y mongodb-org

I get the response

sudo: apt-get: command not found

So apparently apt-get isn’t a proper command for my C9 environment. I googled a bit and I reached this thread on StackOverflow: https://stackoverflow.com/questions/32592956/apt-get-command-not-found. Apparently the Amazon Linux seems to be CentOS based and thus doesn’t operate with the apt-get command but instead with the yum command. So I tried

sudo yum install -y mongodb-org

which gives me

Loaded plugins: priorities, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00:00
amzn-updates | 2.5 kB 00:00:00
1034 packages excluded due to repository priority protections
No package mongodb-org available.
Error: Nothing to do

So apparently there is no mongodb-org package. I tried yum search mongodb and got these results

Loaded plugins: priorities, update-motd, upgrade-helper
1034 packages excluded due to repository priority protections
===================================================================== N/S matched: mongodb ======================================================================
libmongodb.i686 : MongoDB shared libraries
libmongodb.x86_64 : MongoDB shared libraries
libmongodb-devel.i686 : MongoDB header files
libmongodb-devel.x86_64 : MongoDB header files
mongodb-server.x86_64 : MongoDB server, sharding server and support scripts
nodejs-mongodb.noarch : A node driver for MongoDB
golang-github-go-mgo-mgo-devel.i686 : The MongoDB driver for Go
golang-github-go-mgo-mgo-devel.x86_64 : The MongoDB driver for Go
mongodb.x86_64 : High-performance, schema-free document-oriented database
php-pecl-mongo.x86_64 : PHP MongoDB database driver
pymongo.x86_64 : Python driver for MongoDB
pymongo-gridfs.x86_64 : Python GridFS driver for MongoDB
python-mongoengine.noarch : A Python Document-Object Mapper for working with MongoDB
python-pymongo.x86_64 : Python driver for MongoDB
python-pymongo-gridfs.x86_64 : Python GridFS driver for MongoDB

Name and summary matches only, use “search all” for everything.

So I installed the mongodb package with sudo yum install -y mongodb. This worked and I can check the version with mongo --version, but mongod is still an unrecognized command and I can’t pass the first tutorial of learnyoumongo.

Now I’m pretty lost on what to do more. I hope some of you can bring me some clarity. I also saw this 2-year old post on the C9 community forum, but they suggest to use apt-get.

What am I doing wrong?

Thanks in advance already :slight_smile:

I thought you should use npm install and you don’t need sudo (from what I remember) on Cloud9.

Note I was using the node environment.

Hi,


I tried awhile back too and gave up, I think I ended up changing servers to get it working, but the challenge user stories were missing key words…

K

2 Likes

You could try creating a mlab database and just linking to it.

2 Likes

Thanks so much, this worked after I deinstalled the other MongoDB version I installed previously. Now going through the tutorials… :slight_smile:

I am new here but the original problem was the same for me
I followed the discussion but still could not install mongodb
The instructions I found were great but yum would not work so I changed it to
I got in the right direction and finally got this to work on cloud9

I spent a long time to understand that I was missing mongodb installation and how to do it

start a bash in your workspace

vim mongodb-org-3.6.repo

# append in vim command and paste this section

[mongodb-org-3.6]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/amazon/2013.03/mongodb-org/3.6/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-3.6.asc

# ESC vim command
:wq

sudo mv mongodb-org-3.6.repo /etc/yum.repos.d
sudo apt-get install -y mongodb-org

Thanks to all for giving me the path to the solution

P.S. This is my first post here :smile:

I had the same problem. I couldn’t install MongoDB packages mongodb-org-shell-4.0.2 and mongodb-org-tools-4.0.2 in a AWS EC2 Instance.
My soluction hat two different solutions:

  1. I lunched a new AWS Amazon Linux 2 Instance and everything hat run OK. I have able to follow the MongoDB Website (https://docs.mongodb.com/manual/tutorial/install-mongodb-on-amazon/)Instructuion to install mongodb-org-shell-4.0.2 and mongodb-org-tools-4.0.2 without problems.
    2.- In my old AWS Amazon Linux i only could install MongoDB 3.6 like clickinggmouse hast writen in https://github.com/nax3t/aws-cloud9-instructions. After i have runned the comands:
    sudo yum install -y mongodb-org-shell.x86_64
    sudo yum install -y mongodb-org-tools.x86_64