Created
June 17, 2017 00:06
-
-
Save natevw/538f70e058e3245c2c5baf03bd6872e9 to your computer and use it in GitHub Desktop.
Revisions
-
natevw created this gist
Jun 17, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,86 @@ ## 2017 June 16 — build CouchDB # via https://cwiki.apache.org/confluence/display/COUCHDB/Amazon+Linux # and http://asaf.github.io/blog/2013/07/08/installing-couch-db-on-amazon-ami/ # and https://forums.aws.amazon.com/thread.jspa?threadID=185101 <------ mostly this, without yum java etc… # also: http://andyfelong.com/2016/12/couchdb-2-0-on-raspberry-pi/ sudo yum --enablerepo=epel update sudo yum groupinstall "Development Tools" # various suggestions from tutorials, see below for what seemed to actually be needed (when building all of Erlang, MozJS, CouchDB from source) #sudo yum --enablerepo=epel install perl-Test-Harness erlang-erts erlang-os_mon erlang-eunit libicu-devel autoconf-archive curl-devel erlang-etap erlang-asn1 erlang-xmerl js-devel #sudo yum --enablerepo=epel install perl-Test-Harness erlang-erts erlang-os_mon erlang-eunit libicu-devel autoconf-archive curl-devel erlang-etap #sudo yum --enablerepo=epel install libicu-devel curl-devel ncurses-devel libtool libxslt fop java-1.6.0-openjdk java-1.6.0-openjdk-devel unixODBC unixODBC-devel openssl-devel curl -O https://ftp.mozilla.org/pub/js/js185-1.0.0.tar.gz tar -xvf js185-1.0.0.tar.gz cd js-1.8.5/js/src/ ./configure make sudo make install sudo yum install libicu-devel ncurses-devel openssl-devel mkdir couch-compile && cd couch-compile curl -O http://erlang.org/download/otp_src_19.3.tar.gz tar -xvf otp_src_19.3.tar.gz cd otp_src_19.3 ./configure make # warns of skipping ODBC, Java Interface, docs via fakefop sudo make install curl -O https://apache.cs.utah.edu/couchdb/source/2.0.0/apache-couchdb-2.0.0.tar.gz md5sum apache-couchdb-2.0.0.tar.gz # 402fc02df28a5297a56cedebbae42524 tar -xvf apache-couchdb-2.0.0.tar.gz cd apache-couchdb-2.0.0 # avoid "fatal error: jsapi.h: No such file or directory" by pointing build to default js185 prefix of /usr/local # somewhat via https://github.com/apache/couchdb/issues/455#issuecomment-287523718 and https://stackoverflow.com/a/41273863/179583, though different approach taken vi src/couch/rebar.config.script #{"linux", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/usr/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -lm"}]}]} {"linux", CouchJSPath, CouchJSSrc, [{env, [{"CFLAGS", JS_CFLAGS ++ " -DXP_UNIX -I/usr/local/include/js"}, {"LDFLAGS", JS_LDFLAGS ++ " -L/usr/local/lib -lm"}]}]} ./configure make release # for couchjs to run, need to also: # OPTION A vi ~/.bash_profile LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" export LD_LIBRARY_PATH # OPTION B sudo ln -s /usr/local/lib/libmozjs185.so.1.0 /usr/lib/ sudo ldconfig # see http://docs.couchdb.org/en/2.0.0/install/index.html#single-node-setup via https://groups.google.com/forum/#!msg/couchdb-user-archive/c1crP48Eq7w/PCNi0NolDwAJ (database_does_not_exist,[{mem3_shards) # from laptop, configure single node on 127.0.0.1 ssh ecc3 -L 5984:localhost:5984 -N open http://127.0.0.1:5984/_utils/#setup sudo adduser --system --create-home couchdb sudo mv couch-compile/* ~couchdb/ sudo chown couchdb:couchdb -R ~couchdb # via https://www.snip2code.com/Snippet/84394/CouchDB-upstart-script # and https://stackoverflow.com/questions/11980900/how-to-get-custom-couchdb-to-run-as-upstart-job # and https://gist.github.com/fredrick/1398746/b2eef8950f2c49c3c9e135d19538762c203ce691 # and https://gist.github.com/kowsik/1187638 sudo vi /etc/init/couchdb.conf #start on (local-filesystems and net-device-up) start on runlevel [345] stop on runlevel [!345] respawn #setuid couchdb # bah, Amazon Linux still using upstart version 0.6.5!!!! #exec /home/ec2-user/couch-compile/apache-couchdb-2.0.0/rel/couchdb/bin/couchdb exec sudo -u couchdb /home/couchdb/apache-couchdb-2.0.0/rel/couchdb/bin/couchdb sudo initctl reload-configuration sudo initctl start couchdb