UPDATE: CouchDB 2.3 on Raspberry Pi 4 & 3

From the Apache CouchDB docs:

CouchDB is a database that completely embraces the web. Store your data with JSON documents. Access your documents with your web browser, via HTTP. Query, combine, and transform your documents with JavaScript. CouchDB works well with modern web and mobile apps.

CouchDB also has Fauxton, a native web-based interface built into CouchDB. It provides an interface to the majority of the CouchDB functionality, including the ability to create, update, delete and view documents and configuration parameters.

I’ve already written a blog post for installing CouchDB 2.0 under Rasbian Jessie for Raspberry Pi.  I’m updating my instructions for CouchDB 2.1 2.3 and Raspbian Buster (in addition to Stretch and Jessie). I’m presenting this “how-to” in cookbook form — i.e. just type in the commands as presented and you should end up with a functional CouchDB install.  For more background and info, check out my previous blog post.

[Updated 10 July, 2019] Continue for detailed instructions

You will need to obtain a URL for the zipped source.  You can get this from the CouchDB downloads page.  Go to this page and look for the latest source download section (currently: “Download CouchDB 2.1.0 2.3.1″).  Click on the red “Source” button and copy the suggested source mirror URL.  You’ll use this URL in the “wget” line below.

# update packages & OS
cd
sudo apt-get update
sudo apt-get upgrade

# You can check the OS version
cat /etc/os-release 

# add Erlang Solutions repository and public key
wget http://packages.erlang-solutions.com/debian/erlang_solutions.asc
sudo apt-key add erlang_solutions.asc
sudo apt-get update

# install all build dependencies - note mutiple lines
sudo apt-get --no-install-recommends -y install \
build-essential pkg-config erlang libicu-dev \
libmozjs185-dev libcurl4-openssl-dev

#add couchdb user and home
sudo useradd -d /home/couchdb couchdb
sudo mkdir /home/couchdb
sudo chown couchdb:couchdb /home/couchdb

# Get source - need URL for mirror (see post instructions, above)
wget http://apache.cs.utah.edu/couchdb/source/2.3.1/apache-couchdb-2.3.1.tar.gz

# extract source and enter source directory
tar zxvf apache-couchdb-2.3.1.tar.gz 
cd apache-couchdb-2.3.1/

# configure build and make executable(s)
./configure
make release

#copy built release to couchdb user home directory
cd ./rel/couchdb/
sudo cp -Rp * /home/couchdb
sudo chown -R couchdb:couchdb /home/couchdb
cd /home/couchdb/etc

# need to edit IP address to allow external access
sudo vi local.ini

After building and installing CouchDB, you can configure it to allow connections from external IP addresses.  You need to edit “/home/couchdb/etc/local.ini”.  The “sudo vi local.ini” line above.

Change this line:
 #bind_address = 127.0.0.1
 to:
 bind_address = 0.0.0.0

You can now run couchdb as user: couchdb:

sudo -i -u couchdb /home/couchdb/bin/couchdb

Connect to CouchDB’s Fauxton GUI using your favorite browser using the URL:

http://192.168.0.27:5984/_utils/

Replace my IP (192.168.0.27) with your R-Pi’s.  Make sure you follow the first-time setup instruction in the CouchDB documentation!  Most users will want/need a single node setup.  You can do this by clicking on the wrench icon in Fauxton and selecting “single node”.  You can bind to your R-Pi’s external IP if you wish to connect via a browser on other computers.  I recommend restarting your browser after initial setup to ensure everything is working properly.

Check out the CouchDB documentation to learn more!

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

SaveSave

9 thoughts on “UPDATE: CouchDB 2.3 on Raspberry Pi 4 & 3”

  1. Pingback: CouchDB 2.0 on Raspberry Pi

  2. Hello! Thanks for the guide! It was on-spot, except it didn’t mention that — at least for me — it only worked when run under root-user. Sudoer wasn’t enough. (Maybe my new-ness to Linux was the reason why I didn’t know already.)

  3. Thanks for writing this Andy! It’s proven very helpful for getting CouchDB running on an ARM-based server at Scaleway.

    It’s probably worth noting that the current version of CouchDB is 2.1.1 – I failed to notice that there’s a handful of references to the filename the first time I ran it.

  4. Pingback: How to install Visual Studio Code on a Raspberry Pi 4 in minutes | Ozzie Bock Says

  5. Thank you for this guide. Made it easy and simple for me to setup CouchDB 2.3.1 on the latest Raspbian (as on 1-May-2020) on both a Raspberry Pi Zero W and a Raspberry Pi 3.

  6. I know this is an older post so I will add a couple of things and then ask my question. If you’re doing this in 2022 at least, you’ll have to use the latest version of couchdb as the erlang regex will be 23 and the older versions won’t support that. Also in my case, libmozjs185-dev isn’t available, so I had to manually install it using https://raspberrypi.stackexchange.com/questions/113695/cannot-install-libmozjs185-on-rpi-3-running-ubuntu-mate with a couple of reboots (it still threw errors about my kernel not matching).

    Now my question. How do you set couchdb up to run as a service? The application that I need to have it for is set to start automatically when the pi boots. Is it a matter of copying something from default.d or local.d to the init.d directory?

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top