Skip to content

Commit 6843fc9

Browse files
feat(video): Take Control of Your Photos – Self-Host Immich on Your Server
1 parent 14e4a0e commit 6843fc9

File tree

2 files changed

+365
-0
lines changed

2 files changed

+365
-0
lines changed
Lines changed: 365 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,365 @@
1+
---
2+
layout: post
3+
title: "Take Control of Your Photos – Self-Host Immich on Your Server"
4+
date: 2025-06-15 08:00:00 -0500
5+
categories: self-hosted
6+
tags: homelab immich self-hosted
7+
image:
8+
path: /assets/img/headers/immich-self-hosted-hero.webp
9+
lqip: data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAYACgMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AP57vgP8e/2S9X8OR6B8QP2QNR+KHifwppTm+8WeJvjn4ktLHW9Ul0jW9Rlvbbwrb+Hb1PDKXkti0t4uha7byMVWC2ktlmM9v52Io+wlTwtKlRq0eekqqqSnSVOM1Tg3h4QhUSfvVXyXpxbUXdOo1S0rV5ZflNXGUsRXr18Bl869SVWEKVTEzo0lUl7XEQnVlUlUmtakqadvecX8K8W1C58JXd/fXWl+GH0jTLm8ubjTtJN+moHS7GaZ5LTTjfy2cEt6bK3aO2N3JDDJc+V5zxRs5QdVDCOvQo1niMQnWpU6rXtpOzqQU7X5Ve17Xsr72R+ZYzj/AOq4vFYX+xcDU+rYmvQ5/h5/Y1ZU+fl5Xbm5b2u7Xtd7n//Z
10+
---
11+
12+
Protect your personal photos and videos by hosting them yourself. In this video, you’ll learn how to install Immich, an open-source photo and video platform, on your own home server using Docker. Take control of your data with a fast, modern interface, GPU-accelerated features, and the ability to use your own NAS or network storage.
13+
14+
{% include embed/youtube.html id='ehX0cl3IfdA' %}
15+
📺 [Watch Video](https://www.youtube.com/watch?v=ehX0cl3IfdA)
16+
17+
## Info
18+
19+
To to learn more about immich, [check out the GitHub repo](https://github.com/immich-app/immich)
20+
21+
## Install Docker
22+
23+
To install docker, see [this post](/posts/docker-compose-install/)
24+
25+
## GPU
26+
27+
check for card
28+
29+
```shell
30+
lspci
31+
```
32+
33+
Supported NVIDIA cards (5.2 CUDA and higher)
34+
35+
- <https://developer.nvidia.com/cuda-gpus>
36+
37+
list all drivers
38+
39+
```shell
40+
ubuntu-drivers devices
41+
```
42+
43+
install recommended nvidia drivers
44+
45+
```shell
46+
sudo ubuntu-drivers install
47+
```
48+
49+
reboot
50+
51+
```shell
52+
sudo reboot
53+
```
54+
55+
check to see if drivers are installed and working
56+
57+
```shell
58+
nvidia-smi
59+
```
60+
61+
## NVIDIA Container Toolkit
62+
63+
<https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html>
64+
65+
Configure the production repository:
66+
67+
```shell
68+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
69+
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
70+
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
71+
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
72+
```
73+
74+
update packages
75+
76+
```shell
77+
sudo apt-get update
78+
```
79+
80+
Install NVIDIA Container Toolkit packages
81+
82+
```shell
83+
NVIDIA_CONTAINER_TOOLKIT_VERSION=1.17.8-1 \
84+
sudo apt-get install -y \
85+
nvidia-container-toolkit=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
86+
nvidia-container-toolkit-base=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
87+
libnvidia-container-tools=${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
88+
libnvidia-container1=${NVIDIA_CONTAINER_TOOLKIT_VERSION}
89+
```
90+
91+
Configure docker to run the toolkit
92+
93+
```shell
94+
sudo nvidia-ctk runtime configure --runtime=docker
95+
```
96+
97+
restart docker
98+
99+
```shell
100+
sudo systemctl restart docker
101+
```
102+
103+
run nvidia smi inside the ubuntu container
104+
105+
```shell
106+
docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi
107+
```
108+
109+
## Configure
110+
111+
create folders for our stack
112+
113+
```shell
114+
sudo mkdir -p /opt/stacks/immich
115+
```
116+
117+
change ownership of the folder (change group:user)
118+
119+
```shell
120+
sudo chown serveradmin:serveradmin -R /opt/stacks
121+
```
122+
123+
change directories
124+
125+
```shell
126+
cd /opt/stacks/immich
127+
```
128+
129+
create our compose file
130+
131+
```shell
132+
nano compose.yml
133+
```
134+
135+
```yaml
136+
name: immich
137+
138+
services:
139+
immich-server:
140+
container_name: immich_server
141+
image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
142+
extends:
143+
file: hwaccel.transcoding.yml
144+
service: ${TRANSCODING_BACKEND:-cpu}
145+
volumes:
146+
- ${UPLOAD_LOCATION}:/usr/src/app/upload
147+
# - /mnt/photos:/mnt/photos:ro # update and uncomment if you are using a network share
148+
- /etc/localtime:/etc/localtime:ro
149+
env_file:
150+
- .env
151+
ports:
152+
- '2283:2283'
153+
depends_on:
154+
- redis
155+
- database
156+
restart: always
157+
healthcheck:
158+
disable: false
159+
# labels:
160+
# - "traefik.enable=true"
161+
# - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.rule=Host(`${TRAEFIK_DOMAIN}`)"
162+
# - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.entrypoints=websecure"
163+
# - "traefik.http.routers.${TRAEFIK_ROUTER_NAME}.tls.certresolver=${TRAEFIK_CERT_RESOLVER}"
164+
# - "traefik.http.services.${TRAEFIK_ROUTER_NAME}.loadbalancer.server.port=2283"
165+
166+
immich-machine-learning:
167+
container_name: immich_machine_learning
168+
image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}-cuda
169+
extends:
170+
file: hwaccel.ml.yml
171+
service: cuda
172+
volumes:
173+
- model-cache:/cache
174+
env_file:
175+
- .env
176+
restart: always
177+
healthcheck:
178+
disable: false
179+
180+
redis:
181+
container_name: immich_redis
182+
image: docker.io/valkey/valkey:8-bookworm
183+
healthcheck:
184+
test: redis-cli ping || exit 1
185+
restart: always
186+
187+
database:
188+
container_name: immich_postgres
189+
image: ghcr.io/immich-app/postgres:14-vectorchord0.3.0-pgvectors0.2.0
190+
environment:
191+
POSTGRES_PASSWORD: ${DB_PASSWORD}
192+
POSTGRES_USER: ${DB_USERNAME}
193+
POSTGRES_DB: ${DB_DATABASE_NAME}
194+
POSTGRES_INITDB_ARGS: '--data-checksums'
195+
DB_STORAGE_TYPE: ${DB_STORAGE_TYPE:-SSD}
196+
volumes:
197+
- ${DB_DATA_LOCATION}:/var/lib/postgresql/data
198+
restart: always
199+
200+
volumes:
201+
model-cache:
202+
```
203+
204+
```shell
205+
nano hwaccel.ml.yml
206+
```
207+
208+
```yaml
209+
services:
210+
cuda:
211+
deploy:
212+
resources:
213+
reservations:
214+
devices:
215+
- driver: nvidia
216+
count: 1
217+
capabilities:
218+
- gpu
219+
```
220+
221+
```shell
222+
nano hwaccel.transcoding.yml
223+
```
224+
225+
```yaml
226+
services:
227+
nvenc:
228+
deploy:
229+
resources:
230+
reservations:
231+
devices:
232+
- driver: nvidia
233+
count: 1
234+
capabilities:
235+
- gpu
236+
- compute
237+
- video
238+
```
239+
240+
```shell
241+
nano .env
242+
```
243+
244+
```shell
245+
# Required paths
246+
UPLOAD_LOCATION=./library
247+
DB_DATA_LOCATION=./postgres
248+
249+
# Optional timezone (not needed if localtime is mounted)
250+
# TZ=Etc/UTC
251+
252+
# Version control
253+
IMMICH_VERSION=release
254+
255+
# Postgres authentication
256+
DB_PASSWORD=postgres
257+
DB_USERNAME=postgres
258+
DB_DATABASE_NAME=immich
259+
260+
# Optional tuning
261+
DB_STORAGE_TYPE=SSD
262+
263+
# transcoding
264+
TRANSCODING_BACKEND=nvenc
265+
266+
# traefik
267+
TRAEFIK_ROUTER_NAME=immich
268+
TRAEFIK_DOMAIN=immich.example.com
269+
TRAEFIK_CERT_RESOLVER=myresolver
270+
```
271+
272+
## SMB Share
273+
274+
make creds dir
275+
276+
```shell
277+
sudo mkdir -p /etc/smb-credentials
278+
```
279+
280+
create credentials file
281+
282+
```shell
283+
sudo nano /etc/smb-credentials/photos
284+
```
285+
286+
add contents (update with your username and password that has access to your share)
287+
288+
```shell
289+
username=photosuser
290+
password=Ph0t0sUs3r!
291+
```
292+
293+
update permissions for file
294+
295+
```shell
296+
sudo chmod 600 /etc/smb-credentials/photos
297+
sudo chown root:root /etc/smb-credentials/photos
298+
```
299+
300+
check permissions
301+
302+
```shell
303+
ls -l /etc/smb-credentials/photos
304+
```
305+
306+
update fstab
307+
308+
```shell
309+
sudo nano /etc/fstab
310+
```
311+
312+
add mount path
313+
314+
```shell
315+
//192.168.10.10/photos /mnt/photos cifs credentials=/etc/smb-credentials/photos,iocharset=utf8,vers=3.0,ro,nofail 0 0
316+
```
317+
318+
install additional packages for cifs
319+
320+
```shell
321+
sudo apt update && sudo apt install cifs-utils
322+
```
323+
324+
reboot (mandatory)
325+
326+
```shell
327+
sudo reboot
328+
```
329+
330+
After rebooting you should see your share mounted at `/mnt/photos`
331+
332+
## Starting container
333+
334+
start docker stack
335+
336+
```shell
337+
cd /opt/stacks/immich
338+
docker compose up -d
339+
```
340+
341+
check docker containers
342+
343+
```shell
344+
docker ps
345+
```
346+
347+
visit server (update with your server's IP)
348+
349+
- <http://192.168.10.111:2283>
350+
351+
## More info
352+
353+
immich back up docs
354+
355+
- <https://immich.app/docs/administration/backup-and-restore/>
356+
357+
## Links
358+
359+
🛍️ Check out the new Merch Shop at <https://l.technotim.live/shop>
360+
361+
⚙️ See all the hardware I recommend at <https://l.technotim.live/gear>
362+
363+
🚀 Don't forget to check out the [🚀Launchpad repo](https://l.technotim.live/quick-start) with all of the quick start source files
364+
365+
🤝 Support me and [help keep this site ad-free!](/sponsor)
41.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)