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

The Beast
  • 383
  • 1
  • 7
  • 20

2 Answers2

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.
Audstanley
  • 99
  • 1
  • 5
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])
joan
  • 71,852
  • 5
  • 76
  • 108