Local Dev Server with CouchDB 2.0 and NodeJS on RaspberryPi

During the last summer, I have tinkered around to build my own LocalDev Server with a Raspberry Pi. Since then some new software version emerged. For this reason, here is an updated version of my LocalDev Server config and installation scripts. A short overview, which software we will install during this article:

  • Couch DB 2.0 with the new Admin Interface Fauxton
  • NodeVersion Manager: Running various set of nodeJS runtimes
  • Node Process Manager pm2 for running several node apps in parallel
  • Nginx Webserver for delivering static files

I will start again with a clean Raspian Jessie Lite installation. Set up the standard configuration with the shell command:

Then configure your time zone, Keyboard, expand your File System, enable SSH, change the hostname to ‘localdev’, and assign some memory split from the graphic chip to the whole system. If you don’t know what I am talking about, please check this documentation.

After rebooting the system, you start updating all libraries and software tools:

Then we install git on our machine. That enables us to deploy directly from our source code repositories.

Now we are ready to start the real interesting stuff.


Installing NodeJS and NPM

If stumbled on a interesting article how to run different versions of node and npm on an Ubuntu system. The maintaining effort can be reduced by tools like the Node Version Manager (NVM). Luckily, it is pretty straightforward to install on a Raspberry Pi. Let’s start:

I highly recommend installing an additional process manager for NodeJS. It enables to run several node apps simultaneously. In my case it is pm2.

Next step is running a persistent data storage. In my case it is the NoSQL database Couch DB Version 2.0.


Installing Couch DB 2.0 on Raspberry Pi

The new version of Couch DB is able to run in a cluster mode. That means you can connect several Raspberry PIs to one big Couch DB Server. However, I think that is for the most cases a little bit too much. The new admin interface Fauxton is really cool. It makes everything much more intuitive. I think Couch DB makes it very easy to support distributed software in an offline and online mode. Furthermore it allows a stable (redundant) backup procedure through its replications feature. Most of this installation script is based on the tutorial by Andy Felong and his readers comments.



Now you have to download the source code from the CouchDB homepage (or directly from the mirror page). In my case it was like this:

Edit the chttp section and change this line to enable remote access from your local IP address.

Save and Exit your editor. Then we start the first time our CouchDB 2.0 server. Back to the terminal:

Now, you must switch to your browser. We call the Fauxton Admin Interface via that URL:


You should see the classic Fauxton Interface as described by Andy Felong. If you can see it, then please click the green button ‘Verify‘ > ‘Verify Installation‘. Please have a look on the screenshots by Andy Felong.

For some administration eye candy stuff, we will create a couchdb systemd service for our Raspberry Pi system. That services starts the CouchDB server after every reboot. Back to the terminal:


Add this service code to our file


Save and Exit file. After the creation of the file, we have to enable it. That works with these commands:

After the restart, please check if the Couch DB 2.0 service was executed properly. If everything runs smoothly, please go ahead with the last step of this article or check these nice CouchDB tutorials (Part 2).


 Installing your nginx webserver

The Raspberry Pi is pretty limited in hardware resources. Luckily, nginx is more lightweight than the famous Apache Webserver and allows a wide range of configurations. It works pretty well together with NodeJS and Websockets. That is the reason why I have chosen it instead another great lightweight webserver tool lighttpd. Unfortunately, the ‘apt-get install nginx’ command only delivers the version 1.6 instead the current version 1.10. Therefore, I recommend to compiling it. Ok enough, chitchat… Let’s start:

Again some eye candy stuff for administrators. We will create an extra user for nginx and a new service. After our configuration, the nginx webserver will start after every reboot (similar to the previous Couch DB service).


Please, type in the source code from underneath. The code of this service is based on the nginx documentation and this tutorial by luxagraf.


Save and Exit your editor. The next step is to register and enable the service file. Back to the terminal:

Now we have to configure our nginx sever a little bit. We link nginx with our www folder, which serves our static files.

Again edit and adapt the configuration file:

Save and exit the file. Now we have to create a placeholder index.html file.

Again edit and adapt the configuration file:

Add the source code to the file. I know it is not valid html, but for testing if the server works, it is enough.

Save and Exit the editor. Now restart the server:

Now switch back your browser and navigate to the URL http://your-ip-address:80/. Then you should see the ‘Hello World!’ headline.



We have installed a few cool tools for tinkering around with NodeJS and CouchDB. Even more, this environment is useful for your first steps with Express, Hoodie, PouchDB, NodeJS in combination with IoT, MQTT, and other cool stuff.

Please consider one very importan thing!!! Don’t connect this server to the internet. It is not a safe production environment. It is only recommend to use it within your local/private network. How to run your Raspberry Pi for public access is beyond that article. Please check this article by Pestmeester.

What will be next?! I plan to provide an iso image file of this tutorial. So that everyone can start as fast as possible with this setup. Afterwards I would like to add some more tools. In that context it could be MariaDB, Docker (even it might too much for a Raspberry Pi environment), Node-RED, Johnny-Five, etc.

*** Update: An Image file for this tutorial can be downloaded here ***

Share Post :

More Posts


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.