# Installing SGE

**Hardware Requirements**&#x20;

* **Minimal**
  * 1 GB RAM
  * 25 GB SSD
  * 1.4 GHz CPU
* **Recommended**
  * 2 GB RAM
  * 100 GB SSD
  * 2.0 GHz x2 CPU

### Operating System

* Linux/Windows/macOS(x86)
* **Recommended**
  * Linux(x86\_64)

### Prerequisites

#### Go 1.19

```shell
sudo snap install --channel=1.19/stable --classic go
```

#### Git

```shell
sudo apt install -y git gcc make
```

#### Set environment variables

```shell
sudo nano $HOME/.profile
# Add the following two lines at the end of the file
GOPATH=$HOME/go
PATH=$GOPATH/bin:$PATH
# Save the file and exit the editor
source $HOME/.profile

# Now you should be able to see your variables like this:
echo $GOPATH
/home/[your_username]/go
echo $PATH
/home/[your_username]/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
```

#### Increase 'number of open files' limit

```shell
sudo nano /etc/security/limits.conf
# Before the end of the file, add:
[your_username] soft nofile 4096
# Then reboot the instance for it to take effect and check with:
ulimit -Sn
```

### Installing from Release

Get the latest release binary from [here](https://github.com/sge-network/sge/releases/tag/v0.0.1). Move the binary to an executable path. Check the installation with `sged version` from the terminal.

### Installation from Source

#### Clone the Repo

```shell
git clone git@github.com:sge-network/sge.git
```

#### Checkout release tag

```shell
git fetch --tags
git checkout [vX.X.X]
```

#### Install the binary

```shell
cd sge
go mod tidy
make install
```

#### Install system.d service file

```
nano /etc/systemd/system/sged.service
```

Please following contents (the working dir may be changed as needed)

```
[Unit]
Description=Sge Network node
After=network.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu
ExecStart=/usr/local/sbin/sged start
Restart=on-failure
RestartSec=10
LimitNOFILE=40960

[Install]
WantedBy=multi-user.target
```

Reload unit files in systemd

```
sudo systemctl daemon-reload
```
