├── LICENSE ├── README.md ├── install-couchdb.sh └── reinit-couchdb.sh /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Aleksander Alekseev 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # install-couchdb 2 | 3 | Simple CouchDB 2.x installation script 4 | 5 | Usage: 6 | 7 | ``` 8 | mkdir temp 9 | cd temp 10 | wget https://raw.githubusercontent.com/afiskon/install-couchdb/master/install-couchdb.sh 11 | sh install-couchdb.sh 12 | # then see http://localhost:5984/_utils/ 13 | ``` 14 | 15 | Tested on Ubuntu 16.04 16 | -------------------------------------------------------------------------------- /install-couchdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | sudo apt-get update || true 6 | sudo apt-get --no-install-recommends -y install \ 7 | build-essential pkg-config runit erlang \ 8 | libicu-dev libmozjs185-dev libcurl4-openssl-dev 9 | 10 | wget http://apache-mirror.rbc.ru/pub/apache/couchdb/source/2.1.1/apache-couchdb-2.1.1.tar.gz 11 | 12 | tar -xvzf apache-couchdb-2.1.1.tar.gz 13 | cd apache-couchdb-2.1.1/ 14 | ./configure && make release 15 | 16 | sudo adduser --system \ 17 | --no-create-home \ 18 | --shell /bin/bash \ 19 | --group --gecos \ 20 | "CouchDB Administrator" couchdb 21 | 22 | sudo cp -R rel/couchdb /home/couchdb 23 | sudo chown -R couchdb:couchdb /home/couchdb 24 | sudo find /home/couchdb -type d -exec chmod 0770 {} \; 25 | sudo sh -c 'chmod 0644 /home/couchdb/etc/*' 26 | 27 | sudo mkdir /var/log/couchdb 28 | sudo chown couchdb:couchdb /var/log/couchdb 29 | 30 | sudo mkdir /etc/sv/couchdb 31 | sudo mkdir /etc/sv/couchdb/log 32 | 33 | cat > run << EOF 34 | #!/bin/sh 35 | export HOME=/home/couchdb 36 | exec 2>&1 37 | exec chpst -u couchdb /home/couchdb/bin/couchdb 38 | EOF 39 | 40 | cat > log_run << EOF 41 | #!/bin/sh 42 | exec svlogd -tt /var/log/couchdb 43 | EOF 44 | 45 | sudo mv ./run /etc/sv/couchdb/run 46 | sudo mv ./log_run /etc/sv/couchdb/log/run 47 | 48 | sudo chmod u+x /etc/sv/couchdb/run 49 | sudo chmod u+x /etc/sv/couchdb/log/run 50 | 51 | sudo ln -s /etc/sv/couchdb/ /etc/service/couchdb 52 | 53 | sleep 5 54 | sudo sv status couchdb 55 | -------------------------------------------------------------------------------- /reinit-couchdb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -e 4 | 5 | cd apache-couchdb-2.0.0/ 6 | 7 | sudo sv stop couchdb 8 | sudo killall epmd || true 9 | sudo rm -rf /home/couchdb 10 | 11 | sudo cp -R rel/couchdb /home/couchdb 12 | sudo chown -R couchdb:couchdb /home/couchdb 13 | sudo find /home/couchdb -type d -exec chmod 0770 {} \; 14 | sudo sh -c 'chmod 0644 /home/couchdb/etc/*' 15 | 16 | sudo sv start couchdb 17 | sleep 3 18 | curl -X GET http://localhost:5984/_membership 19 | --------------------------------------------------------------------------------