Immich is probably the best self hosted and local way to manage, store and view your photos. I've been using it for quite a while now to backup photos from my phone, but in the past I had the NUC doing all the heavy-lifting. In this guide I'm going to pass that off to a better equipped machine and also pass through Quicksync for transcoding videos. I'm also going to set up a dataset in TrueNAS to store all the photos. And of course I'll be doing all of this in Proxmox.
Ubuntu Server Setup
Normally I would prefer to use an LXC instead of a full VM, but Immich suggests using Docker and I don't feel like setting up each service one by one, so that means I'll be doing this in a VM. I really don't like running Docker in an LXC.
Create a new VM in Proxmox (ref)
I'm using Ubuntu 22.04, 4 cores, 4GB of ram and 24GB HDD.
Once that's up and running go through the install process. When it asks if you want any packages pre installed, don't select any, just skip through.
Now you should be logged in and in the terminal.
Update the system
The next two steps are optional, but I'll be using Vim as my text editor and Zsh as my bash. Install some quality-of-life packages
Install oh-my-zsh
Docker
Install Docker Stuff
Add GPG key
Add Docker repo to apt
Update
Check to see that it's ready to go. If you see something like (Installed), you're good to go.
Install
Check
You should see the docker version.
Docker Compose
Docker is cool, but Docker Compose is a better way of using it. Let's get that going now.
Create a directory for Docker Stuff
Install Docker Compose
Set permissions
Check version
You should now see the Docker Compose version. If you've used Docker Compose before and you're used to the command being docker-compose
, just know that they've updated it and the new command is now docker compose
. Everything else should be the same, but there's just no hyphen (-) anymore.
This is where we start to deviate on our own path. My Immich server is going to be storing all the photos on my TrueNAS server, so we need to set up a dataset to hold everything and then link it up with our VM.
TrueNAS
Create a dataset in TrueNAS and set up the permissions as you wish. When developing I tend to set read/write for everyone and only allow specific IP addresses in the NFS rules, but it's up to you.
Set up an NFS share for the dataset you just created and put in the IP address of your Immich VM in the allow list. Or you can just put you local subnet and allow all devices on your network, whatever works for you.
Back on the Immich VM.
NFS
Install nfs-common
Make shared directory for images. I like to keep all my external/network shares in the /mnt
folder.
Obviously replace the next line with the IP address/path of you TrueNAS dataset.
Check that it mounted
In the Filesystem column you should see the IP address of the NAS and the path of the dataset. The Mounted On column should have /mnt/immich-nas
Set the Immich server to mount this folder when it boots up
Add to the bottom of the file
Immich
Now that we're all set up it's finally time to install Immich.
Create a directory for the Docker files
Navigate to the new directory
Download the Docker Compose file
Download the .env file
Download the hardware acceleration file (optional)
Edit the .env file
- Change
UPLOAD_LOCATION
value to/mnt/immich-nas
- Update
DB_PASSWORD
to a random string
Quicksync
Since my Proxmox server is an Intel NUC with Quicksync, I'm going to pass that through to the VM so Immich can use it to transcode. If you aren't going to use Quicksync or don't have it available you can skip this part.
Install some hardware packages
Download/install the Intel Compute-Runtime stuff Follow the steps on this page.
Log in to the Proxmox web ui and add the Intel driver to the VM
- Select the VM
- Go to the Hardware tab
- Click Add > PCI
- Select the Intel graphics driver option
- Stop and restart VM
- SSH back in
Once you're back in the VM, type
ls -l /dev/dri
You should see something like renderD128
listed now.
Go in to the Immich folder with the config files
Edit the hwaccel
file
Uncomment the Intel lines in hwaccel.yml
to pass the folder to the container.
Enable the hwaccel
file in the docker-compose file
At this point the Immich server should be up and running and you should be able to log in/create the admin account by going to
Remote Machine Learning
The Intel NUC is a pretty great server, but I'm planning on throwing a bunch of photos in here and I want to use Immich's facial recognition features. This can really bog down the NUC so I'm going to offload this work to another machine I have in the house that I mainly use for AI/ML/LLM stuff. The Following steps will be done on that computer, which is also running Ubuntu 22.04, but the full desktop version with an RTX 3060 Ti graphics card.
This computer didn't already have Docker installed so I followed the steps above for installing Docker/Docker Compose.
Create a folder for the Docker Compose file
Create the compose file
Edit the file
Add the Following
Save, exit and run the container
You can also add the -d
flag here, but since it's my first time running this I'm going to omit that so I can see the logs.
Open up the Immich web ui and log in as the administrator if you've already set that up. If not just go to http://192.168.X.X:2283
and set up the admin account now.
Once logged in as the administrator, click the Administration
button at the top right and go to Settings > Machine Learning Settings
In the URL textfield, put in the IP address of the machine running the immich-machine-learning
container with the port 3003
.
Save the settings.
In the past I've run in to issues where the Immich logs take up so much space it fills up the VM storage. So I like to set the Log Level to either Error or Fatal once I'm confident everything is working as it should.
And that's that. We've got Immich up and running with all the machine learning stuff offloaded to a computer that can handle it and Quicksync ready to transcode all those stupid hevc (or whatever) files from people with iPhones. Even if you're the only one using it, I still suggest making yourself a new account that isn't the admin account. Keep the admin account just for admin stuff.