0

Hi firstly i have tested this command from the official site to install mongodb on the pi : http://docs.mongodb.org/manual/tutorial/install-mongodb-on-debian/

sudo apt-get install -y mongodb-org

E: Unable to locate package mongodb-org

i have tried another version

  sudo apt-get install -y mongodb-org=3.0.5 mongodb-org-server=3.0.5
  mongodb-org-shell=3.0.5 mongodb-org-mongos=3.0.5 mongodb-org-tools=3.0.5
  E: Unable to locate package mongodb-org 
  E: Unable to locate package mongodb-org-server E: Unable to locate
  package mongodb-org-shell 
  E: Unable to locate package mongodb-org-mongos
  E: Unable to locate package mongodb-org-tools

after that , i found the folowing repository to install mongodb on the pi

mongopi

however when i run

scons

i get these errors

scons: Reading SConscript files ...
scons version: 2.3.6
python version: 2 7 3 'final' 0
Checking whether the C++ compiler works... (cached) yes
Checking for C header file unistd.h... (cached) yes
Checking whether clock_gettime is declared... (cached) yes
Checking for C library rt... (cached) yes
Checking for C++ header file execinfo.h... (cached) yes
Checking whether backtrace is declared... (cached) yes
Checking whether backtrace_symbols is declared... (cached) yes
Checking for C library pcap... (cached) no
Checking for C library wpcap... (cached) no
scons: done reading SConscript files.
scons: Building targets ...
g++ -o build/linux2/normal/mongo/util/version.o -c -Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -pipe -fno-builtin-memcmp -O3 -DBOOST_ALL_NO_LIB -D_SCONS -DMONGO_EXPOSE_MACROS -DSUPPORT_UTF8 -D_FILE_OFFSET_BITS=64 -DJS_C_STRINGS_ARE_UTF8 -DMONGO_HAVE_HEADER_UNISTD_H -DMONGO_HAVE_EXECINFO_BACKTRACE -DXP_UNIX -Ibuild/linux2/normal/third_party/boost -Isrc/third_party/boost -Ibuild/linux2/normal/third_party/pcre-8.30 -Isrc/third_party/pcre-8.30 -Ibuild/linux2/normal -Isrc -Ibuild/linux2/normal/mongo -Isrc/mongo -Ibuild/linux2/normal/third_party/snappy -Isrc/third_party/snappy -Ibuild/linux2/normal/third_party/js-1.7 -Isrc/third_party/js-1.7 src/mongo/util/version.cpp
In file included from src/mongo/util/version.cpp:29:0:
src/mongo/util/file.h:33:13: error: 'uint64_t' does not name a type
src/mongo/util/file.h:43:20: error: 'fileofs' has not been declared
src/mongo/util/file.h:44:19: error: 'fileofs' has not been declared
src/mongo/util/file.h:47:9: error: 'fileofs' does not name a type
src/mongo/util/file.h:51:23: error: 'fileofs' has not been declared
src/mongo/util/file.h:188:20: error: 'fileofs' has not been declared
src/mongo/util/file.h:191:19: error: 'fileofs' has not been declared
src/mongo/util/file.h:203:9: error: 'fileofs' does not name a type
src/mongo/util/file.h:217:23: error: 'fileofs' has not been declared
src/mongo/util/file.h: In member function 'void mongo::File::truncate(int)':
src/mongo/util/file.h:218:21: error: 'len' was not declared in this scope
src/third_party/boost/boost/system/error_code.hpp: At global scope:
src/third_party/boost/boost/system/error_code.hpp:214:36: error: 'boost::system::posix_category' defined but not used [-Werror=unused-variable]
src/third_party/boost/boost/system/error_code.hpp:215:36: error: 'boost::system::errno_ecat' defined but not used [-Werror=unused-variable]
src/third_party/boost/boost/system/error_code.hpp:216:36: error: 'boost::system::native_ecat' defined but not used [-Werror=unused-variable]
cc1plus: all warnings being treated as errors
scons: *** [build/linux2/normal/mongo/util/version.o] Error 1
scons: building terminated because of errors.

is there any others method can i try ?

any suggestions well be appreciated , thanks

  • Is there no version available from the official repository? You are pretty much by yourself when you download from random repositories. – joan Aug 16 '15 at 9:42
  • @joan i have updated the post , please take a look :) – The Beast Aug 16 '15 at 11:27
  • Solved here, with the installation of NodeJS, and MongoDb on a Raspberry Pi v2, read the README if you are installing on an older version raspberry pi:<p> github.com/audstanley/Node-MongoDb-Pi – Audstanley Jan 2 '16 at 20:14
3

I made a shell script that will install the latest node, npm, and mongoDb. This process takes six hours to compile. The node, npm, and mongoDb shell script can be found here: https://github.com/audstanley/Node-MongoDb-Pi/blob/master/Install-Node-MongoDb-Pi.sh
But, if you just want to compile & install MongoDb:
You can copy past this block of code in, and six hours later, you'll have mongoDb installed: (and type in your password for the sudo commands)

cd ~/
#First, Installation of git.
sudo apt-get -y install git;
#Installation of MongoDB by downloading binaries, and compiling.
git clone git://github.com/RickP/mongopi.git;
#Download the dependencies to install mongoDB on R-Pi2
sudo apt-get install -y scons build-essential libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-thread-dev libboost-all-dev;
cd mongopi;
#SCons will build the binaries appropriate to the Pi.
scons;
#Here is the install of MongoDB wih SCons.
sudo scons --prefix=/opt/mongo install;
#SCons -c cleans up unwanted files.
scons -c;
#Creation of a path variable into the envoirnment
sudo su;
echo "PATH=$PATH:/opt/mongo/bin/" >> /etc/enviornment;
echo "export PATH" >> /etc/enviornment;
su pi;
#simlink mongo for shell access:
sudo ln -s /opt/mongo/bin/mongo /usr/bin/mongo;
sudo ln -s /opt/mongo/bin/mongoinfo /usr/bin/mongoinfo;
#add a new mongodb user
sudo useradd mongodb;
sudo mkdir /var/lib/mongodb;
sudo chown mongodb:mongodb /var/lib/mongodb;
sudo mkdir /etc/mongodb/;
sudo sh -c 'echo "dbpath=/var/lib/mongodb" > /etc/mongodb/mongodb.conf';
cd /etc/init.d;
#grab the mongodb.sh from a github gist
sudo wget -O mongodb https://gist.github.com/ni-c/fd4df404bda6e87fb718/raw/36d45897cd943fbd6d071c096eb4b71b37d0fcbb/mongodb.sh;
#make the shell script exicutable.
sudo chmod +x mongodb;
#Update rc.d for the mongodb.sh to run on startup
sudo update-rc.d mongodb defaults;
#finally, start mongoDB after all the installations are finished.
sudo service mongodb start;
#This whole process should take six hours on the raspberry pi 2.  Go get a coffee, or do this before going to bed.
1

The official repositories will be Raspbian if you are using Raspbian.

It's in the latest Raspbian, but not in the stable Raspbian. So you could consider upgrading to jessie.

Note, the -s option is used to show what would be done.

harry ~ $ sudo apt-get -s install mongodb
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libboost-dev libboost1.55-dev libpcap0.8 libsnappy1 libv8-3.14.5
  mongodb-clients mongodb-dev mongodb-server
Suggested packages:
  libboost-doc libboost1.55-doc libboost-atomic1.55-dev
  libboost-chrono1.55-dev libboost-context1.55-dev
  libboost-coroutine1.55-dev libboost-date-time1.55-dev
  libboost-exception1.55-dev libboost-filesystem1.55-dev
  libboost-graph1.55-dev libboost-graph-parallel1.55-dev
  libboost-iostreams1.55-dev libboost-locale1.55-dev
  libboost-log1.55-dev libboost-math1.55-dev libboost-mpi1.55-dev
  libboost-mpi-python1.55-dev libboost-program-options1.55-dev
  libboost-python1.55-dev libboost-random1.55-dev
  libboost-regex1.55-dev libboost-serialization1.55-dev
  libboost-signals1.55-dev libboost-system1.55-dev
  libboost-test1.55-dev libboost-thread1.55-dev libboost-timer1.55-dev
  libboost-wave1.55-dev libboost1.55-tools-dev libmpfrc++-dev
  libntl-dev
The following NEW packages will be installed:
  libboost-dev libboost1.55-dev libpcap0.8 libsnappy1 libv8-3.14.5
  mongodb mongodb-clients mongodb-dev mongodb-server
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Inst libsnappy1 (1.1.2-4 Raspbian:testing [armhf])
Inst libboost1.55-dev (1.55.0+dfsg-3 Raspbian:testing [armhf])
Inst libboost-dev (1.55.0.2 Raspbian:testing [armhf])
Inst libpcap0.8 (1.7.3-1 Raspbian:testing [armhf])
Inst libv8-3.14.5 (3.14.5.8-8.1+rpi1 Raspbian:testing [armhf])
Inst mongodb-dev (1:2.4.14-1 Raspbian:testing [armhf])
Inst mongodb-clients (1:2.4.14-1 Raspbian:testing [armhf])
Inst mongodb-server (1:2.4.14-1 Raspbian:testing [armhf])
Inst mongodb (1:2.4.14-1 Raspbian:testing [armhf])
Conf libsnappy1 (1.1.2-4 Raspbian:testing [armhf])
Conf libboost1.55-dev (1.55.0+dfsg-3 Raspbian:testing [armhf])
Conf libboost-dev (1.55.0.2 Raspbian:testing [armhf])
Conf libpcap0.8 (1.7.3-1 Raspbian:testing [armhf])
Conf libv8-3.14.5 (3.14.5.8-8.1+rpi1 Raspbian:testing [armhf])
Conf mongodb-dev (1:2.4.14-1 Raspbian:testing [armhf])
Conf mongodb-clients (1:2.4.14-1 Raspbian:testing [armhf])
Conf mongodb-server (1:2.4.14-1 Raspbian:testing [armhf])
Conf mongodb (1:2.4.14-1 Raspbian:testing [armhf])
  • i have try to run the commands by changing wheezy to jessie and re-run the commands but still getting the same errors , running sudo apt-get -s install mongodb show me E: Unable to locate package mongodb too .... link here link – The Beast Aug 16 '15 at 12:11
  • You need to upgrade your sytem to jessie. For instance look at raspberrypi.stackexchange.com/questions/27858/… – joan Aug 16 '15 at 12:26
  • is there a risk in doing such thing , can i upgrade back from jessie to wheezy if i run into troubles ... or a way to undo all the procedures ? – The Beast Aug 16 '15 at 12:43
  • @Frankenstein Yes, there is a risk. You might end up with an unusable SD card. It's best to do a full back up first or use a fresh SD card. I can't quantify the risk as it depends on the state of your packages against the current state of jessie. I upgraded quite some time ago. It really boils down to how important is a working mongoDB to you. – joan Aug 16 '15 at 12:47
  • Well i want to use a NOSQL database to save JSON document format , i found that mongodb is the best solution or maybe i can look for another ... however i can't risk anymore i have the raspicam library and opencv installed .... – The Beast Aug 16 '15 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.