After giving the foundation for why I started this project in part one I will now show the steps and give the code for installing MongoDB v2.1.1 on the Raspberry Pi, but first listed are some perquisites.

  • SSH access to the Raspberry Pi, technically not needed but very helpful.
  • A text editor that can open and search through a directory of files. I used TextWrangler.
  • Some other computer to change and modify files prior to building MongoDB. I used a mac and I suggests using some other Unix like system.
  • And just as a note some of commands I included a the unix command prompt other commands are just listed the command without showing the command prompt.

1. Geting MongoDB. I used git hub for this. I would do this on the second Unix system.
git clone git://github.com/mongodb/mongo.git

2. Make sure version r2.1.1 is in the git hub repository.
cd mongo
git tag -l

3. Check out version r2.1.1.
git chekcout r2.1.1

4. Change TIME_UTC for newer gcc and boost capability:
Open the whole mongo folder in a text editor and do a find/replace in all files under the mongo folder for reference to TIME_UTC and replace it with TIME_UTC_ there will be just over 60 reference instances of this macro.

5. Update the inline assembly for atomic integers atomic_int.h I have included the whole file atomic_int.h so just copy this code and paste into original atomic_int.h file replacing the original code.
Before I list the code I would like to give thanks to soywiz for posting the majority of this code on this mongodb forum http://jira.mongodb.org/browse/SERVER-1811 The file is located:
[system@root~]# mongo/src/mongo/bson/util/atomic_int.h
The code is listed at the end of the steps.

6. Zip mongo directory and scp to Rasberry Pi.
[system@root~]# scp mongo.zip root@ipaddress:~/some_upload_dir

7. Compile and install mongodb: ADVISORY: it may take over 24 hours to compile and install. If you don't want to compile all option please visit the MongoDB website for further options.
scons all
scons --prefix=/opt/mongo install
Change the prefix options to install MongoDB in the location of your choice.

Comments

Commenting is closed for this article.