Table of Contents
- What is Immich
- My machine
- Preparing the machine
- Setting the device up
- Installing Docker
- Installing and configuring Immich
- Post installation
- Keeping the laptop alive
- Advanced Setup
What is Immich
Immich is a free, open source, self-hosted photo and video management solution allowing you to easily back up, organize and manage your photos and videos on your server without sacrificing your privacy.
You can find their website here
My machine
This incredible piece of technology can be used to resurrect old devices, like an IdeaPad S145, from the grave to act as a server for photos and videos.
The noble IdeaPad S145 packs:
- 8Gb RAM
- AMD A9-9425 dual core @ 3.1GHz
- 256GB NVMe Solid State Drives (SSD)
- 1TB Hard Disk Drive (HDD)
These specs are nothing to write home about, but it creates the perfect playground for Immich.
Preparing the machine for its new purpose
The first thing that had to be done was installing Ubuntu Linux onto the machine.
To do this you must have:
- 12GB (or more) USB flash drive
- An internet connection
- BalenaEtcher (Rufus could also be used).
- Go to Ubuntu.com and download the ISO file
- Download balenaEtcher
- Open balenaEtcher and select your USB stick, your ISO file and Hit flash!.
Now that a bootable USB drive has been made, plug it into the target machine. Reboot the machine with the USB drive in it and press the boot menu key (F12, F2, F10, Esc, and F8) for my Lenovo machine it was F12.
In the menu select your USB stick and press enter.
Hopefully everything worked and you are now seeing the home screen of your soon to be new operating system (OS).
You will now be presented with many options and things to select so I would recommend you follow the official Ubuntu installation documentation to ensure you install the OS correctly. The documentation can be found here
One thing I would recommend is, if you have both an SSD and an HDD, installing Linux onto the SSD instead of an HDD, as it improves launch time and allows for greater storage for videos and photos on your HDD.
Mounting the HDD
Now that Linux is installed onto the machine we have to mount the HDD.
If you are planning on storing your Immich files on the same drive that Linux is installed on you can skip this part.
Run these commands to format the disk and mount it:
lsblk # check device names
sudo fdisk /dev/sda # create one partition (sda1)
sudo mkfs.ext4 /dev/sda1 # format partition
sudo mkdir -p /mnt/photos # create mount point
sudo mount /dev/sda1 /mnt/photos # mount partition
We also need to add the drive to /etc/fstab with its UUID to ensure it stays mounted after reboot, to do so run:
sudo blkid /dev/sda1 # get UUID
sudo nano /etc/fstab
In this file add this line at the bottom so that the HDD auto-mounts on reboot:
UUID=YOUR-DISK-UUID /mnt/photos ext4 defaults,nofail 0 2
Now you won't go debugging at 2am wondering why your Immich Docker won't start.
Installing Docker
Immich runs in Docker and therefore we have to install it in order for this to work.
We need to uninstall all old versions that might have ended up on our machine, to do this we run this command:
sudo apt remove $(dpkg --get-selections docker.io docker-compose docker-compose-v2 docker-doc podman-docker containerd runc | cut -f1)
Next, let's set up the Docker repository:
# Add Docker's official GPG key:
sudo apt update
sudo apt install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources
Run these commands to add the repository to Apt sources:
sudo tee /etc/apt/sources.list.d/docker.sources <<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
Now, install the Docker packages:
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
To verify that it is running use:
sudo systemctl status docker
If that is not working it might be disabled by your system and requires a manual start:
sudo systemctl start docker
To verify that the installation is correct run:
sudo docker run hello-world
Installing and configuring Immich
Create a directory of your choice to hold all the needed files. In this case the directory will be called immich-app.
mkdir ./immich-app
Move to the new directory we created, with this command:
cd ./immich-app
Download the required files
We need to get the docker-compose.yml, to do this run this command in our new directory that we created:
wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
Now, get the .env files:
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
Configure the .env file
Now that all the files are installed we need to configure the .env file.
In the Immich directory open up the .env file with the following command:
nano .env
If the previous steps were correctly followed you should see this:
Click to see the .env configuration
# You can find documentation for all the supported env variables at https://docs.immich.app/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./postgres
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC
# The Immich version to use. You can pin this to a specific version like "v2.1.0"
IMMICH_VERSION=v2
# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=postgres
DB_DATABASE_NAME=immich
Update your UPLOAD_LOCATION to the mounting point we created:
UPLOAD_LOCATION=/mnt/photos
Change Etc/UTC to your region's TZ code which can be found here Remember to remove the #
Lastly, change your DB_PASSWORD:
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=postgres
This password will only be used locally but to avoid issues with Docker only use A-Za-z0-9.
To save these changes press ctrl+O then press enter and then finally press ctrl+X
Starting the containers
To start the containers we need to ensure we are in our directory that we made (in my case it is immich-app).
Once you are sure you are in the correct directory run the following command to run Immich as a background service:
docker compose up -d
Congratulations you have just brought your Immich server to life!
Post installation
Now that Immich is up and running we have some things we need to take care of.
Register an admin user
To register an admin user we need to head to the web application, to do this we need to get the machine IP.
To get the machine IP run the following command:
hostname -I
The first IP address will most likely be the one that we will use to access Immich via the web browser.
Now that we have the IP address open up your web browser and head to:
http://<machine-ip-address>:2283
"Click on Getting Started!", follow the prompts to register as the admin user and then log in to the application.
Add an additional user
If you want to add an additional user you can go to Administration > Users then you can click on the Create user button where you will be presented with a dialog to create another account. For more info please refer to the docs
Download the mobile app
Immich has a mobile app available to install from the following sources:
- Google Play Store
- Apple App Store
- F-Droid
- GitHub Releases (apk)
Login to the Mobile App
Once you have opened the mobile app you must enter a server endpoint URL.
This endpoint is the same as the endpoint we use to access Immich on our web browser.
http://<machine-ip-address>:2283
Upload Your Library
Press on the cloud icon on the top right.
You can then select which albums you want to upload.
For more info consult the documentation
Keeping the laptop alive
To ensure the laptop will never shutdown or go to sleep we have to make some changes to it.
Closing the lid
To change what closing the lid does run this command:
sudo nano /etc/systemd/logind.conf
Then uncomment and change these 3 values to 'ignore' to ensure that closing the lid will not put the laptop to sleep (when plugged in or on battery).
HandleLidSwitch=ignore
HandleLidSwitchExternalPower=ignore
HandleLidSwitchDocked=ignore
Now run the following command to restart the system login:
systemctl restart systemd-logind
Docker auto start
To enable Docker auto start run:
sudo systemctl enable docker
Congrats you did it Immich should be up and running now with your server always up. To ensure everything is up and running run:
docker ps
Now, keep it somewhere plugged in on its side (or upside down) to increase airflow!
Advanced Setup
The following things that will be mentioned will be completely optional but recommended to do to ensure the best experience with Immich
Unattended security upgrades
To keep our system secure without manual intervention run:
sudo apt install unattended-upgrades
and then:
sudo dpkg-reconfigure unattended-upgrades
Hit yes when prompted.
Tailscale
Tailscale is an amazing piece of software which will allow you to access your digital library anywhere!
To install tailscale run the following command:
curl -fsSL https://tailscale.com/install.sh | sudo sh
then run:
sudo tailscale up
The output will display a URL that you can use to authenticate to your Tailscale network. To confirm the device is connected, check if it appears in your 'Machines' page in Tailnet.
Now install Tailscale on your mobile device and sign in with the same account you used to authenticate your account with in the previous step.
Run: tailscale ip and remember the IP address
Now to access your Immich when not on your home network go to Profile > Settings > Networking. Enable Automatic URL switching. For Local network press on Use current network (if you are currently on your home network) and then for external network enter http://IP_FROM_TAILSCALE:2283
You will now be able to have access to Immich away from your home network if you are connected to your laptop via tailscale.
SSH
SSH allows you to manage your server remotely. SSH is a life saver for when you can't get to your machine and need to fix something or if you're just too lazy to grab your device from where you stowed it away.
First we need to install openssh-server and enable ssh:
sudo apt install openssh-server
sudo systemctl enable ssh
sudo systemctl start ssh
You can now SSH into the device to do this run:
ssh username@IP_ADDRESS
and when away from your home network you can use tailscale to ssh into it, to do so run:
ssh username@TAILSCALE_IPADDRESS
Uptime Kuma
Uptime Kuma is a lightweight self-hosted monitoring tool that alerts you when your Immich server is down. To implement this software run:
docker run -d \
--name uptime-kuma \
--restart always \
-p 3001:3001 \
-v uptime-kuma:/app/data \
louislam/uptime-kuma:1
If you get a permission denied run this to add your user to the Docker:
sudo usermod -aG docker $USER
and then run the Docker command again.
To access Uptime kuma open your browser and head to:
http://<machine-ip>:3001
Add Immich as a monitor:
- Click add new monitor
- Monitor type: HTTP(s)
- Friendly name can be anything you want it to be
- URL: http://machine-ip:2283
- Interval: Anything you want it to be (60 is recommended)
Conclusion
That is it! If all steps were followed correctly you should now have your server up and running, ready to store all your photos and videos. No more relying on Google Photos or paying for a Google One subscription. If you do want to have a cloud backup solution, Immich allows you to do so, the steps can be found here.



Top comments (0)