Install Couchbase Server on Ubuntu 22.04/Ubuntu 20.04

|
Last Updated:
|
|

In this tutorial, you will learn how to install Couchbase Server on Ubuntu 22.04/Ubuntu 20.04. According to the documentation, Couchbase Server is an open source, distributed, JSON document database. It exposes a scale-out, key-value store with managed cache for sub-millisecond data operations, purpose-built indexers for efficient queries, and a powerful query engine for executing SQL-like queries.

Install Couchbase Server on Ubuntu 22.04/Ubuntu 20.04

Couchbase is available in different editions; Enterprise, Community and Couchbase Capella.

This guide is about how to install the community edition couch base server.

System Requirements

Before you can proceed to install Couchbase Server on Ubuntu, there are some few requirements needed;


cat > /etc/systemd/system/disable_thp.service << 'EOL'
[Unit]
Description=Disable Kernel Support for Transparent Huge Pages (THP)

[Service]
Type=simple
ExecStart=/bin/sh -c "echo 'never' > /sys/kernel/mm/transparent_hugepage/enabled && echo 'never' > /sys/kernel/mm/transparent_hugepage/defrag"

[Install]
WantedBy=multi-user.target
EOL
systemctl daemon-reload
systemctl enable --now disable_thp
  • Disable Swapiness
echo 'vm.swappiness=0' > /etc/sysctl.conf
sysctl -p

There are two ways in which you can install Couchbase server;

  1. Install using APT via Couchbase repositories
  2. Install using DEB Binary Package

Install Couchbase Server on Ubuntu using APT via Couchbase repositories

On Ubuntu 20.04;

  • To install Install Couchbase Server on Ubuntu via APT, you first need to install Couchbase repositories;
wget https://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-amd64.deb
apt install ./couchbase-release-1.0-amd64.deb
  • Next, run system package cache update;
apt update
  • Install Couchbase server on Ubuntu 20.04
apt install couchbase-server-community

On Ubuntu 22.04;

  • Currently, Ubuntu 22.04 is not supported, as of this writing. Thus, we will use Ubuntu 20.04 Repos instead!
  • Therefore, install Ubuntu 20.04 Couchbase repos on Ubuntu 22.04;
echo 'deb [ arch=amd64 ] http://packages.couchbase.com/releases/couchbase-server/community/deb/ focal focal/main' \
> /etc/apt/sources.list.d/couchbase.list
  • Install repository signing key;
wget -qO- http://packages.couchbase.com/ubuntu/couchbase.key | gpg --dearmor > /etc/apt/trusted.gpg.d/couchbase.gpg
  • Run system update;
apt update
  • Install Couchbase on Ubuntu 22.04
apt install couchbase-server-community

Sample installation output;

Preparing to unpack .../couchbase-server-community_7.0.2-ubuntu20.04_amd64.deb ...
Minimum RAM required  : 4 GB
System RAM configured : 1.94 GB

Minimum number of processors required : 4 cores
Number of processors on the system    : 2 cores
Unpacking couchbase-server-community (7.0.2-6703-1) ...
Setting up couchbase-server-community (7.0.2-6703-1) ...

You have successfully installed Couchbase Server.
Please browse to http://couchbase.kifarunix-demo.com:8091/ to configure your server.
Refer to https://docs.couchbase.com for additional resources.

Please note that you have to update your firewall configuration to
allow external connections to a number of network ports for full
operation. Refer to the documentation for the current list:
https://docs.couchbase.com/server/7.0/install/install-ports.html

By using this software you agree to the End User License Agreement.
See /opt/couchbase/LICENSE.txt.

Created symlink /etc/systemd/system/multi-user.target.wants/couchbase-server.service → /lib/systemd/system/couchbase-server.service.

Install using DEB Binary Package

To install Couchbase Server on Ubuntu via DEB binary package, navigate to the Couchbase downloads page and select the appropriate package of Couchbase Server to install and grab the link for the DEB binary package.

For example, the command below downloads version 7.0.2 of Couchbase server for Ubuntu 20.04;

wget https://packages.couchbase.com/releases/7.0.2/couchbase-server-community_7.0.2-ubuntu20.04_amd64.deb

Next, run the command to install Couchbase server on Ubuntu 20.04/Ubuntu 22.04. Note that currently, as of this writing, there is no binary for Ubuntu 22.04, but the binary for Ubuntu 20.04 should still work.

apt install ./couchbase-server-community_7.0.2-ubuntu20.04_amd64.deb

Open Couchbase Ports on Firewall

Couchbase server uses various TCP ports for network communication. If you are running a system level or edge firewall, be sure to open these ports where necessary.

ufw allow to any port 369,8091:8094,9100:9105,9998,9999,11209:11211,11214,11215,18091:18093,21100:21299 proto tcp comment "Couchbase TCP ports"

Access the Couchbase Web Console

You can now access your Couchbase web console via the url http://server-IP-or-domain-name:8091.

Upon accessing the url, you will be promted to either join an existing Couchbase cluster or create a new cluster.

install Couchbase Server on Ubuntu 22.04/Ubuntu 20.04

In my setup, I don’t have an existing cluster. Hence, I will create a new one. Hence, enter the name of the cluster, admin username and password.

install Couchbase Server on Ubuntu 22.04/Ubuntu 20.04

Next, accept the EULA and choose whether to setup disk, ram and services or finish with defaults. We choose finish with defaults in this setup.

Sample Couchbase server dashboard;

couchbase servers

And there you go. You have learnt how to install Couchbase Server on Ubuntu 22.04/Ubuntu 20.04.

Further Reading

Next Couchbase Cluster Setup Steps

Other Tutorials

Easily Integrate Linux Malware Detect with ClamAV

Install and Setup Teleport Access Plane on Linux