I tried doing it via following the tutorial for Ubuntu (on Mongodb’s website). It was a fail.
You can determine the version of Ubuntu that’s running using
lsb_release -a As of this article, it’s 14.04.
What works without a hitch is their tutorial for installing it via tarball, but, if you don’t know your way around the shell, I’ll give you some quick help here.
Blow by blow, this is all you need to do:
First, from your c9 terminal, that likely reads:
tar -zxvf mongodb-linux-x86_64-3.4.2.tgz
In Mongodb’s tutorial, they have you do a copy to an mongodb directory, but this isn’t necessary.
If you don’t already know. From your home directory,
enter the following
Note that you can use whatever editor you want. nano is available also.
At the very top, there should be three lines, each preceded by a ‘#’ character. Create a blank line under the third ‘#’ and enter the following:
Follow this with:
I found that the vim command, ZZ
, didn’t work in my terminal. To finish off, cover your bases with
sudo source .bashrc
Now, if you try and run mongod, it will run only in your current terminal. You can’t background it by using ‘&’, as in,
mongod &. It doesn’t work in c9. Instead, let’s move up the food chain a bit. We’ll detach the running mongo daemon with a background. Enter this
mongod & disown
The command will return you to your terminal. Now enter
And you’ll be ready to rock with a basic set-up.