在这篇文章中,我们主要介绍和演示如何下载和安装 CouchDB , 由于时间和篇幅的限制,这里只介绍在 Window 10 64位和Ubuntu的CouchDB安装配置。
下载CouchDB
访问CouchDB官方网站:http://couchdb.apache.org/ , 点击右上方的下载(Download)链接,就会跳到下载页面,CouchDB有各种格式的文件可供下载,这里选择 Windows (x64) 这个版本
完成安装后,打开浏览器并访问以下链接:http://127.0.0.1:5984/ 。
如果没有问题,应该会看到以下输出:
可以使用以下网址与CouchDB Web界面进行交互:
现在转到验证选项卡并验证安装情况:
验证后,您将收到一条验证信息。
现在转到安装程序选项卡,看到两个选项:配置集群(Configure cluster)和配置单节点(configure single node)。
群集用于多个服务器和大型设置。 对于一个简单的数据库应用程序,则选择“配置单节点(configure single node)”。
当您单击“配置单节点(configure single node)”时,必须填写一些凭据。
可以通过单击“管理(Admin)”选项卡来更改密码或创建其他管理员。
一些Linux系统在内部有提供CouchDB数据库。 例如,要在Ubuntu和Debian上安装CouchDB,请使用以下说明:
sudo apt install couchdb |
web3@ubuntu:~$ sudo apt install couchdb |
[sudo] password for yiibai: |
Reading package lists... Done |
Building dependency tree |
Reading state information... Done |
The following extra packages will be installed: |
couchdb-bin couchdb-common erlang-asn1 erlang-base-hipe erlang-crypto |
erlang-eunit erlang-inets erlang-mnesia erlang-os-mon erlang-public-key |
erlang-runtime-tools erlang-snmp erlang-ssl erlang-syntax-tools erlang-tools |
erlang-webtool erlang-xmerl libmozjs185-1.0 libsctp1 lksctp-tools |
Suggested packages: |
erlang erlang-manpages erlang-doc erlang-edoc erlang-gs erlang-observer |
The following NEW packages will be installed: |
couchdb couchdb-bin couchdb-common erlang-asn1 erlang-base-hipe |
erlang-crypto erlang-eunit erlang-inets erlang-mnesia erlang-os-mon |
erlang-public-key erlang-runtime-tools erlang-snmp erlang-ssl |
erlang-syntax-tools erlang-tools erlang-webtool erlang-xmerl libmozjs185-1.0 |
libsctp1 lksctp-tools |
0 upgraded, 21 newly installed, 0 to remove and 450 not upgraded. |
Need to get 19.7 MB of archives. |
After this operation, 43.2 MB of additional disk space will be used. |
Do you want to continue? [Y/n] y |
注:可以看到上面默认安装的是 couchdb 1.5.0 版本,如果有兴趣可以安装最新版本,参考接下来的步骤。
安装最新版本(apache-couchdb-1.6.0
)
$ sudo apt-get --no-install-recommends -y install \ |
build-essential pkg-config erlang \ |
libicu-dev libmozjs185-dev libcurl4-openssl-dev |
$ sudo apt-get update |
$ sudo apt-get install software-properties-common -y |
$ sudo add-apt-repository ppa:couchdb/stable -y |
$ sudo apt-get update |
$ sudo apt-get remove couchdb couchdb-bin couchdb-common -yf |
$ sudo apt-get install couchdb -y |
localhost
上使用端口5984
运行,可以通过从命令行运行curl来检索此基本信息(验证安装结果):
web3@ubuntu:~$ curl localhost:5984 |
{"couchdb":"Welcome","uuid":"22d9e91e925fecdb5a3698e26a7f6815","version":"1.6.1","vendor":{"name":"Ubuntu","version":"14.04"}} |
web3@ubuntu:~$ |
将看到以下输出:
如果Linux系统没有CouchDB,则安装CouchDB及其以下依赖项:
要安装上述依赖项,请使用以下命令:
$sudo yum install autoconf |
$sudo yum install autoconf-archive |
$sudo yum install automake |
$sudo yum install curl-devel |
$sudo yum install erlang-asn1 |
$sudo yum install erlang-erts |
$sudo yum install erlang-eunit |
$sudo yum install erlang-os_mon |
$sudo yum install erlang-xmerl |
$sudo yum install help2man |
$sudo yum install js-devel |
$sudo yum install libicu-devel |
$sudo yum install libtool |
$sudo yum install perl-Test-Harness |