在bluehost上安装mongodb

This article is a little more up to date with the changes made by Hostmonster / Bluehost, and to make the instructions a little more clear, and simplified.

1. Download the MongoDB binaries – You want to download the legacy-static production release. Hosmonster / Bluehost run Linux 64-bit

Download

I found it easier to extract the files on my desktop then upload them to a directory called mongodb in the root home folder.

Your MongoDB folder should look like the below when all done:
/home/{username}/mongodb
/home/{username}/mongodb/bin
/home/{username}/mongodb/data
/home/{username}/mongodb/include
/home/{username}/mongodb/lib64

Replace {username} with your login name for Hostmonster / Bluehost. You can find your username in the cPanel on the left where it says username.

2. In your SSH/Shell console – Now we need to make the MongoDB command usable so do the following commands

nano .bashrc

3. Now add the following line to the bottom of the file.

export PATH=/home/{username}/mongodb/bin:$PATH

Replace {username} with your login name for Hostmonster / Bluehost. You can find your username in the cPanel on the left where it says username.

4. Save

ctrl+x confirm save by typing ‘Y’ then enter, then enter again to confirm the file.

5. Lets verify that everything is working. You will need to reload bash

source .bashrc

6. Make the MongoDB binaries executable

chmod 744 -R mongodb/bin

7. Verify MongoDB is running

mongod —version

8. Start the MongoDB

screen mongod —dbpath /home/{username}/mongodb/data —quiet

Now safe to exit your Shell Console

Replace {username} with your login name for Hostmonster / Bluehost. You can find your username in the cPanel on the left where it says username.

They only let you run a program for 5 minutes before killing it, so it’s fairly useless to install MongoDB unless you have a dedicated IP.

posted @ 2012-03-16 18:39  文刀无尽  阅读(331)  评论(0编辑  收藏  举报