Skip to main content

Get CKB Binary

CKB binary is used to run CKB node or CKB dev blockchain for development,testing and so on.You can get CKB binary by two ways: build from source or download from releases.

We have setup CI to ensure CKB works in following systems, they are also the recommended system to run CKB.

OSArch
Ubuntu 18.04x64
macOSx64
Windowsx64

CKB should also work on any modern Linux distributions. However, we limit our energy to focus on the support of following systems:

OSArch
Ubuntu 20.04x64
Debian Stretchx64
Arch Linuxx64
CentOS 7x64

You can also use docker if your operating system is not properly supported by CKB for now.

Build from Source

Tips: The details about how to build CKB on Windows can be found Build CKB on Windows.

Install Build Dependencies

CKB requires Rust to build. We recommend to install rustup to manage Rust versions.

The required Rust version is saved in the file rust-toolchain. If rustup is available, it will pick the right version automatically.

CKB also requires C++ toolchain and clang. It's recommended to:

  • use GCC 7.3.1 or newer as the default C/C++ toolchain,
  • and install LLVM 5.0.1 or newer.

You can use the following commands to install the dependencies:

  • Ubuntu and Debian
sudo apt-get install -y git gcc libc6-dev pkg-config libssl-dev libclang-dev clang
  • Arch Linux
sudo pacman -Sy git gcc pkgconf clang
  • macOS
brew install autoconf libtool
  • CentOS
sudo yum install -y centos-release-scl
sudo yum install -y git make gcc-c++ openssl-devel devtoolset-7 llvm-toolset-7

Start a shell enabling gcc-7 and clang

scl enable devtoolset-7 llvm-toolset-7 bash

Remember to run following commands in this console.

Add Environment Variables

If your OS contains pre-compiled snappy library, you may setup SNAPPY_LIB_DIR environment variable to point to a directory with this library. This will reduce compile time.

export SNAPPY_LIB_DIR=/usr/local/lib

Build from source

The master branch on Github repo is regularly built and tested, which is always the latest released version. The default checked out branch develop is the latest version in active development.

It is recommended to build from the masterbranch, or a historical version from GitHub Releases.

Also you can choose to clone the code via git:

# get ckb source code
git clone https://github.com/nervosnetwork/ckb.git
cd ckb
git checkout master

You can also switch to a historical version and build, for example, check out v0.43.2.

git checkout -b branch-v0.43.2 v0.43.2

Run make prod inside the source code directory. It will build the executable target/release/ckb. Please add the directory to PATH or copy/link the file into a directory already in the PATH.

export PATH="$(pwd)/target/release:$PATH"
# or
# ln -snf "$(pwd)/target/release/ckb" /usr/local/bin/ckb

Download from Releases

We publish binaries for each release via Github Releases. You can download the package directly.

If you are CentOS user, please use the x86_64-unknown-centos-gnu package, which also requires OpenSSL 1.0:

sudo yum install openssl-libs