Installing CouchDB 1.6.0 on the Raspberry Pi
Update 03.11.2015
The Erlang Solutions Repository now contains a new version of Erlang. The major version is now 18. This is too high for the couch in version 1.6.x.
For this reason, please omit the step of including the Erlang Solutions Repository.
Just rely on what you get from the default Raspbina/Debian repos.
I still have to verify this with Wheezy, but for the new Raspbian Jessie image this does the trick.
Also please note that the couch is now available in version 1.6.1.
The instructions below are valid for this version too, as described here.
Also please note that the couch is now available in version 1.6.1.
The instructions below are valid for this version too, as described here.
Building CouchDB 1.6.0 On Your Pi
CouchDB 1.6.0 has been released and of course we want to have it running on our Pis.
I guess my previous blog on installing version 1.5.1 is still valid but couchDB 1.6.0 is now able to run on Erlang 1.17 and that makes for a sight difference during installation.
I guess my previous blog on installing version 1.5.1 is still valid but couchDB 1.6.0 is now able to run on Erlang 1.17 and that makes for a sight difference during installation.
Preparing the Pi
Nothing new here...
- I used a brand new 16 GB card.
- Download the latest Raspbian Wheezy from www.raspberrypi.org/downloads
At the time of this writing, the image version was 2014-06-20 - Install the image on your Pi and do the regular raspi-config
- Extend the partition
- Set your locales
- ...
- Btw, I did not change the default memory split nor did I overclock
- Re-boot the Pi for the partition extension to take effect
- update and upgrade your installation
The Pi is now ready.
Add Erlang Solutions' Repository (omit this step, see update 03.11.2015 hint)
Again, we will not add the Cloudant repository for Spidermonkey, but this time add the Erlang Solutions repository in order to install their Erlang package. This will get you an Erlang 1.17 version which is now ok for couchDB 1.6.0.
The following instructions have been taken from Erlang Solutions' download section:
The following instructions have been taken from Erlang Solutions' download section:
# # Add the following line to your /etc/apt/sources.list: deb http://packages.erlang-solutions.com/debian wheezy contrib #Next, add the Erlang Solutions public key for apt-secure using following commans: wget http://packages.erlang-solutions.com/debian/erlang_solutions.asc sudo apt-key add erlang_solutions.asc # update repository cache sudo apt-get update #
Install what's needed
Install the following packages:
# # Install Compilers sudo apt-get install erlang-nox sudo apt-get install erlang-dev # Spidermonkey JS engine as lib sudo apt-get install libmozjs185-1.0 # Development headers for spidermonkey lib sudo apt-get install libmozjs185-dev # Dev files for libcurl (openSSL) sudo apt-get install libcurl4-openssl-dev # Dev files for icu (Unicode and Locales) sudo apt-get install libicu-dev #
Create an account for couchDB
Next we have to create an account for couchDB:# # Create couchDB account sudo useradd -d /var/lib/couchdb couchdb sudo mkdir -p /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb /var/lib/couchdb sudo chown -R couchdb:couchdb /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb sudo chmod -R g+rw /usr/local/{lib,etc}/couchdb /usr/local/var/{lib,log,run}/couchdb #
(find an appropriate mirror near you)
# # Download source and unpack wget http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/couchdb/source/1.6.0/apache-couchdb-1.6.0.tar.gz tar xzf apache-couchdb-*.tar.gz #
# # Change into the couchDB directory cd apache-couchdb-1.6.0 #
# #Configure the build ./configure --prefix=/usr/local --with-js-lib=/usr/lib --with-js-include=/usr/include/js --enable-init #
“You have configured Apache CouchDB, time to relax.This also tells you what the next step will be: running make and make install.
Run 'make && sudo make install' to install.”
# # running make and make install make && sudo make install #
Finally create some soft links, make the service start up at boot-time and start couchDB:
# # Start couchDB sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb sudo /etc/init.d/couchdb start sudo update-rc.d couchdb defaults # see if its running... curl http://127.0.0.1:5984/ #
As you can see, the couchDB service binds to localhost.
If you want to reach couchDB from another machine, maybe from another Pi :-), change this.
Open local.ini, find the [httpd] section, activate the binding_address and set it to the IP of your Pi:
# # make couchDB accessible within your network sudo vi /usr/local/etc/couchdb/local.ini #
It should now look like this:
[httpd]
;port = 5984
bind_address = 0.0.0.0
As a final test, re-boot your Pi and try to reach couchDB Futon:
And that's it. CouchDB 1.6.0 is running on your Pi.
There is one additional step suggested by a kind reader:
# # Now including this hint sent by anonymous # make couchdb user (created above) owner of local ini-file sudo chown couchdb:couchdb /usr/local/etc/couchdb/local.ini #
Credits
The instructions above are based on an installation guide compiled by Dave Cottlehuber on the new couchDB Confluence Wiki. It describes the process of installing couchDB on a Debian system.
The Wiki entry is here.
I slightly adjusted this process to be working for the Pi too and now with the Erlang Solutions repository included, this guide is even closer to the Wiki than the one for version 1.5.1.The Wiki entry is here.
Thanks!
ReplyDelete"sudo vi /usr/local/etc/couchdb/local.ini."
The last do is too much.
This comment has been removed by the author.
ReplyDeletewhy does my terminal not accept the following command?
ReplyDeletepi@pi01 ~ $ sudo /etc/init.d/couchdb start
sudo: /etc/init.d/couchdb: command not found
any ideas?
Hi Marc...out of the box, I'm afraid I have no idea. Did you follow the softlink and checked if couchdb is really there? Did you try to start couchdb from its original directory?
ReplyDeleteI too got the command not found error. However, couchdb does exist in the bin folder inside the original directory. I can't seem to run it from there, should i just copy it to /etc/init.d ?
ReplyDeleteHi Greg,
DeleteI'm a little bit worried now.
I've configured all my pi's this way without ever facing an issue. But that's quite a while ago now.
On next occasion I will verify the process.
Are you using the original Pi or the new mode Pi2B?
I'm using the original Pi with a fresh install of the most recent version of Raspbian (installed through NOOBS).
DeleteI was able to get CouchDB running from the original downloaded location, it won't run automatically but I can manually start it up.
Hi Greg,
Deletelast weekend I was busy getting the couch running on a Pi on Archlinux, so I did not manage to reproduce your problem.
But if couchdb is missing in /etc/init.d, then earlier on there must have been some problem with creating the soft link. Can you trace back to where the problems started, e.g. is couchdb present in /usr/local/etc/init.d/ ?
Was playing around with Archlinux lately. For the Pi, the Archlinux ARM project is relevant.
ReplyDeleteIt's a little bit more of an effort to install it on the Pi, but once you have it, you should be able to install the couch from their repo. It's version 1.6.1-4 which sounds cool.
Guess I'll try this path next...
Hi Volker,
ReplyDeleteI tried to follow your instructions on a Pi B Rev2, but I get the following error when configuring the build:
checking Erlang version compatibility... detected Erlang version: 7.1.0...configure: error: The installed Erlang version must be >= R14B (erts-5.8.1) and =< 17 (erts-6.0) major_version does not match
I have very little experience with the Pi. Is there a way to solve this?
Thanks
Rodrigo
Hi Rodrigo,
Deletefrom the message I figure that your erlang version is too new for couch 1.6.0.
Try to install couch 1.6.1. This should work.
If not, than you have to install an older erlang version.
Hope this helps.
I'm going to check repositories and versions tonight. Maybe I can give you another hint tomorrow.
best
volker
Hi Rodrigo,
DeleteI just checked my couch 1.6.1 installation for the installed erlang-nox package: version is 1:17.5.3.
Please install version 1.6.1 of couchdb and you should be fine.
best
volker
Hi,
DeleteI just downloaded CouchDB 6.1.1 instead of 6.1.0 and still got the same error with Erlang compatibility.
How can I install older Erlang version that can work with CouchDB?
best
Toncl
Hi,
ReplyDeleteI just downloaded CouchDB 6.1.1 instead of 6.1.0 and still got the same error with Erlang compatibility.
How can I install older Erlang version that can work with CouchDB?
best
Toncl
Hi,
Deletecan you please run this:
sudo apt-cache policy erlang-nox
and post the result?
best
volker
Here you go;
Delete~ $ sudo apt-cache policy erlang-nox
erlang-nox:
Installed: 1:18.1
Candidate: 1:18.1
Version table:
*** 1:18.1 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
100 /var/lib/dpkg/status
1:17.5.3 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:17.5 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:17.4 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:17.3.2 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:17.3 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:17.1 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:16.b.3-3 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:16.b.3 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:16.b.2 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:16.b 0
500 http://packages.erlang-solutions.com/debian/ wheezy/contrib armhf Packages
1:15.b.1-dfsg-4+deb7u1 0
500 http://mirrordirector.raspbian.org/raspbian/ wheezy/main armhf Packages
ok, seems like Erlang Solutions Repository now contains a new major version 1:18.1.
DeleteThis means that my tutorial does no longer work correctly. Sorry.
What you can do is to leave out the first step: including the Erlang Solutions Repo.
You will then fall back to using the version in the regular raspbian repository. I tried this today with the brand new Jessie based raspbian and it worked well.
Hope this helps.
I will update the tutorial as soon as possible.
Thanks for the hint and sorry for your trouble.
best
volker
This comment has been removed by the author.
ReplyDeleteI just wanted to say thank you.
ReplyDeleteI have just seamlessly installed CouchDB 1.6.1 on Raspbian Jessie on a Pi 2.
All sorted in the time it took to heat up a bowl of soup.
I'm very grateful for your well written, easy to follow instructions.
Thank you very much for your kind feedback.
DeleteYou made my day :-)
I really appreciate information shared above. It’s of great help. If someone want to learn Online (Virtual) instructor lead live training in Couch DB, kindly contact us http://www.maxmunus.com/contact
ReplyDeleteMaxMunus Offer World Class Virtual Instructor led training on Couch DB. We have industry expert trainer. We provide Training Material and Software Support. MaxMunus has successfully conducted 100000+ trainings in India, USA, UK, Australlia, Switzerland, Qatar, Saudi Arabia, Bangladesh, Bahrain and UAE etc.
For Demo Contact us.
Nitesh Kumar
MaxMunus
E-mail: nitesh@maxmunus.com
Skype id: nitesh_maxmunus
Ph:(+91) 8553912023
http://www.maxmunus.com/