Immich - Self-Hosted Photo Backup [Part 6 of 10]
Your own private photo library with face recognition and AI features




Tired of paying for cloud storage? Worried about privacy? Want unlimited photo storage?
Meet Immich - a self-hosted photo and video backup solution with features similar to popular cloud services.
Features:
- Automatic mobile backup (iOS & Android)
- Face recognition and object detection
- Photo search by content
- Albums and sharing
- Live photos support
- Video transcoding
- Timeline view
- Map view (with GPS data)
- Completely free and private
Letās set it up!
What is Immich?
Immich is an open-source, self-hosted photo and video backup platform.
Key Features:
- Mobile apps - Auto-backup from your phone
- AI-powered search - Find photos by content (ābeachā, ādogā, āsunsetā)
- Face recognition - Automatically group photos by person
- Object detection - Search for specific objects in photos
- Live photos - Full support for iOS live photos
- Video support - Upload and stream videos
- Sharing - Share albums with family/friends
- Timeline - Chronological photo browsing
- Map view - See where photos were taken
Privacy:
- All data stays on your server
- No cloud uploads
- No tracking
- You control everything
What Youāll Need
Prerequisites
Docker and Portainer running (Part 4)
Nginx Proxy Manager configured (Part 5)
At least 16GB RAM (32GB+ recommended for ML features)
Storage space for your photos/videos
System Requirements
- CPU: Multi-core processor (ML features are CPU-intensive)
- RAM: 16GB minimum, 32GB+ for better performance
- Storage: Depends on your photo library size
- 10,000 photos ā 50-100GB
- Videos take significantly more space
Ports Required
- Port 2283 - Immich web interface
Installing Immich
Immich uses multiple containers working together:
- immich-server - Main application
- immich-machine-learning - AI features (face recognition, object detection)
- PostgreSQL - Database
- Redis - Caching and job queue
Weāll deploy everything as a single stack in Portainer.
Step 1: Create Data Directories
On your Ubuntu server (via SSH):
# Create directories for Immich data
sudo mkdir -p /mnt/storage/docker/immich/library
sudo mkdir -p /mnt/storage/docker/immich/postgres
# Set ownership (replace 'admin' with your username)
sudo chown -R admin:admin /mnt/storage/docker/immich
Step 2: Generate Database Password
Generate a secure password for PostgreSQL:
# Generate a 32-character password (A-Z, a-z, 0-9 only)
openssl rand -base64 32 | tr -dc 'A-Za-z0-9' | head -c 32
Save this password - youāll need it in the next step!
Step 3: Deploy via Portainer
Login to Portainer:
https://portainer.homelab.example.com
Create new stack:
- Click Stacks in left sidebar
- Click + Add stack
- Name:
immich - Build method: Web editor
Paste this compose configuration:
version: '3.8'
services:
immich-server:
container_name: immich_server
image: ghcr.io/immich-app/immich-server:release
command: ['start.sh', 'immich']
volumes:
- /mnt/storage/docker/immich/library:/usr/src/app/upload
- /etc/localtime:/etc/localtime:ro
environment:
DB_HOSTNAME: immich_postgres
DB_USERNAME: postgres
DB_PASSWORD: ${DB_PASSWORD}
DB_DATABASE_NAME: immich
REDIS_HOSTNAME: immich_redis
TZ: America/New_York # Change to your timezone
depends_on:
- redis
- database
restart: unless-stopped
ports:
- 2283:3001
networks:
- immich-network
- portainer-network
immich-machine-learning:
container_name: immich_machine_learning
image: ghcr.io/immich-app/immich-machine-learning:release
volumes:
- /mnt/storage/docker/immich/model-cache:/cache
environment:
TZ: America/New_York # Change to your timezone
restart: unless-stopped
networks:
- immich-network
redis:
container_name: immich_redis
image: registry.hub.docker.com/library/redis:6.2-alpine
restart: unless-stopped
networks:
- immich-network
database:
container_name: immich_postgres
image: registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0
environment:
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_USER: postgres
POSTGRES_DB: immich
volumes:
- /mnt/storage/docker/immich/postgres:/var/lib/postgresql/data
restart: unless-stopped
networks:
- immich-network
networks:
immich-network:
driver: bridge
portainer-network:
external: true
Note about timezone:
- Find your timezone: TZ Database Timezones
- Examples:
America/New_York,America/Los_Angeles,Europe/London,Asia/Tokyo
Step 4: Set Environment Variable
Scroll down to āEnvironment variablesā section:
- Click + Add environment variable
- Name:
DB_PASSWORD - Value: Paste the password you generated in Step 2
- Click Add
Step 5: Deploy the Stack
Deploy:
- Scroll down
- Click Deploy the stack
- Wait 3-5 minutes for deployment (first run downloads images)
Verify deployment:
- Go to Containers in Portainer
- Confirm all containers are running:
immich_serverimmich_machine_learningimmich_redisimmich_postgres
Step 6: Configure Firewall
On your Ubuntu server (via SSH):
# Allow Immich from LAN
sudo ufw allow from 192.168.1.0/24 to any port 2283 proto tcp comment 'Immich from LAN'
# Check firewall status
sudo ufw status numbered
Note: Replace 192.168.1.0/24 with your network range.
Setting Up Proxy with NPM
Now letās add Immich to Nginx Proxy Manager for clean URL access.
Step 1: Create SSL Certificate
Login to NPM:
https://npm.homelab.example.com
Create certificate:
- Go to SSL Certificates
- Click Add SSL Certificate ā Letās Encrypt
- Domain Names:
photos.homelab.example.com - Use a DNS Challenge:
Enable (if using DNS challenge) - Email Address: Your email for Letās Encrypt notifications
- Agree to Terms:
Check - Click Save
- Wait for certificate issuance (1-2 minutes)
Step 2: Create Proxy Host
In NPM:
- Go to Hosts ā Proxy Hosts
- Click Add Proxy Host
Details Tab:
- Domain Names:
photos.homelab.example.com - Scheme:
http - Forward Hostname/IP:
immich_server(container name) - Forward Port:
2283 - Cache Assets:
Enable - Block Common Exploits:
Enable - Websockets Support:
Enable
SSL Tab:
- SSL Certificate: Select your certificate
- Force SSL:
Enable - HTTP/2 Support:
Enable - HSTS Enabled:
Leave unchecked
Click: Save
Step 3: Test Access
Open your browser:
https://photos.homelab.example.com
You should see the Immich welcome screen!
First-Time Setup
Create Admin Account
On first access:
- Email: Your email address
- Password: Choose a strong password
- Name: Your name
- Click Sign Up
Need a strong password?
- Use a password manager (Bitwarden, 1Password, Proton Pass, KeePassXC)
- Or generate one:
openssl rand -base64 20
Initial Configuration
After creating your account:
- Skip the intro (or read it!)
- Configure storage settings (optional)
- Go to Administration ā Settings
- Review storage template (default is fine)
- Set up mobile app (see next section)
Mobile App Setup
Immich has excellent mobile apps for automatic photo backup.
iOS App
- Download: Immich on App Store
- Open app
- Server URL:
https://photos.homelab.example.com - Login with your credentials
- Enable auto-backup:
- Go to Backup tab
- Enable Background backup
- Select albums to backup
- Configure backup settings
Android App
- Download: Immich on Google Play
- Open app
- Server URL:
https://photos.homelab.example.com - Login with your credentials
- Enable auto-backup:
- Go to Backup tab
- Enable Background backup
- Select albums to backup
- Configure backup settings
Note: For mobile backup to work outside your home network, youāll need to expose Immich publicly (not recommended) or use a VPN.
Using Immich
Uploading Photos
Via Web:
- Click Upload button
- Select photos/videos
- Wait for upload to complete
Via Mobile:
- Enable auto-backup in mobile app
- Photos upload automatically in background
Search Features
Search by content:
- Type ābeachā, ādogā, āsunsetā, etc.
- AI automatically detects objects and scenes
Search by face:
- Go to People tab
- Immich automatically detects faces
- Name people to group their photos
Search by location:
- Go to Map view
- See photos plotted on map (requires GPS data)
Creating Albums
- Select photos (checkbox icon)
- Click Add to album
- Create new album or add to existing
- Share album with others (optional)
Sharing
- Open an album
- Click Share button
- Choose sharing options:
- Link sharing - Generate shareable link
- User sharing - Share with other Immich users
- Set permissions (view only, can edit, etc.)
Maintenance
Check Storage Usage
# Check Immich storage usage
du -sh /mnt/storage/docker/immich/library
# Check database size
du -sh /mnt/storage/docker/immich/postgres
Backup Your Photos
Backup uploaded photos:
# Backup library directory
sudo tar -czf immich-library-backup-$(date +%Y%m%d).tar.gz \
/mnt/storage/docker/immich/library
Backup database:
# Backup PostgreSQL database
docker exec immich_postgres pg_dump -U postgres immich > immich-backup-$(date +%Y%m%d).sql
Store backups off-site for true redundancy!
Update Immich
Via Portainer:
- Go to Stacks ā immich
- Click Editor
- Click Update the stack
- Select Re-pull image and redeploy
- Wait for update to complete
Check for updates regularly - Immich is actively developed with frequent improvements.
Performance Tips
Machine Learning Performance
ML features are CPU-intensive:
- Face recognition
- Object detection
- Smart search
Initial scan takes time:
- Expect high CPU usage during first photo analysis
- Can take hours/days for large libraries
- Performance improves after initial scan
Optimize ML performance:
- Ensure adequate RAM (32GB+ recommended)
- Let initial scan complete before heavy usage
- Consider disabling ML features on low-end hardware
Storage Optimization
Video transcoding:
- Immich can transcode videos for web playback
- Saves bandwidth but uses storage
- Configure in Administration ā Settings ā Video
Thumbnail generation:
- Thumbnails are generated automatically
- Stored in
/mnt/storage/docker/immich/library/thumbs - Can be regenerated if deleted
TL;DR
- Immich is a self-hosted photo backup platform
- Features: Mobile backup, face recognition, AI search, sharing
- Installation: Deploy multi-container stack via Portainer
- Mobile apps: iOS and Android with auto-backup
- Privacy: All data stays on your server
- Performance: Requires decent CPU/RAM for ML features
- Next: Weāll set up Discourse for community forums in Part 7
Your Turn
What cloud photo service are you currently using?
How many photos do you have to backup?
Excited about having unlimited private photo storage?
Drop a comment below!
Navigation: ā Part 5 | Part 7 ā