You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2008/06/20 13:13:59 UTC

[Couchdb Wiki] Update of "InstallingOnWindows" by JanLehnardt

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The following page has been changed by JanLehnardt:
http://wiki.apache.org/couchdb/InstallingOnWindows

New page:
By zhengji.li@t3gt.com

----------------------------------
Install Apache CouchDB on Windows
----------------------------------
Configuration file, installation scripts for setup CouchDB on Unix/Linux or
alike OS are already there, which makes it totally automatic. But what for
Windows? Nothing!

"But I DO want to enjoy CouchDB on Windows." Easy. Time to Relax.

Note: Below only CouchDB 0.8.0-incubating is covered.

Step 0. Required Tools
   * Erlang/OTP
   * Win32 Compiler/Linker (such as Visual C++, required for step 2/3)
   * make tool (such as nmake from MS, optional for step 2/3)

To make things FREE, we can use GNU GCC, GNU gmake, but I have not tested
yet.

Step 1. Prepare ICU/OpenSSL

Before move to step 2, downloading the latest ICU4C and OpenSSL from
following sites respectively.

http://www.icu-project.org
http://www.openssl.org

Step 2. Prepare JS Engine

CouchDB can use multiple scripts to "map" a function to documents in a
database. For now, a JavaScript engine is required.

Theoretically, any JavaScript engine can be used by CouchDB if it can be
bridged into Erlang. But there are not many engines avaliable all over the
world. If you have one, and it can be used as a "port" by Erlang, then this
step is already done to you. If you donot have, which is more likely to
happen, please download Mozilla SpiderMonkey engine's source code under
MPL/GPL/LGPL tri-license from the URL below, and build it following the
instructions, besides its shell. By doing this, we get js32.dll and
jsshell.exe.

http://developer.mozilla.org/en/docs/SpiderMonkey_Build_Documentation

Note: couch_js.c in CouchDB is actually another shell for SpiderMonkey JS
engine. It's up to you to choose the default shell or this one.

To make description easier, let's assume:
   * Erlang/OTP is installed in:   E:\Program Files\erl5.6.3
   * CouchDB is extracted into:    E:\Program Files\erl5.6.3\lib\couchdb-0.8.0
   * Create directory:             E:\Program Files\erl5.6.3\lib\mochiweb-0.01\ebin

Step 3. Build couch_erl_driver

>>From now on, we will go into CouchDB's source code.

couch_erl_driver.c is a link-in port for Erlang, providing ICU features to
CouchDB. The simplist way to build this DLL is to create a Win32 DLL
project in an IDE, add couch_erl_driver.c into the project, and change
project settings to include Erlang ERTS' and ICU4C's header file path.

Rename the DLL to couch_erl_driver.dll if you like.

Step 4. Build CouchDB & HTTP Server

Create a file named "Emakefile" in E:\Program Files\erl5.6.3\lib\couchdb-0.8.0\src. Its content is:

{{{
{'./couchdb/*', [{outdir,"../ebin"}]}.
{'./mochiweb/*', [{outdir,"../../mochiweb-0.01/ebin"}]}.
}}}

Open erl (or werl), type following command to change directory:

{{{
cd("E:/Program Files/erl5.6.3/lib/couchdb-0.8.0/src").
}}}
Then type this simple command to make CouchDB.

{{{
make:all().
}}}

Step 5. Configure CouchDB

In "E:\Program Files\erl5.6.3\lib\couchdb-0.8.0\etc\couchdb", you can see couch.ini.tpl.in. Based on this template, let create couch.ini in E:\Program Files\erl5.6.3\bin.

{{{
; couch.ini

[Couch]

; A welcome string
ConsoleStartupMsg=Apache CouchDB is starting.

; Where do you want CouchDB to save databases?
; You can config this freely
DbRootDir= ... this is a secret directory ...

; CouchDB's HTTP server
Port=5984
BindAddress=127.0.0.1
DocumentRoot=E:\Program Files\erl5.6.3\lib\couchdb-0.8.0\share\www

; Where do you want CouchDB to log?
; You can config this freely, too.
LogFile= ... this is a secret file ...

; So, where is couch_erl_driver.dll?
UtilDriverDir=E:/Program Files/erl5.6.3/lib/couchdb-0.8.0/priv

; Which level of log do you need, info, debug, or something else?
LogLevel=info

[Couch Query Servers]

; This is the JS engine
; jsshell is the default shell for SpiderMonkey JS engine provided in its
source code.
; Special note: DO NOT try to include a path for jsshell.
javascript=jsshell -f "E:/Program Files/erl5.6.3/lib/couchdb-0.8.0/share/server/main.js"
}}}

Step 6. Get Ready to Relax

Have you finished downloading ICU4C and OpenSSL? If not, sorry, you have to
wait.

Install ICU4C and OpenSSL, if not:
   * Copy icu*.dll to E:\Program Files\erl5.6.3\erts-5.6.2\bin
   * Copy libeay32.dll E:\Program Files\erl5.6.3\erts-5.6.2\bin

Then,
   * Copy js32.dll and jsshell.exe to E:\Program Files\erl5.6.3\erts-5.6.2\bin
   * Copy couch_erl_driver.dll to E:/Program Files/erl5.6.3/lib/couchdb-0.8.0/priv

Finally, ensure that DbRootDir exists and LogFile can be created.

Step 7. Time to Relax

Open a new erl. Type:

couch_server:start().

Open http://localhost:5984, and time to relax.

Step 8. Time to Fix

Open http://localhost:5984/_utils/, and try to create a database, then
create some documents and enjoy.

If not so lucky, database's name is displayed wrongly. We need to fix it.
Open couch_server.erl, let's try to fix all_databases() function.

Let's leave it as homework.

After the homework is done, make:all() again and time to enjoy!