原文:https://blog.csdn.net/wh211212/article/details/74359497
yum install build-essential
yum install libncurses5-dev
yum install libssl-dev
yum install m4
yum install unixodbc unixodbc-dev
yum install freeglut3-dev libwxgtk2.8-dev
yum install xsltproc
yum install fop
yum install tk8.5
yum install ncurses-devel
yum install zip
yum install libicu-devel
yum install openssl-devel
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
yum -y groupinstall "Development Tools" "Development Libraries"
rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm
yum install autoconf automake curl-devel help2man libicu-devel libtool perl-Test-Harness wget libicu-devel curl-devel ncurses-devel libtool libxslt fop java-1.7.0-openjdk java-1.7.0-openjdk-devel unixODBC unixODBC-devel vim openssl-devel
yum install erlang-asn1 erlang-erts erlang-eunit erlang erlang-os_mon erlang-xmerlwget http://erlang.org/download/otp_src_19.3.tar.gz #满足依赖的最新版erlang
tar -xvf otp_src_19.3.tar.gz
cd otp_src_19.3
./configure && make
make install
wget http://ftp.mozilla.org/pub/mozilla.org/js/js185-1.0.0.tar.gz
cd js-1.8.5/js/src
./configure && make
sudo make install
vim /etc/yum.repos.d/puias-computational.repo
[PUIAS_6_computational]
name=PUIAS computational Base $releasever - $basearch
mirrorlist=http://puias.math.ias.edu/data/puias/computational/$releasever/$basearch/mirrorlist
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puias
yum install autoconf-archive -y
wget http://mirror.bit.edu.cn/apache/couchdb/source/2.0.0/apache-couchdb-2.0.0.tar.gz
tar zxvf apache-couchdb-2.0.0.tar.gz
cd apache-couchdb-2.0.0
./configure
make release # 这里有报错,根据解决方法修改完成之后重新make release,在文章末尾
adduser --system --no-create-home --shell /bin/bash -c "CouchDB Administrator" couchdb # 使用此条命令
mv /usr/local/src/apache-couchdb-2.0.0/rel/couchdb /usr/local/
chown -R couchdb:couchdb /usr/local/couchdb
vim /usr/local/couchdb/etc/vm.args
-name [email protected] #意思是 couchdb@ +hostname
#修改hosts
vim /etc/hosts 添加
0.0.0.0 localhost localhost.localdomain peer0.org1.example.com
vim /etc/sysconfig/network
#添加,没发现有啥效果
localhost.localdomain
> 上面几步操作是修改hostname,方便识别,为后面配置couchdb集群方便
# -kernel inet_dist_listen_min 9100
# -kernel inet_dist_listen_max 9200
> 上面两个参数暂时不用,配置集群的时候在使用
# 修改couchdb启动时默认监听的ip,默认127.0.0.1,不能通过浏览器进行初始化设置,改为0.0.0.0
sed -i 's/127.0.0.1/0.0.0.0/g' /usr/local/couchdb/etc/default.ini
配置完成之后使用couchdb用户启动couchdb
cd /usr/local/couchdb
./bin/couchdb
http://172.17.0.84:5986/_utils/
ERROR: compile failed while processing /usr/local/src/apache-couchdb-2.0.0/src/couch: rebar_abort
cd /usr/local/src/apache-couchdb-2.0.0
egrep -r js-1.8.5 *
vim +106 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 ++ " -lm"}]}]},
# 根本原因就是couchdb编译的时候找到默认的js
# 还有种方式就是做软链接
ln -s /usr/local/include/js /usr/include/j # 这种方法尚未尝试,修改完成就可以继续编译啦
安装依赖缺失报错
[root@localhost apache-couchdb-2.0.0]# make release
Uncaught error in rebar_core: {'EXIT',
{undef,
[{crypto,start,[],[]},
{rebar,run_aux,2,
[{file,"src/rebar.erl"},{line,212}]},
{rebar,main,1,
[{file,"src/rebar.erl"},{line,58}]},
{escript,run,2,
[{file,"escript.erl"},{line,760}]},
{escript,start,1,
[{file,"escript.erl"},{line,277}]},
{init,start_em,1,[]},
{init,do_boot,3,[]}]}}
make: *** [couch] Error 1
报错是编译erlang前没安装openssl-devel,安装openssl-devel重新编译erlang,上边步骤再来一遍
安装完成
WARN: 'generate' command does not apply to directory /usr/local/src/apache-couchdb-2.0.0
... done
You can now copy the rel/couchdb directory anywhere on your system.
Start CouchDB with ./bin/couchdb from within that directory.