wikimedia

CouchDB on Ubuntu 18.04

Install CouchDB using snap:

sudo snap install couchdb

Set the admin pass:

sudo snap set couchdb admin=1

Give it permissions that it needs:

sudo snap connect couchdb:mount-observe

sudo snap connect couchdb:process-control

Start the service:

sudo snap start couchdb

Go to this address in your browser: `http://localhost:5984/_utils`

Install `jq` for prettifying the output json

sudo apt install jq

Create 3 files. 

1- call this file `get`

#!/bin/bash

curl -sX GET http://admin:1@localhost:5984/$1 | jq

2- call this file `put`

#!/bin/bash

curl -sX PUT http://admin:1@localhost:5984/$1 | jq

3- call this file `del`

#!/bin/bash

curl -sX DELETE http://admin:1@localhost:5984/$1 | jq

Make these executable and add them to a folder that exists in the  $PATH.

The `-s` in the `curl` command is there to not show the download progressbar. Otherwise, the output of these files will have some extra lines in the begninning that makes it ugly.

Now you can run commands like this:

get _all_dbs

 

Comments