# Installation

Welcome to the `galacticad` cli installation guide!

This step-by-step tutorial will guide you through installing the `galacticad` binary on your server, enabling you to participate in the testnet as either a Full Node or Validator.

## Preparing for Installation

Before installing `galacticad`, ensure your system is ready by:

1. Updating your system and installing essential build tools.
2. Installing the Go programming language.
3. Downloading and setting up the `galacticad` binaries.

> ⚠️ **WARNING:** Make sure your server **timezone configuration is UTC**. Having a different timezone configuration may cause a `LastResultsHash` mismatch error. This will take down your node!

### Essential Build Tools

First, make sure your system has the necessary tools for the build process:

* **For Ubuntu/Debian users:**

```sh
sudo apt-get update
sudo apt-get install -y make gcc git build-essential curl tar jq
```

* **For RHEL/Centos/Rocky users:**

```sh
sudo yum update
sudo yum groupinstall 'Development Tools'
sudo yum install -y curl jq
```

It's crucial to have `curl`, `tar`, `git`, and `jq` installed for the upcoming steps.

### Installing Go

`galacticad` requires Go version 1.21 or later. For detailed installation instructions across different operating systems, refer to [the official Go documentation](https://go.dev/doc/install).

```sh
sudo rm -rf /usr/local/go
curl -sL https://go.dev/dl/go1.21.9.linux-amd64.tar.gz | sudo tar -x -z -C ~/
echo export PATH=\$PATH:\$HOME/go/bin >> ~/.bashrc
source ~/.bashrc
```

This command installs Go in your home directory, but you're free to choose another location.

### Installing `galacticad`

Now, let's proceed to install `galacticad`:

```sh
git clone https://github.com/Galactica-corp/galactica.git
cd galactica
make install
```

The binary is installed to `$GOPATH/bin` by default. To change the installation path, use the `BINDIR` variable:

```sh
BINDIR=/usr/local/bin make install
```

Confirm the installation was successful:

```sh
galacticad version --long
```

You should see output detailing the build dependencies, SDK version, and more.

### Running `galacticad` as a service

To add galacticad validator to linux systemd-units to autostart service with command below:

```sh
export GALACTICA_HOME=$(realpath ~/.galactica)
export CHAIN_ID=[Target Chain ID]

echo > /etc/systemd/system/galactica.service <<EOF
[Unit]
Description=Galactica Network Node
After=network-online.target
[Service]
  WorkingDirectory=$GALACTICA_HOME
  ExecStart=$(which galacticad) start --chain-id=$CHAIN_ID --home=$GALACTICA_HOME
  Type=simple
## uncomment if you want to run as a specific user and group
#   User=galactica
#   Group=galactica
  Restart=always
[Install]
  WantedBy=network.target
EOF
systemctl daemon-reload
systemctl enable --now galactica.service
systemctl status galactica.service
```

Replace `[Target Chain ID]` with the chain ID you want to run the node on.

## Next Steps

Security guidelines and best practices are essential for maintaining a secure node. Please refer to the [Security Guide](/galactica-developer-documentation/validator-guide/security.md) for more information.

Congratulations! You've successfully installed the `galacticad` binary and are ready to [become a validator](/galactica-developer-documentation/validator-guide/become-validator.md). Explore the possibilities as a node operator in the Galactica Network and contribute to its growth and security.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.galactica.com/galactica-developer-documentation/validator-guide/installation.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
