Linux setup


As I said in the previous post (Setup), I have chosen a desktop distribution in order to save some time editing files but some configuration is still needed.

Set Static IP address

It’s nice but also bad that each time that you restart a computer you get a different IP address, specially if this is a server (or provide some sort of service) and then you need to configure the clients.

Since our Linux box is going to be in a separate machine, lets set a static IP address in order to easily find it.

  1. On you Mac go to /Library/Application Support/VMware Fusion/vmnet8and edit dhcp.conf adding at the end of the file the following lines:
    host couchdb64 {
        hardware ethernet 00:50:56:28:99:48
        fixed-address 172.16.221.21;
    }

    You get hardware ethernet from the settings of the Virtual Machine > Network > Advanced Options and then click on Generate.

  2. Go to System Setting > Network > Wired > Options >  IPv4 Settings and Edit Addresses
    Address: 172.16.221.21,
    Netmask: 255.255.255.0 
    Gateway: 172.16.221.2

Install CouchDB

We are going to do this from Ubuntu repositories (even that you might opt to go with a version downloaded from Apache CouchDB site but then you have to compile it by yourself following their instructions). This is pretty simple:

couchdb:~$ sudo apt-get install couchdb
Reading package lists... Done
Building dependency tree 
Reading state information... Done
The following extra packages will be installed:
 couchdb-bin erlang-base erlang-crypto erlang-inets erlang-mnesia
 erlang-public-key erlang-runtime-tools erlang-ssl erlang-syntax-tools
...
* Starting database server couchdb [ OK ] 
Setting up erlang-syntax-tools (1:14.b.4-dfsg-1ubuntu1) ...
Setting up libsctp1 (1.0.11+dfsg-2) ...
Setting up lksctp-tools (1.0.11+dfsg-2) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
couchdb:~$

Change CouchDB listening IP address/port

Now, the problem is that CouchDB is only listening at localhost (127.0.0.1) and we want to access from other machines so we need to change CouchDB IP/port.

Edit /etc/couchdb/local.ini file and look for the label [httpd] and there is bind_address  property that you should edit and change to 172.16.221.21 (your static IP address).

[httpd]
;port = 5984
bind_address = 172.16.221.21

You might also be willing to set bind_address to 0.0.0.0 for making CouchDB list to all network interfaces.

Restart CouchDB server:

couchdb:/etc/couchdb$ sudo service couchdb restart 
 * Restarting database server couchdb [ OK ] 
couchdb:/etc/couchdb$

Open your web browser in the Mac and try to access http://172.16.221.21:5984 and you should see {“couchdb”:”Welcome”,”version”:”1.0.1″} as response. If you open the URL http://172.16.221.21:5984/_utils/ then you get CouchDB futon.

Setup


I´m going to be using for this project an Apple MacBook Pro but actually most of the software used is available also for Linux and Windows platforms. So hopefully you are not going to have problems replicating the setup.

List of elements of the setup:

  • Application server: Apache Tomcat 7.0 on the MacBook Pro. Apache Tomcat is downloaded as binary from Apache site and just uncompressed in my project folder.
  • CouchDB Server: on an Ubuntu Desktop 12.04 LTS (64 bits) virtual machine running in the MacBook Pro using VmWare Fusion (I love VmWare products since many years and likely that VirtualBox, Parallels,… are as good but I’ve started with VmWare and they run well for what I need and typically I can afford their prices).
    Yes! One question about the Linux distribution that I’ve chosen… since this project is likely to keep me bussy for some time, I got the latest. And about “Desktop” and not “Server” because I don’t want to have to do some manual configuration as switching keyboard layout, configure IP address… and whenever I want to do some (serious) performance testing I will try to find another machine and then I will install server. Nevertheless, I do a lot of manual (console) operations specially for those that I use to do quite ofter (start services, install packages,…).
  • CouchDB is directly installed from Ubuntu repositories (sudo apt-get install couchdb).
  • Ubuntu machine uses NAT and fixed IP address just to make sure that each time I reboot it I can easily find it.
  • IDE: IntelliJ IDEA (sorry! I’m not an Eclipse follower just because I’ve started using Idea years ago and I’m not about to switch as far as I don’t have to and Idea offers me what I need).

This is basically about it… Hopefully pretty simple.