# Installation

## System Requirements

### Minimum

* **OS:** Windows 10+, Linux (kernel 4.x+), macOS 10.14+
* **RAM:** 512 MB
* **Storage:** 100 MB
* **Network:** Internet connection (any speed)

### Recommended

* **RAM:** 2 GB
* **Storage:** 1 GB (for data persistence)
* **Network:** Stable broadband connection

## Installation Methods

### Method 1: Pre-built Binaries (Recommended)

#### Linux (x64)

```bash
# Download
curl -L -o kayakd.zip http://203.161.33.237/kayakd-v0.1.28-linux-amd64.zip

# Extract
unzip kayakd.zip

# Make executable
chmod +x kayakd-v0.1.28-linux-amd64

# Run
./kayakd-v0.1.28-linux-amd64 --bootstrap 203.161.33.237:4242 --proxy
```

#### Windows (x64)

```powershell
# Download
curl.exe -o kayakd.zip http://203.161.33.237/kayakd-v0.1.28-windows-amd64.zip

# Extract
Expand-Archive -Force kayakd.zip .

# Run
.\kayakd-v0.1.28-windows-amd64.exe --bootstrap 203.161.33.237:4242 --proxy
```

#### macOS (x64)

```bash
# Download
curl -L -o kayakd.zip http://203.161.33.237/kayakd-v0.1.28-darwin-amd64.zip

# Extract
unzip kayakd.zip

# Make executable
chmod +x kayakd-v0.1.28-darwin-amd64

# Allow in Security preferences if blocked
# System Preferences → Security & Privacy → Allow

# Run
./kayakd-v0.1.28-darwin-amd64 --bootstrap 203.161.33.237:4242 --proxy
```

#### Android

1. Download APK from releases
2. Enable "Install from unknown sources"
3. Install and open KayakNet app
4. The app connects automatically

### Method 2: Build from Source

#### Prerequisites

* Go 1.21+
* Git

#### Steps

```bash
# Clone repository
git clone https://github.com/KayakNet/KayakNet.git
cd KayakNet

# Build
go build -o kayakd ./cmd/kayakd/

# Run
./kayakd --bootstrap 203.161.33.237:4242 --proxy
```

### Method 3: Docker

```bash
# Pull image
docker pull kayaknet/kayakd:latest

# Run
docker run -d \
  --name kayaknet \
  -p 4242:4242 \
  -p 8080:8080 \
  -p 8118:8118 \
  -p 8119:8119 \
  -v kayaknet-data:/data \
  kayaknet/kayakd:latest \
  --bootstrap 203.161.33.237:4242 --proxy
```

## Verifying Installation

After starting the node:

1. **Check the console output** - You should see the KayakNet banner
2. **Test the proxy** - `curl --proxy http://127.0.0.1:8118 http://home.kyk`
3. **Check peer count** - Should show 1+ peers after a few seconds

## Running as a Service

### Linux (systemd)

Create `/etc/systemd/system/kayaknet.service`:

```ini
[Unit]
Description=KayakNet Node
After=network.target

[Service]
Type=simple
User=kayaknet
ExecStart=/opt/kayaknet/kayakd --bootstrap 203.161.33.237:4242 --proxy --data-dir /var/lib/kayaknet
Restart=always
RestartSec=10

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

Enable and start:

```bash
sudo systemctl enable kayaknet
sudo systemctl start kayaknet
```

### Windows (Task Scheduler)

1. Open Task Scheduler
2. Create Basic Task → "KayakNet"
3. Trigger: At startup
4. Action: Start a program → `kayakd.exe`
5. Arguments: `--bootstrap 203.161.33.237:4242 --proxy`

## Troubleshooting

### Port Already in Use

```
Error: bind: address already in use
```

Another process is using port 4242. Either:

* Kill the other process
* Use a different port: `--listen 0.0.0.0:4243`

### Can't Connect to Bootstrap

```
Error: failed to connect to bootstrap
```

* Check your internet connection
* Verify the bootstrap address is correct
* Try a different bootstrap node

### Windows Defender Warning

Windows may flag the executable. This is a false positive for unsigned Go binaries.

* Click "More info" → "Run anyway"
* Or add an exclusion in Windows Security

### Permission Denied (Linux/macOS)

```bash
chmod +x kayakd
```
