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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s