How to Install YugabyteDB: A Comprehensive Step-by-Step Guide
YugabyteDB is an open-source, high-performance distributed SQL database built for cloud-native applications. It combines the scalability of NoSQL with the familiarity and power of SQL, making it an attractive choice for modern developers and enterprises. This tutorial will guide you through the installation of YugabyteDB on your local machine or server so you can start exploring its features.
Prerequisites
- A system with a 64-bit OS (Linux, macOS, or Windows Subsystem for Linux recommended)
- Minimum 2 GB of RAM (4 GB or more recommended for production use)
- Docker installed (optional, if using Docker installation method)
- Basic familiarity with command line and terminal usage
- YugabyteDB Official site reference
Step 1: Choose Your Installation Method
You can install YugabyteDB via several methods including native package installation, Docker containers, or Kubernetes deployment. This guide covers the native installation for simplicity, and includes notes on Docker as an alternative.
Option A: Native Installation (Linux/macOS)
- Open your terminal.
- Download the latest YugabyteDB binary tarball from the official downloads page.
- Extract the downloaded archive:
tar -xzf yugabyte-x.x.x.x-linux.tar.gz - Navigate into the extracted folder:
cd yugabyte-x.x.x.x - Run the install script to initialize YugabyteDB:
./bin/yugabyted startThis command starts a local single-node cluster that runs YugabyteDB server locally.
- To stop YugabyteDB, you can run
./bin/yugabyted stop.
wget https://downloads.yugabyte.com/yugabyte-x.x.x.x-linux.tar.gz
Option B: Installation via Docker
- Ensure Docker is installed and running on your system.
- Run the following command to start a local YugabyteDB cluster container:
docker run -d --name yb-master -p 7000:7000 yugabytedb/yugabyte:latest bin/yugabyted start --master_flags="rpc_bind_addresses=0.0.0.0:7100" --tserver_flags="rpc_bind_addresses=0.0.0.0:9100" - You can access the YugabyteDB Admin UI at
http://localhost:7000. - Stop and remove the container using:
docker stop yb-master && docker rm yb-master
Step 2: Accessing YugabyteDB
Once YugabyteDB is running, you can interact with it using YSQL (PostgreSQL-compatible) or YCQL (Cassandra-compatible) APIs.
- To connect via YSQL CLI, run:
./bin/ysqlsh - For YCQL CLI:
./bin/ycqlsh
From here, you can manage your databases, create tables, and start executing queries.
Troubleshooting Common Issues
- Port conflicts: Make sure ports 7000, 7100, 9000, and 9100 are free. Stop services using these ports or configure YugabyteDB to use different ports.
- Permissions: Run installation commands with sufficient privileges, especially if installing to system directories.
- Firewall restrictions: Allow YugabyteDB traffic through your firewall if running on a networked server.
- Docker issues: Verify Docker service is running and you have the correct permissions to run containers.
Summary Checklist
- Download YugabyteDB from the official site.
- Extract and start YugabyteDB using native binaries or Docker.
- Connect to YugabyteDB using YSQL or YCQL CLI.
- Verify no port conflicts or permission issues exist.
- Consult official YugabyteDB documentation for advanced setups.
For more database installation tutorials, you may find our How to Use CockroachDB: A Complete Tutorial extremely useful as it covers a somewhat similar distributed SQL database system.
With your YugabyteDB setup complete, you can now explore scaling, replicating, and running complex distributed queries for cloud-native and high-availability applications.
