First, I must give credit where it is due. These instructions are based on Matteo Mattei’s earlier article Install CouchDB 1.6.x on Debian 7 (Wheezy), but with some important changes.
The commands below assume you have sudo properly configured on your system, and that you are running as a standard user. If you’re doing everything as root: 1) Don’t. That’s a bad idea! 2) Remove ‘sudo’ as appropriate.
Installing dependencies
- Configure sources.list
You need to add the sources for the Erlang dependencies to
/etc/apt/sources.list
. You can do this with a text editor, or with the following command:sudo echo "deb http://packages.erlang-solutions.com/debian jessie contrib" > /etc/apt/sources.list.d/erlang-solutions.list
- Install the Erlang repository key
wget -qO - http://packages.erlang-solutions.com/debian/erlang_solutions.asc | sudo apt-key add -
- Update the package listing, and install standard build dependencies
sudo aptitude update sudo aptitude install build-essential curl libmozjs185-1.0 libmozjs185-dev libcurl4-openssl-dev libicu-dev wget curl
- Install the proper versions of the necessary Erlang packages
This is the trickiest part. If you install the default versions, you’ll get a version of Erlang which is incompatible with CouchDB (thanks to Erlang being newer than couchDB). So you must install an older version explicitly. This is a messy process if done manually. I’ve done the hard work for you, if you’re willing to simply copy-and-paste the following command:
sudo aptitude install erlang-dev=1:17.5.3 erlang-base=1:17.5.3 erlang-crypto=1:17.5.3 \ erlang-nox=1:17.5.3 erlang-inviso=1:17.5.3 erlang-runtime-tools=1:17.5.3 \ erlang-inets=1:17.5.3 erlang-edoc=1:17.5.3 erlang-syntax-tools=1:17.5.3 \ erlang-xmerl=1:17.5.3 erlang-corba=1:17.5.3 erlang-mnesia=1:17.5.3 \ erlang-os-mon=1:17.5.3 erlang-snmp=1:17.5.3 erlang-ssl=1:17.5.3 \ erlang-public-key=1:17.5.3 erlang-asn1=1:17.5.3 erlang-ssh=1:17.5.3 \ erlang-erl-docgen=1:17.5.3 erlang-percept=1:17.5.3 erlang-diameter=1:17.5.3 \ erlang-webtool=1:17.5.3 erlang-eldap=1:17.5.3 erlang-tools=1:17.5.3 \ erlang-eunit=1:17.5.3 erlang-ic=1:17.5.3 erlang-odbc=1:17.5.3 \ erlang-parsetools=1:17.5.3
Then put the packages on hold, or you’ll end up inadvertently upgrading them, and breaking CouchDB.
sudo aptitude hold erlang-dev erlang-base erlang-crypto erlang-nox erlang-inviso erlang-runtime-tools \ erlang-inets erlang-edoc erlang-syntax-tools erlang-xmerl erlang-corba \ erlang-mnesia erlang-os-mon erlang-snmp erlang-ssl erlang-public-key \ erlang-asn1 erlang-ssh erlang-erl-docgen erlang-percept erlang-diameter \ erlang-webtool erlang-eldap erlang-tools erlang-eunit erlang-ic erlang-odbc \ erlang-parsetools
Set up the CouchDB environment
You can simply copy and paste these commands into a terminal window:
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
Download, compile and install CouchDB
Again, you can simply copy and paste these commands. Make sure you do this from a location where a directory can be created and source files unpacked and built. ~/src
might be a handy place
wget http://apache.panu.it/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
tar xzf apache-couchdb-1.6.1.tar.gz
cd apache-couchdb-1.6.1
./configure --prefix=/usr/local --with-js-lib=/usr/lib --with-js-include=/usr/include/js --enable-init
make && sudo make install
Finish setting up the environment
Copy and paste these commands:
sudo chown couchdb:couchdb /usr/local/etc/couchdb/local.ini
sudo ln -s /usr/local/etc/init.d/couchdb /etc/init.d/couchdb
sudo ln -s /usr/local/etc/couchdb /etc
sudo update-rc.d couchdb defaults
sudo /etc/init.d/couchdb start
Verify
To verify your installation, you can visit http://localhost:5984/
from your browser (if you have installed on your local machine), or from the console using curl:
curl http://127.0.0.1:5984/
And you should get a response something like this:
{“couchdb”:”Welcome”,”uuid”:”a176f89954c3ddba7aa592d712c25140″,”version”:”1.6.1″,”vendor”:{“name”:”The Apache Software Foundation”,”version”:”1.6.1″}}
Create an admin account
After a fresh install of CouchDB, anyone who can connect to the server can create a database, or do other destructive things. This is called the Admin party, and you need to close this hole by creating an account before opening your server to the world.
You can create an admin account from the command line as described here, or you can browse to the Futon interface at http://127.0.0.1:5984/_utils
to do it with a web browser.
Open access to the world
Once you’ve created an admin account, you may wish to open your CouchDB instance to the world. Do this by editing the config file /etc/couchdb/local.ini
, and adding the following line to the [httpd]
section:
bind_address = 0.0.0.0
Then restart the service:
/etc/init.d/couchdb restart
Finished
At this point, you can begin using CouchDB, or continue with additional configurations.
Step #1 has a fatal bug: the single > sign means that the other sources in /etc/apt/sources.list will be overwritten.
To fix you can include an extra > sign, as follows:
sudo echo “deb http://packages.erlang-solutions.com/debian jessie contrib” >> /etc/apt/sources.list
Which will then append the Erlang repository source to the existing list.
Probably better is this, which adds the Erlang repository source to its own list:
sudo echo “deb http://packages.erlang-solutions.com/debian jessie contrib” > /etc/apt/sources.list.d/erlang-solutions.list
The rest of the steps worked perfectly for me.
Thank you for pointing out my oversight. I have updated the first step instructions as you suggested. I’m glad the rest of the steps were helpful to you!
Same problem like on other tutorials, erlang 1.17 unable to find so is installed 1.18.
On RPi2.
On first step I use “deb http://ftp.de.debian.org/debian jessie main”, I hope it will work
You probably have this problem because you didn’t follow my instructions in step 1, and instead used ftp.*.debian.org. The entire point of step 1 is to use the proper mirror, to get Erlang 1.17.
Compilation does not work.
Step `./configure –prefix=/usr/local –with-js-lib=/usr/lib –with-js-include=/usr/include/js –enable-init` fails with error :
checking Erlang version compatibility… detected Erlang version: 7.3.0…configure: error: The installed Erlang version must be >= R14B (erts-5.8.1) and =< 17 (erts-6.0) major_version does not match
Replaced step 4 with this :
sudo aptitude install erlang-dev=1:17.3-dfsg-4 erlang-base=1:17.3-dfsg-4 erlang-crypto=1:17.3-dfsg-4 \
erlang-nox=1:17.3-dfsg-4 erlang-runtime-tools=1:17.3-dfsg-4 \
erlang-inets=1:17.3-dfsg-4 erlang-edoc=1:17.3-dfsg-4 erlang-syntax-tools=1:17.3-dfsg-4 \
erlang-xmerl=1:17.3-dfsg-4 erlang-corba=1:17.3-dfsg-4 erlang-mnesia=1:17.3-dfsg-4 \
erlang-os-mon=1:17.3-dfsg-4 erlang-snmp=1:17.3-dfsg-4 erlang-ssl=1:17.3-dfsg-4 \
erlang-public-key=1:17.3-dfsg-4 erlang-asn1=1:17.3-dfsg-4 erlang-ssh=1:17.3-dfsg-4 \
erlang-erl-docgen=1:17.3-dfsg-4 erlang-percept=1:17.3-dfsg-4 erlang-diameter=1:17.3-dfsg-4 \
erlang-webtool=1:17.3-dfsg-4 erlang-eldap=1:17.3-dfsg-4 erlang-tools=1:17.3-dfsg-4 \
erlang-eunit=1:17.3-dfsg-4 erlang-ic=1:17.3-dfsg-4 erlang-odbc=1:17.3-dfsg-4 \
erlang-parsetools=1:17.3-dfsg-4
sudo aptitude hold erlang-dev erlang-base erlang-crypto erlang-nox erlang-runtime-tools \
erlang-inets erlang-edoc erlang-syntax-tools erlang-xmerl erlang-corba \
erlang-mnesia erlang-os-mon erlang-snmp erlang-ssl erlang-public-key \
erlang-asn1 erlang-ssh erlang-erl-docgen erlang-percept erlang-diameter \
erlang-webtool erlang-eldap erlang-tools erlang-eunit erlang-ic erlang-odbc \
erlang-parsetools
Note: erlang-inviso version 1:17.3-sfdg-4 is not available so I stripped it out.
Step `./configure –prefix=/usr/local –with-js-lib=/usr/lib –with-js-include=/usr/include/js –enable-init` is ok now.
Greetings, I got to the configure step “http://verbally.flimzy.com/install-couchdb-1-6-1-debian-8-2-jessie/” and got the following warning:
checking Erlang version compatibility… detected Erlang version: 7.3.0…configure: error: The installed Erlang version must be >= R14B (erts-5.8.1) and = /etc/apt/sources.list.d/erlang-solutions.list” but got a permissions error:
bash: /etc/apt/sources.list.d/erlang-solutions.list: Permission denied
to get around the permissions error I created a file named erlang-solutions.list in /etc/apt/sources.list.d.
I added the following line to erlang-solutions.list:
deb http://packages.erlang-solutions.com/debian jessie contrib
Not sure where I’ve gone wrong. Any tips will be greatly appreciated.
Best, Tyler
in httpd section the correct string is
bind_address =0.0.0.0
Pingback: CouchDB 2.0 Review: Run away! - Verbally Flimzy