
How To Install CouchDB From Source on Ubuntu 24.04
CouchDB is a powerful NoSQL database that allows you to store and manage your data in a document-oriented format. If you want to customize your CouchDB installation or experiment with the latest features, compiling it from source is a great option. In this blog post, we will guide you through the process of installing CouchDB from source on Ubuntu 24.04.
Prerequisites
Before we begin, ensure you have the following prerequisites:
- Ubuntu 24.04 installed on your system.
- Basic knowledge of the terminal and command-line interface.
- Git installed on your system (if not, you can install it using
sudo apt install git
).
Step 1: Update Your System
Start by updating your package list and upgrading your installed packages to the latest versions:
sudo apt update
sudo apt upgrade -y
Step 2: Install Dependencies
CouchDB requires several dependencies to build from source. Use the following command to install the necessary packages:
sudo apt install -y build-essential libcurl4-openssl-dev libicu-dev libmozjs-52-dev libtool autoconf automake pkg-config erlang libssl-dev
Additional Dependencies for CouchDB
In addition to the above packages, we will also need to install git
, python3
, and nodejs
:
sudo apt install -y git python3 nodejs npm
Step 3: Download CouchDB Source Code
Now that you have all the necessary dependencies, it’s time to download the CouchDB source code. Navigate to your preferred directory and clone the CouchDB repository:
cd ~
git clone https://github.com/apache/couchdb.git
After cloning the repository, switch to the latest stable version (replace x.x.x
with the latest version number):
cd couchdb
git checkout tags/x.x.x
Step 4: Build CouchDB
Now that you have the source code, you can start the build process. First, you need to configure the build:
./configure
If the configuration completes successfully, you can compile the source code by running:
make
This process may take some time, so be patient. Once the compilation is complete, you can install CouchDB by executing:
sudo make install
Step 5: Configure CouchDB
After the installation is complete, you need to configure CouchDB to run. Open the local.ini
configuration file:
sudo nano /usr/local/etc/couchdb/local.ini
In this file, you can set the admin username and password by modifying the following lines:
[chttpd]
port = 5984
[admins]
admin = your_password_here
Make sure to replace your_password_here
with a strong password.
Step 6: Start CouchDB
Now it’s time to start CouchDB. You can do this by running:
sudo couchdb
To check if CouchDB is running, open your web browser and navigate to http://127.0.0.1:5984/_utils/
. You should see the CouchDB dashboard.
Step 7: Enable CouchDB to Start on Boot
If you want CouchDB to start automatically when your system boots, you can create a systemd service file. Create a new file for CouchDB:
sudo nano /etc/systemd/system/couchdb.service
Add the following content to the file:
[Unit]
Description=CouchDB
After=network.target
[Service]
Type=simple
User=your_username
ExecStart=/usr/local/bin/couchdb
Restart=on-failure
[Install]
WantedBy=multi-user.target
Make sure to replace your_username
with your actual username.
Now enable and start the CouchDB service:
sudo systemctl enable couchdb
sudo systemctl start couchdb
Conclusion
Congratulations! You have successfully installed CouchDB from source on Ubuntu 24.04. You can now start using CouchDB to store and manage your documents.
For further exploration, consider checking out the official CouchDB documentation for more advanced configurations and features.
Happy coding!