Skip to content

Instantly share code, notes, and snippets.

@ratopi
Last active April 27, 2022 01:08
Show Gist options
  • Save ratopi/928078ca06f35d50b62dabb927bc5755 to your computer and use it in GitHub Desktop.
Save ratopi/928078ca06f35d50b62dabb927bc5755 to your computer and use it in GitHub Desktop.
CouchDB on Raspberry PI
From: http://raspberryperl.com/CouchDB/installCouchDB-1.6.1-on-Pi-2-jessie.txt
================================================================================
# Install CouchDB Database on Pi-2 Running Raspbian Jessie
# These instructions are based on those found on this web page:
( http://jeeonthepi.blogspot.com/2015/09/installing-couchdb-161-on-raspberry-pi.html )
==========================================================================================
##########################################################################################
Install Erlang (https://www.erlang-solutions.com/downloads/download-erlang-otp)
##########################################################################################
# 1. Adding repository entry
# Add the following line to your /etc/apt/sources.list:
$ wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb
$ sudo dpkg -i erlang-solutions_1.0_all.deb
## when prompted enter "jessie"
$ sudo nano /etc/apt/sources.list
# Uncomment line below and save the file:
#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
$ sudo apt-get update
# Next, add the Erlang Solutions public key for apt-secure using following commands:
$ wget http://packages.erlang-solutions.com/debian/erlang_solutions.asc
$ sudo apt-key add erlang_solutions.asc
# 2. Installing Erlang
# Refresh the repository cache and install the erlang package.
$ sudo apt-get update
$ sudo apt-get install erlang
# 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
# Most of this below is needed to install the CouchDB Documentation (as far as I know)
$ sudo apt-get install help2man
$ sudo apt-get install install-info
$ sudo apt-get install texlive-latex-base
$ sudo apt-get install texlive-pictures
$ sudo apt-get install python-pygments
$ sudo apt-get install python-sphinx
$ sudo apt-get install texinfo
##########################################################################################
Create couchDB user 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
##########################################################################################
Install CouchDB
##########################################################################################
# Download source and unpack
$ wget http://ftp-stud.hs-esslingen.de/pub/Mirrors/ftp.apache.org/dist/couchdb/source/1.6.1/apache-couchdb-1.6.1.tar.gz
$ tar xzf apache-couchdb-*.tar.gz
# Change into the couchDB directory
$ cd apache-couchdb-1.6.1
#Configure the build
$ ./configure --prefix=/usr/local --with-js-lib=/usr/lib --with-js-include=/usr/include/js --enable-init
# running make and make install
$ make && sudo make install
# Install hung here:
! Font T1/cmr/m/n/10=ecrm1000 at 10.0pt not loadable: Metric (TFM) file not fou
nd.
<to be read again>
relax
l.100 \fontencoding\encodingdefault\selectfont
?
# I just hit "return" and it finished up...
##########################################################################################
# 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/
# If it is running you'll see a message like this:
{"couchdb":"Welcome","uuid":"ca6622aa3e676b51ef8245ae473454cb","version":"1.6.1","vendor":{"version":"1.6.1","name":"The Apache Software Foundation"}}
##########################################################################################
# Configure couchDB
##########################################################################################
# Open local.ini:
$ sudo nano /usr/local/etc/couchdb/local.ini
# Find the [httpd] section, uncomment the port
# and bind_address and set the bind_address to the IP of
# your Pi to make couchDB accessible within your network
[httpd]
port = 5984
bind_address = YOUR_IP_ADDRESS
# Example: bind_address = 192.168.0.211
# make couchdb user (created above) owner of local ini-file
$ sudo chown couchdb:couchdb /usr/local/etc/couchdb/local.ini
# re-boot your Pi and open Futon in your web browser:
$ sudo reboot
$ sudo /etc/init.d/couchdb start
# YOUR_IP_ADDRESS:5984/_utils/
# example: http://192.168.0.211:5984/_utils/
# Or try the new "Fauxton" interface:
# example: http://192.168.0.211:5984/_utils/fauxton/
# To Restart CouchDB
$ sudo pkill -f couchdb
$ sudo /etc/init.d/couchdb restart
# Enabling CORS on CouchDB
$ npm install -g add-cors-to-couchdb
# $ add-cors-to-couchdb
$ add-cors-to-couchdb http://192.168.0.211 -u pi -p pi
================================================================================
# Pi-2 Node.js
(https://learn.adafruit.com/node-embedded-development/installing-node-dot-js)
================================================================================
$ curl -sLS https://apt.adafruit.com/add | sudo bash
$ sudo apt-get install node
$ node -v
================================================================================
# That's all a got!
================================================================================
From: http://raspberryperl.com/CouchDB/installCouchDB.txt
================================================================================
# Install CouchDB Database
# These instructions are based on those found on this web page:
# http://jeeonthepi.blogspot.com/2014/08/installing-couchdb-1.html
================================================================================
# 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
# commands:
$ 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 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 couchDB user 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
# 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
# running make and make install
$ make && sudo make install
# 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/
# Open local.ini, find the [httpd] section, uncomment the port
# and bind_address and set the bind_address to the IP of
# your Pi to make couchDB accessible within your network
[httpd]
port = 5984
bind_address = YOUR_IP_ADDRESS
# Example: bind_address = 192.168.0.131
# make couchdb user (created above) owner of local ini-file
$ sudo chown couchdb:couchdb /usr/local/etc/couchdb/local.ini
# re-boot your Pi and open Futon in your web browser:
# YOUR_IP_ADDRESS:5984/_utils/
# example: http://192.168.0.131:5984/_utils/
# To Restart CouchDB
$ sudo pkill -f couchdb
$ sudo /etc/init.d/couchdb restart
================================================================================
# Install CouchApp:
$ sudo apt-get install python-setuptools
$ sudo apt-get install python-dev
$ sudo easy_install -U couchapp
# Or:
$ sudo apt-get install python-dev
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo python get-pip.py
$ pip install couchapp
# Create a CouchApp
$ sudo couchapp generate MY_APP_NAME
# Push your couchApp to CouchDB:
$ sudo couchapp push . http://YOUR_IP_ADDRESS:5984/YOUR_DB_NAME
# Example: $ sudo couchapp push . http://192.168.0.131:5984/testdb
# Example: $ sudo couchapp push . http://user:[email protected]:5984/testdb
# Example: $ sudo couchapp push . http://pi:[email protected]:5984/testdb
================================================================================
# That's all a got!
================================================================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment