DebianDebian Based

How To Install CockroachDB on Debian 12

Install CockroachDB on Debian 12

In this tutorial, we will show you how to install CockroachDB on Debian 12. CockroachDB is a distributed SQL database that is designed for cloud applications, offering high availability, fault tolerance, and strong consistency. It is an excellent choice for developers looking for a scalable and resilient database solution.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of CockroachDB on a Debian 12 (Bookworm).


  • A server running one of the following operating systems: Debian 12 (Bookworm).
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for CockroachDB.
  • A user account with sudo privileges to execute administrative commands.

Install CockroachDB on Debian 12 Bookworm

Step 1. Keeping your system up to date is crucial for security and performance. Begin by updating your package list and upgrading existing packages:

sudo apt update
sudo apt upgrade

Next, install the required dependencies. curl is used for downloading files from the internet, and tar is for extracting compressed files:

sudo apt install curl tar

Step 2. Installing CockroachDB on Debian 12.

Download the latest version of the CockroachDB binary for Linux. As of the last update, the command below is an example; always check the official CockroachDB documentation for the latest version:

curl -output cockroach-v23.2.0.linux-amd64.tgz

Extract the downloaded archive:

tar -xzf cockroach-v23.2.0.linux-amd64.tgz

Move the CockroachDB binary to a directory within your PATH for easy execution:

sudo cp -i cockroach-v23.2.0.linux-amd64/cockroach /usr/local/bin/

Check the installed version of CockroachDB to verify the installation:

cockroach version

Step 3. Start CockroachDB.

 Initialize and start a single-node CockroachDB cluster in insecure mode, suitable for development:

cockroach start-single-node --insecure --listen-addr=localhost:26257 --http-addr=localhost:8080 --background
  • --insecure: Starts the node in insecure mode. For development purposes only. Secure mode is recommended for production.
  • --listen-addr: Specifies the address for listening to SQL client connections.
  • --http-addr: Specifies the address for the web UI.
  • --background: Runs the process in the background.

Step 4. Access CockroachDB.

Access the SQL shell using the following command:

cockroach sql --insecure --host=localhost:26257

You can also access the CockroachDB Web UI visit http://your-IP-address:8080 in your web browser to access the CockroachDB Web UI, where you can monitor cluster health and performance.

Install CockroachDB on Debian 12 Bookworm

Step 5. Create a Database and Table (Optional).

Inside the SQL shell, you can create a new database and table:

USE mydb;

Congratulations! You have successfully installed CockroachDB. Thanks for using this tutorial to install the latest version of the CockroachDB on Debian 12 Bookworm. For additional help or useful information, we recommend you check the official CockroachDB website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button