> For the complete documentation index, see [llms.txt](https://docs.hivel.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hivel.ai/archive/generic/hivel-on-premises-deployment-guide-generic/3.-infrastructure-setup.md).

# 3. Infrastructure Setup

On-Prem Deployment Guide (Generic)

### Step 1: Provision Server

Provision a server using whichever platform you deploy on:

* AWS: launch an EC2 instance
* Azure: create a Virtual Machine
* GCP: create a Compute Engine instance
* On-prem / private data center: provision a VM or bare-metal host through your virtualization platform

For the server:

* Choose Ubuntu 22.04 LTS or Amazon Linux 2 (or equivalent)
* Apply the sizing and storage from the table above (VM)
* Configure firewall / network security rules (Security Groups on AWS, Network Security Groups on Azure, Firewall Rules on GCP, or your data center firewall) using the Network Requirements table above
* Note the public/private IP address of each server

**Expected result:** two running servers, each reachable over SSH, each sized per the table above, with the ports from Network Requirements open.

**If it fails:** if you can't reach a server over SSH, check that your platform's security group/firewall rule allows inbound SSH (port 22) from your own IP - this is separate from the application ports listed in Network Requirements, which only need to be open to the servers themselves and to your users, not to you as the operator.

**Next step:** Step 2 below - install Docker, Docker Compose, and the AWS CLI on both servers.

### Step 2: Install Prerequisites on Both VMs

**Goal:** get Docker, Docker Compose, and the AWS CLI installed and verified on both VM1 and VM2.

On both VM1 and VM2, run:

{% code expandable="true" %}

```
# Update system
sudo apt update && sudo apt upgrade -y
sudo apt install -y postgresql postgresql-contrib
sudo apt install -y unzip

# Install Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker $USER

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# Install AWS CLI (required for Hivel ECR access, regardless of your own cloud provider)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

# Verify installations
docker --version
docker-compose --version
aws --version

# Log out and back in for Docker group changes to take effect
```

{% endcode %}

**Expected result:** each --version command prints a version string with no error, and after logging back in, docker ps runs without a permissions error.

**If it fails:** if `docker ps` still asks for sudo after logging back in, run newgrp docker or reboot the host - the group membership change didn't take effect in your current shell session. See also Verify Prerequisites Before Starting above.

**Next step:** Your VM is now provisioned and set up. Head to Prerequisites next to confirm it's installed correctly, then continue with the rest of the deployment process.

{% columns %}
{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/2.-prerequisites-and-vm-server-requirements.md" class="button primary" data-icon="backward">Prerequisites and VM Server Requirements</a>
{% endcolumn %}

{% column %}

{% endcolumn %}

{% column %} <a href="/archive/generic/hivel-on-premises-deployment-guide-generic/4.-aws-cli-configuration-hivel-ecr-access.md" class="button primary" data-icon="forward">AWS CLI Configuration</a>
{% endcolumn %}
{% endcolumns %}
