To install Horizon, you have a few choices. You can...
- install prebuilt binaries from our repositories via your package manager if running a Debian-based system,
- download a prebuilt release of Horizon for your target architecture and operation system, or
- build Horizon and Stellar Core yourself from scratch.
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 in their respective environments much simpler.
SDF publishes new releases to its custom Ubuntu repositories. Follow this guide to add the stable SDF repository to your system. This page outlines the various commands that these packages make available. We'll need:
sudo apt update
sudo apt install stellar-horizon stellar-core
Next, you can jump to Testing Your Installation.
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:
- A Unix-like operating system with the common core commands (cp, tar, mkdir, bash, etc.)
- A compatible distribution of Golang (v1.15 or later)
(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 copy the binary from the
GOPATH to the system PATH (as we'll do later), or add Go binaries to your PATH in your
.bashrc (or equivalent):
export PATH=$(go env GOPATH)/bin:$PATH
You will also need to compile Stellar Core from its source code if you need ingestion or transaction submission. You should refer to their installation guide for details.
Next, jump ahead to Testing Your Installation.
Completing and Testing Your Installation
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.