Initial Host Setup

Initial Host Setup

How to set up a fresh Debian host from zero to running the full system.

What You Need

  • Fresh Debian 12 installation (minimal is fine)
  • Root access or sudo privileges
  • Internet connection
  • SSH access (recommended)

Step 1: Create User and Basic Setup

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Log in as root (or use sudo for each command)

# Create your user
adduser your-username
usermod -aG sudo your-username

# Update the system
apt update && apt upgrade -y

# Install essential packages
apt install -y curl wget git vim htop net-tools ufw rsync

Step 2: Install Docker

Follow the official Docker installation guide for Debian: https://docs.docker.com/engine/install/debian/

After installation, add your user to the docker group:

1
2
sudo usermod -aG docker your-username
# Log out and back in for this to take effect

Test Docker installation:

1
2
docker --version
docker compose version

Step 3: Setup SSH Keys (if using SSH)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# On your local machine, generate SSH key if you don't have one
ssh-keygen -t ed25519 -C "your-email@example.com"

# Copy your public key to the server
ssh-copy-id your-username@server-ip

# On the server, disable password authentication (optional but recommended)
sudo vim /etc/ssh/sshd_config
# Set: PasswordAuthentication no
sudo systemctl restart ssh

Step 4: Basic Security Setup

1
2
3
4
5
6
7
8
# Configure UFW firewall
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw enable

# Update system hostname (optional)
sudo hostnamectl set-hostname your-hostname

Step 5: Clone the Repository

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Clone to your preferred location
cd /opt
sudo mkdir infrastructure
sudo chown your-username:your-username infrastructure
cd infrastructure

# Clone the repository
git clone https://github.com/your-username/your-repo.git .

# Or if using SSH keys
git clone git@github.com:your-username/your-repo.git .

Step 6: Initial Repository Setup

1
2
3
4
5
6
7
# Run the repository initialization
./init.sh

# This sets up:
# - Git hooks
# - Basic repository configuration
# - Development environment preparation

Step 7: Setup Storage Tiers

You need to decide where to store your data tiers. For a simple setup:

1
2
3
4
5
6
# Create storage directories
sudo mkdir -p /data/{tier1,tier2,tier3}
sudo chown -R your-username:your-username /data

# Setup tiers for your node (example for icarus)
.scripts/ops/setup-tiers icarus /data/tier1 /data/tier2 /data/tier3

For production, you might want different storage for each tier:

  • Tier 1: Fast SSD for configs and secrets
  • Tier 2: Good SSD for databases and important data
  • Tier 3: Large HDD for cache and media files

Step 8: Configure Environment Variables

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Copy environment template (if exists)
cp .env.example .env

# Edit with your settings
vim .env

# Set required variables like:
# DOMAIN=your-domain.com
# NODE=your-node-name
# TELEGRAM_BOT_TOKEN=your-bot-token

Step 9: Start Services

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
# Navigate to your node directory
cd icarus  # or daedalus/helios

# Start with the root services first
cd root
docker compose up -d

# Check if everything started correctly
docker compose ps
docker compose logs

# Then start other services as needed
cd ../arr  # example service
docker compose up -d

Step 10: Verify Everything Works

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Check all containers are running
docker ps

# Check system resources
df -h
free -h
docker system df

# Test network connectivity
ping -c 4 8.8.8.8

# Check logs for any errors
docker compose logs | grep -i error

Common Issues

Docker Permission Denied

1
2
3
# Make sure you're in the docker group
sudo usermod -aG docker $USER
# Log out and back in

Port Already in Use

1
2
3
4
# Check what's using the port
sudo ss -tulpn | grep :80
# Stop the conflicting service
sudo systemctl stop apache2  # example

Out of Disk Space

1
2
3
4
5
# Check disk usage
df -h
# Clean up if needed
docker system prune -f
sudo apt autoremove -y

Can’t Connect to Services

1
2
3
4
5
6
# Check firewall
sudo ufw status
# Check if service is actually running
docker compose ps
# Check service logs
docker compose logs service-name

What’s Next

Once everything is running:

  1. Set up backups - Configure rclone for your cloud storage
  2. Configure monitoring - Set up Telegram alerts
  3. Test recovery - Make sure you can restore from backups
  4. Documentation - Keep notes of any custom configurations

Your host should now be ready to run the full system!

Last updated on