Skip to main content

Overview

CockroachDB can be installed in multiple ways depending on your environment and requirements. This guide covers all installation methods from development to production deployments.

Pre-built Binary

Fastest way to get started - download and run

Docker

Containerized deployment for any environment

Kubernetes

Cloud-native orchestrated deployment

Build from Source

Compile CockroachDB yourself for customization

Installation Methods

Download Pre-built Executable

The simplest installation method - download the binary for your platform:
1

Download for Your Platform

curl https://binaries.cockroachdb.com/cockroach-latest.darwin-10.9-amd64.tgz | tar -xz
sudo cp -i cockroach-latest.darwin-10.9-amd64/cockroach /usr/local/bin/
2

Verify Installation

cockroach version
Expected output:
Build Tag:        v24.3.0
Build Time:       2024/11/18 18:00:00
Distribution:     CCL
Platform:         darwin amd64 (x86_64-apple-darwin)
Go Version:       go1.22.0
3

Install GEOS Library (Optional)

For spatial operations, install the GEOS library:
brew install geos
The binary includes all necessary components. Just download, extract, and run!

Post-Installation Setup

Directory Structure

CockroachDB stores data in the following structure:
cockroach-data/
├── auxiliary/         # Auxiliary files
├── logs/             # Log files
├── temp-dirs-record/ # Temporary directory tracking
└── 000001.sst        # RocksDB storage files

Storage Requirements

Plan for adequate storage:
  • Development: 10-20GB minimum
  • Production: Depends on dataset size
  • Recommendation: 3x replication factor means 3x raw data size
  • Best practice: Keep 20-30% free disk space
CockroachDB will refuse to write data when disk space falls below 10% to prevent corruption.

Security Setup

For production, always use secure mode with certificates:
1

Create CA Certificate

mkdir certs my-safe-directory
cockroach cert create-ca \
  --certs-dir=certs \
  --ca-key=my-safe-directory/ca.key
2

Create Node Certificates

cockroach cert create-node \
  localhost \
  $(hostname) \
  --certs-dir=certs \
  --ca-key=my-safe-directory/ca.key
3

Create Client Certificates

cockroach cert create-client \
  root \
  --certs-dir=certs \
  --ca-key=my-safe-directory/ca.key
4

Start in Secure Mode

cockroach start \
  --certs-dir=certs \
  --advertise-addr=localhost:26257 \
  --http-addr=localhost:8080 \
  --join=localhost:26257

Deployment Options

CockroachCloud

Fully managed CockroachDB - let us run it for you

Manual Deployment

Deploy on your own infrastructure with full control

Cloud Platforms

Deploy on AWS, GCP, Azure, or other cloud providers

Orchestration

Use Kubernetes, Terraform, or other orchestration tools

Verification Steps

After installation, verify everything works:
# Check version
cockroach version

# Start a test cluster
cockroach start-single-node --insecure --background

# Run SQL commands
cockroach sql --insecure -e "SELECT 1;"

# Check cluster status
cockroach node status --insecure

# Stop the test cluster
cockroach quit --insecure

Next Steps

Quick Start

Run your first queries and explore CockroachDB features

Production Checklist

Configure CockroachDB for production workloads

Client Drivers

Connect your application with PostgreSQL-compatible drivers

Cluster Topology

Design your cluster topology for optimal performance

Troubleshooting

Increase available RAM or build with reduced parallelism:
./dev build cockroach -- --local_ram_resources=2048
Ensure proper permissions for installation:
sudo chown -R $(whoami) /usr/local/bin/cockroach
Find and stop processes using ports 26257 or 8080:
# Find process
lsof -i :26257

# Kill process
kill -9 <PID>
Verify certificates are in the correct location and have proper permissions:
ls -la certs/
cockroach cert list --certs-dir=certs

Build docs developers (and LLMs) love