CouchDB - 安装



本章将教你如何在 Windows 和 Linux 系统中安装 CouchDB。

在 Windows 中安装 CouchDB

下载 CouchDB

CouchDB 的官方网站是 https://couchdb.apache.org。如果您点击提供的链接,您可以获得 CouchDB 官方网站的首页,如下所示。

Download CouchDB

如果您点击下载按钮,将跳转到一个页面,其中提供了各种格式的 CouchDB 下载链接。以下快照说明了这一点。

CouchDB Formats

选择 Windows 系统的下载链接,并选择提供的镜像之一开始下载。

安装 CouchDB

CouchDB 将以名为 setup-couchdb-1.6.1_R16B02.exe 的安装文件形式下载到您的系统中。运行安装文件并继续安装。

安装完成后,通过访问以下链接:http://127.0.0.1:5984/ 打开 CouchDB 的内置 Web 界面。如果一切顺利,这将为您提供一个网页,其中包含以下输出。

{
   "couchdb":"Welcome","uuid":"c8d48ac61bb497f4692b346e0f400d60",
   "version":"1.6.1",
   "vendor":{
      "version":"1.6.1","name":"The Apache Software Foundation"
   }
}

您可以使用以下 URL 与 CouchDB Web 界面进行交互:

http://127.0.0.1:5984/_utils/

这将显示 Futon 的索引页面,Futon 是 CouchDB 的 Web 界面。

Web Interface

在 Linux 系统中安装 CouchDB

对于许多 Linux 发行版系统,它们在内部提供了 CouchDB。要安装此 CouchDB,请按照说明操作。

在 Ubuntu 和 Debian 上,您可以使用:

sudo aptitude install couchdb

在 Gentoo Linux 上,有一个 CouchDB ebuild 可用:

sudo emerge couchdb

如果您的 Linux 系统没有 CouchDB,请按照下一节安装 CouchDB 及其依赖项。

安装 CouchDB 依赖项

以下是要在系统中获取 CouchDB 需要安装的依赖项列表:

  • Erlang OTP
  • ICU
  • OpenSSL
  • Mozilla SpiderMonkey
  • GNU Make
  • GNU 编译器集合
  • libcurl
  • help2man
  • Python 文档
  • Python Sphinx

要安装这些依赖项,请在终端中键入以下命令。这里我们使用的是 Centos 6.5,以下命令将安装与 Centos 6.5 兼容的所需软件。

$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

注意:对于所有这些命令,您需要使用 sudo。以下过程将普通用户转换为 sudoer。

  • 以管理员用户的 root 身份登录

  • 使用以下命令打开sudo文件:

visudo
  • 然后按如下所示进行编辑,以授予您现有的用户 sudoer 权限:
Hadoop All=(All) All , and press esc : x to write the changes to the file. 

在系统中下载完所有依赖项后,请按照提供的说明下载 CouchDB。

下载 CouchDB

Apache 软件基金会不会提供 CouchDB 的完整 .tar 文件,因此您必须从源代码安装它。

创建一个新目录来安装 CouchDB,浏览到此创建的目录并通过执行以下命令下载 CouchDB 源代码:

$ cd
$ mkdir CouchDB
$ cd CouchDB/
$ wget
http://www.google.com/url?q=http%3A%2F%2Fwww.apache.org%2Fdist%2Fcouchdb%2Fsource%2F1.6.1%2Fapache-couchdb-1.6.1.tar.gz

这将把 CouchDB 源文件下载到您的系统中。现在解压缩 apache-couchdb-1.6.1.tar.gz,如下所示。

$ tar zxvf apache-couchdb-1.6.1.tar.gz

配置 CouchDB

要配置 CouchDB,请执行以下操作:

  • 浏览到 CouchDB 的主文件夹。
  • 以超级用户身份登录。
  • 使用 ./configure 提示进行配置,如下所示:
$ cd apache-couchdb-1.6.1
$ su
Password:
# ./configure --with-erlang=/usr/lib64/erlang/usr/include/

它将为您提供如下所示的输出,并以“您已配置 Apache CouchDB,是时候放松一下了”的结束行结尾。

# ./configure --with-erlang=/usr/lib64/erlang/usr/include/

checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking how to create a ustar tar archive... gnutar
………………………………………………………..
……………………….
config.status: creating var/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: creating src/snappy/google-snappy/config.h
config.status: src/snappy/google-snappy/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

You have configured Apache CouchDB, time to relax.

Run `make && sudo make install' to install.

安装 CouchDB

现在键入以下命令以在您的系统中安装 CouchDB。

# make && sudo make install

它将在您的系统中安装 CouchDB,并以“您已安装 Apache CouchDB,是时候放松一下了”的结束行结尾。

启动 CouchDB

要启动 CouchDB,请浏览到 CouchDB 主文件夹并使用以下命令:

$ cd apache-couchdb-1.6.1
$ cd etc
$ couchdb start

它将启动 CouchDB 并输出以下内容:

Apache CouchDB 1.6.1 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [lt;0.31.0gt;] Apache CouchDB has started on http://127.0.0.1:5984/
[info] [lt;0.112.0gt;] 127.0.0.1 - - GET / 200
[info] [lt;0.112.0gt;] 127.0.0.1 - - GET /favicon.ico 200

验证

由于 CouchDB 是一个 Web 界面,请尝试在浏览器中键入以下主页 URL。

http://127.0.0.1:5984/

它将产生以下输出:

{
   "couchdb":"Welcome",
   "uuid":"8f0d59acd0e179f5e9f0075fa1f5e804",
   "version":"1.6.1",
   "vendor":{
      "name":"The Apache Software Foundation",
      "version":"1.6.1"
   }
}
广告

© . All rights reserved.