To install Horizon, you have a few choices. You can…
The first method is recommended: not only do you ensure OS compatibility and dependency management, you’ll also install some convenient wrappers that make running Horizon and Stellar Core much simpler.
SDF publishes new releases to its custom Ubuntu repositories. Follow this guide to add the stable SDF repository to your system. Then,
sudo apt update && sudo apt install stellar-core stellar-horizon
This page outlines the various commands that these packages make available.
Should you decide not to use one of our prebuilt releases, you may instead build Horizon from source. To do so, you need to prepare a developer environment, including:
(Though Horizon can run on Windows, building directly on Windows is not supported.)
At this point, you can easily build the Horizon binary:
git clone https://github.com/stellar/go monorepo && cd monorepo go install -v ./services/horizon
(You should refer to the list of Horizon releases and
git checkout accordingly before building if you’re looking for a stable release rather than the bleeding edge
At this point, you can either add Go binaries to your PATH in your
.bashrc (or equivalent), or copy the binary from the
GOPATH to the system PATH (as we’ll do later:
export PATH=$(go env GOPATH)/bin:$PATH
If you want to run Captive Core instances (for transaction ingestion) separately from other Horizon instances, the architecture supports that. This allows flexibility in scaling and redundancy. For example, you may want to have your ingesting Horizon instances have dedicated Captive Cores, while request-serving instances all use the same Remote Captive Core for transaction submission. Or, perhaps you want a dedicated Remote Captive Core for ingestion living on more-powerful hardware.
If you are interested in this approach, you’ll need some additional binaries on that machine.
After setting up repositories as described above, you’ll need to install the following packages on that machine:
sudo apt install stellar-captive-core stellar-captive-core-api
Alternatively, you can install the bleeding edge from source:
git clone https://github.com/stellar/go monorepo && cd monorepo go install -v ./exp/services/captivecore sudo cp $(go env GOPATH)/bin/captivecore /usr/bin/stellar-captive-core-api
If you built from source or downloaded a release from GitHub, make sure to copy the native binary into a directory that is part of your PATH. Most Unix-like systems have
/usr/local/bin in PATH by default, so unless you have a preference or know better, we recommend you copy the binary there:
sudo cp horizon /usr/local/bin/stellar-horizon
(We’ve renamed it here to keep it consistent with the results of the recommended Package Manager method.)
To test your installation, simply run
stellar-horizon --help from a terminal. If the help for Horizon is displayed, your installation was successful.
Note: Some shells (such as zsh) cache PATH lookups. You may need to clear your cache (by using
rehash in zsh, for example) or restart your shell before trying to run the aforementioned command.
Last updated Apr. 12, 2021