Prerequisites
On Linux, install the required packages with the package manager of your distribution.
Ubuntu and Debian
CLI Client
On Ubuntu and Debian (and also MX Linux, Linux Mint, etc.), the requirements for building the DuckDB CLI client are the following:
sudo apt-get update
sudo apt-get install -y git g++ cmake ninja-build libssl-dev libcurl4-openssl-dev
git clone https://github.com/duckdb/duckdb
cd duckdb
GEN=ninja make
Fedora, CentOS and Red Hat
CLI Client
The requirements for building the DuckDB CLI client on Fedora, CentOS, Red Hat, AlmaLinux, Rocky Linux, etc. are the following:
sudo yum install -y git g++ cmake ninja-build openssl-devel
git clone https://github.com/duckdb/duckdb
cd duckdb
GEN=ninja make
Note that on older Red Hat-based distributions, you may have to change the package name for g++ to gcc-c++,
skip Ninja and manually configure the number of Make jobs:
sudo yum install -y git gcc-c++ cmake openssl-devel
git clone https://github.com/duckdb/duckdb
cd duckdb
mkdir build
cd build
cmake ..
make -j`nproc`
Arch Linux
The following instructions are intended for Arch Linux and Arch-based distributions (e.g., Manjaro, Omarchy).
CLI Client
DuckDB is available in Arch's Extra package repository. To install it, run:
sudo pacman -S duckdb
The requirements for building the DuckDB CLI client on Arch, Manjaro, etc. are the following:
sudo pacman -S git gcc cmake ninja openssl
git clone https://github.com/duckdb/duckdb
cd duckdb
GEN=ninja make
Alpine Linux
CLI Client
The requirements for building the DuckDB CLI client on Alpine Linux are the following:
apk add g++ git make cmake ninja
git clone https://github.com/duckdb/duckdb
cd duckdb
GEN=ninja make
Performance with musl libc
Note that Alpine Linux uses musl libc as its C standard library. DuckDB binaries built with musl libc have lower performance compared to the glibc variants: for some workloads, the slowdown can be more than 5×. Therefore, it's recommended to use glibc for performance-oriented workloads.
Distribution for the linux_*_musl Platforms
Starting with DuckDB 1.2.0, DuckDB extensions are distributed for the linux_amd64_musl platform, and starting with DuckDB 1.5.0 also for the linux_arm64_musl platform.
Since DuckDB 1.5.0, official CLI binaries and libraries are also distributed for both musl platforms (e.g., duckdb-cli-linux-amd64-musl.tar.gz on the GitHub release page). You can also build DuckDB with musl libc manually following the instructions on this page.
Python Client on Alpine Linux
Currently, installing the DuckDB Python on Alpine Linux requires compilation from source.
To do so, install the required packages before running pip:
apk add g++ py3-pip python3-dev
pip install duckdb
Using the DuckDB CLI Client on Linux
Once the build finishes successfully, you can find the duckdb binary in the build directory:
build/release/duckdb
For different build configurations (debug, relassert, etc.), please consult the “Build Configurations” page.
Building Extensions
To build extensions, set the BUILD_EXTENSIONS flag to the list of extensions that you want to be built. For example:
BUILD_EXTENSIONS='autocomplete;httpfs;icu;json;tpch' GEN=ninja make
Troubleshooting
R Package on Linux AArch64: too many GOT entries Build Error
Problem: Building the R package on Linux running on an ARM64 architecture (AArch64) may result in the following error message:
/usr/bin/ld: /usr/include/c++/10/bits/basic_string.tcc:206:
warning: too many GOT entries for -fpic, please recompile with -fPIC
Solution:
Create or edit the ~/.R/Makevars file. This example also contains the MAKEFLAGS setting to parallelize the build:
ALL_CXXFLAGS = $(PKG_CXXFLAGS) -fPIC $(SHLIB_CXXFLAGS) $(CXXFLAGS)
MAKEFLAGS = -j$(nproc)
Building the httpfs Extension Fails
Problem:
When building the httpfs extension on Linux, the build may fail with the following error.
CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_CRYPTO_LIBRARY
OPENSSL_INCLUDE_DIR)
Solution:
Install the libssl-dev library.
sudo apt-get install -y libssl-dev
Then, build with:
GEN=ninja BUILD_EXTENSIONS="httpfs" make