Here Are the Steps to How to Install CouchDB on Ubuntu Cloud Server With root Access as Single Node. Data can be ported from Cloudant to CouchDB. There is CouchDB, CouchIO, CouchOne, Couchbase, Couchbase Server, Couchbase Mobile, Couchbase Lite, CouchApps, BigCouch, Touchbase, Membase, Memcached, MemcacheDB. All are different but are related in a way not obvious from the names alone. First, there was CouchDB, a database created by Damien Katz, a former IBM developer. That became Apache CouchDB which we are talking about. CouchDB is an open-source/free software project of The Apache Software Foundation and is released under the Apache License, FSF-approved, OSI-approved, GPL-compatible. Cloudant is a service from IBM which is closer to CouchDB but horizontally scalable. localhost installation of Cloudant actually possible. It is almost standard to use CouchDB when there is either need of CouchDB or the need is for Cloudant.
Steps to Install CouchDB
Official documents say that 1GB free RAM required for single core processor. So instance with 2GB RAM should give optimum performance for testing. (Minimum System Requirements. Processor: 1 CPU 1.2 GHZ. RAM: 2 GB. DISK Space: 1 GB. JAVA: Java 7). 2 CPU cores and 4GB memory is practical for real work & load testing. Apache’s site has the required repository :
1 | https://apache.bintray.com/ |
SSH to your instance. First update, upgrade :
---
1 2 | apt update -y && apt upgrade -y apt install software-properties-common |
Before starting, you will need to install Apache web server to your server for practical reason. Follow our guide optimized installation of Apache2 on Ubuntu 18.04 LTS as step one. For lazy quick installation of Apache2 (not recommended) run :
1 2 3 | sudo apt-get install apache2 -y sudo systemctl start apache2 sudo systemctl enable apache2 |
WAY 1
Now, first recall the distro names :
Debian 8: jessie
Debian 9: stretch
Ubuntu 14.04: trusty
Ubuntu 16.04: xenial
Ubuntu 18.04: bionic
Replace {distribution}
in below command with the distro name of above for your cloud server and run it to include the package repository :
1 | echo "deb https://apache.bintray.com/couchdb-deb {distribution} main" | sudo tee -a /etc/apt/sources.list |
Install the repository key:
1 | curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add - |
Press ENTER.
WAY 2
1 | sudo add-apt-repository ppa:couchdb/stable |
Common next steps:
Then update the repository cache and install the package:
1 2 | apt update -y && apt upgrade -y apt install couchdb -y |
During the installation, you will prompt you for some initial configuration. The next screen will ask you what you want the CouchDB interface bind address to be. By default, this is 127.0.0.1, but if you want it to be publicly accessible you need to change the bind address to 0.0.0.0. Once the installation is finished, run these :
1 2 3 | sudo systemctl start couchdb sudo systemctl enable couchdb sudo systemctl status couchdb |
Technically, first run will need to be started with the below command :
1 | sudo -i -u couchdb /home/couchdb/bin/couchdb |
CouchDB will be running on port 5984. You can access it by visiting the URL http://your-server-ip:5984/_utils/
. After installation and initial startup, visit http://your-server-ip:5984/_utils#setup. You will be asked to set up CouchDB as a single-node instance or set up a cluster. When you click “Single-Node-Setup”, you will get asked for an admin username and password. Choose them well and remember them.
We believe you followed our Apache installation guide and setup SSL/TLS certificate for your domain or will do those in future. We are now describing after doing those steps. We just need to set it up in the configuration files for CouchDB. To do that, you will need to modify the local.ini file:
1 | sudo nano /opt/couchdb/etc/local.ini |
Below is kind of example how it should be (change with real path, names) :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | … [daemons] ; enable SSL support by uncommenting the following line and supply the PEM's below. ; the default ssl port CouchDB listens on is 6984 httpsd = {chttpd, start_link, [https]} … [ssl] port = 6984 cert_file = /opt/couchdb/letsencrypt/live/YOUR_DOMAIN_NAME.com/cert.pem key_file = /opt/couchdb/letsencrypt/live/YOUR_DOMAIN_NAME.com/privkey.pem cacert_file = /opt/couchdb/letsencrypt/live/YOUR_DOMAIN_NAME.com/fullchain.pem |
Restart CouchDB. You will be able to use domain name with CouchDB now. Please check official documentations for more configuration.
If you face permission error, probably need to change permissions :
1 2 3 4 | sudo chown -R couchdb:couchdb /usr/bin/couchdb /etc/couchdb /usr/share/couchdb sudo chmod -R 0770 /usr/bin/couchdb /etc/couchdb /usr/share/couchdb # find /home/couchdb -type d -exec chmod 0770 {} \; |
couchdb:couchdb can be changed with
www-data:couchdb`.