How to Install Apache CouchDB on Ubuntu 24.04

CouchDB is a database that doesn’t rely on tables like traditional databases. It is also known as NoSQL. It is designed to handle database changes very easily. CouchDB is written in Erlang, a programming language known for handling many tasks at once and recovering the database from any type of error. This helps CouchDB keep running the databases smoothly even when there is an unexpected surge in requests or performance issues.

Instead of complex queries, CouchDB interacts with databases using a familiar web protocol (HTTP) and data format (JSON). This makes it easy to use with Web and mobile applications.

This brief article will help you get the CouchDB on Ubuntu 24.04 and set it up after installation.

Table of Contents

How to Install Apache CouchDB on Ubuntu 24.04

To install Apache CouchDB, usually, the method that is used is by adding its repository in the Ubuntu system. But as of May 2024, the Apache CouchDB repository is not available for Ubuntu 24.04, so we will install it using the Snap store.

Let’s check the complete installation steps of CouchDB installation.

1. Updating Your System

Before we proceed with CouchDB installation on Ubuntu 24.04, first update Ubuntu system packages. 

sudo apt update

This command will help you update your Ubuntu 24.04 outdated packages and let you manage the CouchDB package easily.

2. Installing CouchDB Using Snap

To install Apache CouchDB on Ubuntu 24.04 you can use the Snap package manager. 

sudo snap install couchdb

After the installation, you need to set up an admin password and a cookie for your CouchDB instance. You can do this using the snap set command as shown below:

sudo snap set couchdb admin=[your-password] setcookie=[your-cookie]

Replace [your-password] and [your-cookie] with your desired admin password and cookie.

Finally, restart the CouchDB snap for the changes to take effect:

sudo snap restart couchdb

Your CouchDB installation will now be up and running.

Remember, the CouchDB files will be installed in a read-only directory at /snap/couchdb/current/, while the data files will be written to /var/snap/couchdb/common/data, and the writable configuration files will be stored in /var/snap/couchdb/current/etc.

For additional setup steps, such as configuring a single node or clustered installation, you should refer to the official Apache CouchDB documentation.

Configuration Steps for CouchDB Installation Using APT

In future when the Apache CouchDB repository is available for Ubuntu 24.04, and you install the Apache CouchDB using its repository, then after the installation of CouchDB using the apt install command, you will be prompted to make different choices for your CouchDB server. You will be presented with two options, single-server or multi-server. If you’re running things solo on one machine, pick standalone.

Next, CouchDB will ask about its network connection. If this is just for development purposes and won’t be accessed by other devices, choose 127.0.0.1, which restricts access to the local machine. Otherwise, for more comprehensive network access, pick 0.0.0.0.

Lastly, you have to create a username and password for the administrator account.

3. Verifying the CouchDB Installation

After the CouchDB installation, verify it’s working. You can run this command to confirm if the CouchDB is working:

curl admin:[email protected]:5984curl http://127.0.0.1:5984/

If the CouchDB is up and running, you will see output similar to this.

4. Testing The CouchDB Web Interface

CouchDB comes with a built-in web interface called Fauxton. Fauxton provides a user-friendly way to interact with your CouchDB database through a web browser.

To access the CouchDB web interface, open the browser and run this http://127.0.0.1:5984/_utils/ URL.

After entering the URL, the interface below will open. Enter the Admin and Password we configured while installing CouchDB using Snap. The default username is admin. The password that you use is the one we set at the setcookie=[your-cookie] option.  

Once you hit Log In, you will see the interface below, and CouchDB will be ready to use.

To improve CouchDB’s security, open the configuration section and modify the require_valid_user setting within the couch_httpd_auth section. Change it from false to true. This will ensure that all requests come from authenticated users; anonymous requests will no longer be permitted.

Conclusion

CouchDB is a NoSQL open-source database written in Erlang. It uses key-value maps to store document fields. To install CouchDB on Ubuntu 24.04, use the Snap package manager. As of now, CouchDB support for Ubuntu 24.04 is not available, so alternatively, you can use the Snap package manager. Once CouchDB is installed, you can control it through its web interface called Fauxton.