# Installation

#### On this page

* [<mark style="color:blue;">Build Requirements</mark>](#build-requirements)
* [<mark style="color:blue;">Build Tools</mark>](#build-tools)
* [<mark style="color:blue;">Install Go</mark>](#install-go)
* [<mark style="color:blue;">Install the binaries</mark>](#install-the-binaries)
  * [<mark style="color:blue;">Build Tags</mark>](#build-tags)
* [<mark style="color:blue;">Work with a ICTech SDK Clone</mark>](#work-with-a-icplaza-sdk-clone)
* [<mark style="color:blue;">Next</mark>](#next)

This guide will explain how to install the `ICPlazad` binary and run the cli. With this binary installed on a server, you can participate on the mainnet as either a Full Node or a [<mark style="color:blue;">Validator</mark>](https://ictech.gitbook.io/icplaza-docs/chain-dev/running-a-validato).

### Build Requirements <mark style="color:blue;">#</mark> <a href="#build-requirements" id="build-requirements"></a>

At present, the SDK fully supports installation on linux distributions. For the purpose of this instruction set, we’ll be using `Ubuntu 20.04.3 LTS`. It is also possible to install `ICPlazad` on Unix, while Windows may require additional unsupported third party installation. All steps are listed below for a clean install.

1. [<mark style="color:blue;">Update & install build tools</mark>](#build-tools)
2. [<mark style="color:blue;">Install Go</mark>](#install-go)
3. [<mark style="color:blue;">Install</mark> <mark style="color:blue;"></mark><mark style="color:blue;">`ICPlazad`</mark> <mark style="color:blue;"></mark><mark style="color:blue;">binaries</mark>](#install-the-binaries)

### Build Tools <mark style="color:blue;">#</mark> <a href="#build-tools" id="build-tools"></a>

Install `make` and `gcc`.

**Ubuntu:**

```bash
sudo apt-get update

sudo apt-get install -y make gcc
```

### Install Go <mark style="color:blue;">#</mark> <a href="#install-go" id="install-go"></a>

::: tip **Go 1.18+** or later is required for the  ICTech SDK. :::

We suggest the following two ways to install Go. Check out the[ <mark style="color:blue;">official docs</mark>](https://go.dev/doc/install) and Go installer for the correct download for your operating system. Alternatively, you can install Go yourself from the command line. Detailed below are standard default installation locations, but feel free to customize.

[<mark style="color:blue;">**Go Binary Downloads**</mark>](https://go.dev/dl/)

**Ubuntu:**

At the time of this writing, the latest release is `1.18.2`. We’re going to download the tarball, extract it to `/usr/local`, and export `GOROOT` to our `$PATH`

```bash
curl -OL https://golang.org/dl/go1.18.2.linux-amd64.tar.gz

sudo tar -C /usr/local -xvf go1.18.2.linux-amd64.tar.gz

export PATH=$PATH:/usr/local/go/bin

```

Remember to add `GOPATH` to your `$PATH` environment variable. If you’re not sure where that is, run `go env GOPATH`. This will allow us to run the `ICPlazad` binary in the next step. If you’re not sure how to set your `$PATH` take a look at [<mark style="color:blue;">these instructions</mark>](https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them).

```bash
export PATH=$PATH:$(go env GOPATH)/bin
```

### Install the binaries <mark style="color:blue;">#</mark> <a href="#install-the-binaries" id="install-the-binaries"></a>

Next, let’s install the latest version of  ICTech. Make sure you `git checkout` the correct [<mark style="color:blue;">released version</mark>](https://github.com/ICPlaza/ICPlaza/releases).

```bash
git clone -b <latest-release-tag> git@github.com:ICPlaza/ICPlaza.git
cd ICPlaza && make install
```

If this command fails due to the following error message, you might have already set `LDFLAGS` prior to running this step.

```
# github.com/ICTechDAO/cmd/ICPlazad
flag provided but not defined: -L
usage: link [options] main.o
...
make: *** [install] Error 2
```

Unset this environment variable and try again.

```
LDFLAGS="" make install
```

> *NOTE*: If you still have issues at this step, please check that you have the latest stable version of GO installed.

That will install the `ICPlazad` binary. Verify that everything installed successfully by running:

```bash
ICPlazad version --long
```

You should see something similar to the following:

```bash
name: ICPlaza
server_name: ICPlazad
version: v7.0.0
commit: 07f9892a927f451ae204d0c9d1a5601d8fc232a5
build_tags: netgo,ledger
go: go version go1.18 linux/amd64
```

#### Build Tags <mark style="color:blue;">#</mark> <a href="#build-tags" id="build-tags"></a>

Build tags indicate special features that have been enabled in the binary.

| Build Tag | Description                                     |
| --------- | ----------------------------------------------- |
| netgo     | Name resolution will use pure Go code           |
| ledger    | Ledger devices are supported (hardware wallets) |

## Work with a  ICTech SDK Clone <mark style="color:blue;">#</mark> <a href="#work-with-a-icplaza-sdk-clone" id="work-with-a-icplaza-sdk-clone"></a>

To work with your own modifications of the ICPlaza SDK, make a fork of this repo, and add a `replace` clause to the `go.mod` file. The `replace` clause you add to `go.mod` must provide the correct import path:

* Make appropriate changes
* Add `replace github.com/`ICTechDAO`/ICPlaza-sdk => /path/to/clone/ICPlaza-sdk` to `go.mod`
* Run `make clean install` or `make clean build`
* Test changes

### Next <mark style="color:blue;">#</mark> <a href="#next" id="next"></a>

Now you can [<mark style="color:blue;">join the mainnet</mark>](https://ictech.gitbook.io/icplaza-docs/chain-dev/join-mainnet)

[<mark style="color:blue;">← Introduction</mark> ](https://ictech.gitbook.io/icplaza-docs/chain-dev/introduction)

[<mark style="color:blue;">Join Mainnet →</mark>](https://ictech.gitbook.io/icplaza-docs/chain-dev/join-mainnet)
