Immich photo sharing software

Instructions

Create LXC (inprivilaged)

Since I’d like to use some fairly recent features of Podman, we MUST start with debian 12 (Bookworm) or 13 (Trixie) when it is released. In addition, I added asecond mount point at /var/immich for data, if you want to keep the data on a separate storage location. It’s up to you. The container can be unprivilaged, but it needs nesting and FUSE enabled.

#Replace bookworm with trixie in sources.list
#Not needed if you are actually using Trixie (when it releases)
sed -i 's/bookworm/trixie/g' /etc/apt/sources.list
#Update and dist-upgrade to Trixe
#Answer yes to all prompts
apt update && apt dist-upgrade -y

Install and configure Postgres

#Specify version 15 even though it's the current
#Since Immich wants version 14 or 15
apt install postgresql-15 sudo -y
sudo -u postgres psql

Now, in the Postgres shell, run these commands (make sure you set your own db password!):

create database immich;
create user imuser with encrypted password 'imuser';
grant all privileges on schema public to imuser;
exit

Done with Postgres!

Install and configure Redis

Redis is super easy thanks to apt packages taking care of us. Default config binds to localhost only and that’s great for us.

apt install redis -y

Install Immich

Now we actually have to install Podman since Immich doesn’t want to distribute their software any other way. Don’t worry, we’re going to convert this into a systemd unit so we can manage it sanely. Make sure you update the password with the one you used earlier!

#Install Podman
apt install podman -y
#Create quadlet directory
mkdir -p /etc/containers/systemd
#Create Immich directories
mkdir -p /var/immich/{config,photos}
#Immich will run as uid/gid 1000 so own those dirs to it
chown 1000:1000 -R /var/immich

Now we’re going to create the podman contaner file, which uses systemd syntax and lets us manage the container with systemd. Edit /etc/containers/systemd/immich.container:

[Unit]
Description=Immich photo manager
After=network-online.target

[Container]
#Basic setup
ContainerName=immich
Network=host
#Environment variables
Environment=TZ=Etc/UTC
Environment=DB_HOSTNAME=::1
Environment=DB_USERNAME=imuser
#Make sure you update this!
Environment=DB_PASSWORD=imuser
Environment=DB_DATABASE_NAME=immich
Environment=REDIS_HOSTNAME=::1
Environment=DISABLE_MACHINE_LEARNING=false
Environment=ENABLE_TYPESENSE=false
#Create photos under user 1000/1000
Environment=PUID=1000
Environment=PGID=1000
#Mounted volumes
Volume=/var/immich/config:/config
Volume=/var/immich/photos:/photos
#Optional: Put the machine-learning models somewhere else if you want
#Volume=/var/immich/ml:/config/machine-learning
#The image itself
Image=ghcr.io/imagegenius/immich:latest

[Service]
#Give it a 15 minutes to start
#Since any image pulls will take a long time
TimeoutStartSec=900

[Install]
# Start on boot
WantedBy=multi-user.target default.target

And finally we can start the new service:

systemctl daemon-reload
#The first time will take awhile since it pulls the image
systemctl start immich

And view logs with journalctl -xeu immich