Installing Substrate and Terraform
Most steps in the getting started guide only need to be performed once. This step is the exception. Everyone who's going to be running Substrate commands, writing Terraform code, or really interacting with AWS in any but the most superficial ways, should follow these steps.
Substrate is distributed directly to customers. You'll have access to a feed of releases which includes links to download tarballs, usually distributed via a shared Slack channel (or another medium if that doesn't work for you). After the first the time, though, it's typically not necessary to handle these tarballs directly.
Download the latest one for your platform. Then extract it by running a command like this from your downloads directory:
tar xf substrate-<version>-<commit>-<OS>-<ARCH>.tar.gz
This will create
substrate-<version>-<commit>-<OS>-<ARCH>
, which contains bin/substrate
(typically all you need), opt/bin/
with some optional extra programs that are part of the Substrate distribution, and src/
with the complete source code for this release of Substrate.To simply install Substrate in
~/bin
in a single command, run a command like this:tar xf substrate-<version>-<commit>-<OS>-<ARCH>.tar.gz -C ~/bin --strip-components 2 substrate-<version>-<commit>-<OS>-<ARCH>/bin/substrate
Each released version and commit is offered in four binary formats; choose the appropriate one for your system.
<OS>
is one of “darwin
” or “linux
” and <ARCH>
is one of “amd64
” or “arm64
”.You can install Substrate wherever you like. If
~/bin
doesn't suit you, just ensure the directory where you install it is on your PATH
.Installing Substrate on fleets of laptops, in EC2 instances you get from the Instance Factory, or anywhere else could be tedious if you had to follow the procedure above each time and update the version string each month so Substrate ships with an automation-friendly install method. To install the latest version, month in and month out, without having to micromanage version strings, do the following:
- 1.Copy
substrate-<version>-<commit>-<OS>-<ARCH>.tar.gz/src/install.sh
from any Substrate release tarball - 2.Arrange for
install.sh
to be distributed to your fleet of laptops, EC2 instances, or whatever other endpoints you have in mind - 3.Arrange to execute
install.sh -p <prefix> -v <known-version>
at first boot or setup time, with<prefix>
being the contents of yoursubstrate.prefix
file and<known-version>
being any full Substrate version string (like 2047.12-0123abc)
install.sh
and its arguments are intended to be durable and should not need to be updated. Specifically, there is no need to update the arguments each month when Substrate is released because the program will walk the chain of releases forward from the one given to the latest one.Once some version of Substrate is installed, upgrading is a simple matter of running
substrate upgrade
.Substrate currently requires exactly Terraform 1.5.6. (Substrate asks for Terraform to be upgraded every few releases to stay nearly current with Terraform.)
The easist way to install Terraform 1.5.6 is to run
substrate terraform
. If the directory that contains substrate
itself is writable, terraform
will be placed there, too.Alternatively, you can download Terraform 1.5.6 from Hashicorp, with the filenames being parameterized with
OS
and ARCH
the same as Substrate itself. Download and unzip
the appropriate build. Move terraform
into a directory on your PATH
. (It doesn't have to be the same directory where you placed substrate
.)