Installing the Couch(DB)May 30, 2009
In my previous post, I talked about some introductory topics regarding CouchDB. In this post I want to walk you through some of the hurdles you need to take when you want to install CouchDB on a freshly installed Ubuntu Linux 9.0.4. Now I don't want to claim that there isn't a simpler way for getting CouchDB up and running, which probably should be the case. I just want to put out everything I had to deal with when I tried installing the trunk version (V9.0) of CouchDB. I didn't install the pre-packaged version (V8.02) as that would be too easy :-). Here goes ...
1. Prepare your environment:
$ sudo aptitude install automake autoconf libtool subversion-tools help2man spidermonkey-bin build-essentialerlang erlang-manpages libicu38 libicu-dev libreadline5-dev checkinstall libmozjs-dev wget
$ sudo apt-get install libcurl4-gnutls-dev
2. Create a new user for running CouchDB:
$ sudo adduser –no-create-home –disabled-password –disabled-login couchdb
3. Get the latest source code from the trunk:
$ svn co http://svn.apache.org/repos/asf/couchdb/trunk couchdb
4. Build and install:
$ ./configure –bindir=/usr/bin –sbindir=/usr/sbin –localstatedir=/var –sysconfdir=/etc
$ make && sudo make install
5. Make the CouchDB user, that was created in step 2, the owner of the installed binaries:
$ sudo chown couchdb:couchdb -R /var/lib/couchdb /var/log/couchdb
6. Now we're all set to launch the CouchDB server:
$ sudo -i -u couchdb couchdb
If everything goes well, you should see something similar as the following output:
sudo: unable to change directory to /home/couchdb: No such file or directory
Apache CouchDB 0.10.0a780291 (LogLevel=info) is starting.
Apache CouchDB has started. Time to relax.
[info] [<0.1.0>] Apache CouchDB has started.
7. In order to verify that CouchDB is up and running, you can install cURL and issue the following command:
$ sudo apt-get install curl
$ curl http://localhost:5984
This should give you the following response:
8. [Optional] Register CouchDB as a service:
$ sudo update-rc.d couchdb defaults
$ sudo /etc/init.d/couchdb start
So far in our setup, we can only access CouchDB from the local Linux (virtual) machine. My personal goal was to access CouchDB from a sample application that I'm developing on another Windows virtual machine that hosts my development environment. In order to accomplish that, some additional steps need to be taken:
1. Open the correct port on the firewall when enabled. You can do this by issuing the following:
$ sudo iptables -I INPUT 3 -p tcp –dport 5984 -j ACCEPT
2. Go to the local.ini file in the /etc/couchdb/ directory and uncomment the line that specifies the bind_address setting (in the httpd section) by removing the semicolon in front of it (figuring out this one kept me busy for quite some time ;-) ).
3. Change the bind_address setting so that it now specifies 0.0.0.0 instead of 127.0.0.0. After restarting CouchDB, it will now bind to all addresses.
4. We're done.
As I mentioned before, I'm quite a Linux rookie so it was definitely a challenge figuring this out.
Now I need some relaxation. Till next time.
If you and your team want to learn more about how to write maintainable unit tests and get the most out of TDD practices, make sure to have look at our trainings and workshops or checkout the books section. Feel free to reach out at firstname.lastname@example.org.
Jan Van Ryswyck
Thank you for visiting my blog. I’m a professional software developer since Y2K. A blogger since Y2K+5. Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Past organizer of the European Virtual ALT.NET meetings. Thinking and learning about all kinds of technologies since forever.
- Behavior-Driven Development
- Concurrent Programming
- Continuous Integration
- Core Skills
- Design Patterns
- Domain-Driven Design
- Event Sourcing
- Fluent Interfaces
- Functional Programming
- Object-Relational Mapping
- Open Source
- Software Design
- Test-Driven Development
- Visual Studio
The opinions expressed on this blog are my own personal opinions. These do NOT represent anyone else’s view on the world in any way whatsoever.
Thank you for visiting my website. I’m a professional software developer since Y2K. A blogger since Y2K+5. Author of written words. Provider of training and coaching in XP practices. Curator of the Awesome Talks list. Past organizer of the European Virtual ALT.NET meetings. Thinking and learning about all kinds of technologies since forever.