Immich Guide
In an age where we take pictures of everything and use digital media as a path to look back at memories, Have you ever thought how to safeguard those memories?
Immich is an awesome project that makes it easy to both access, modify, sort and backup your photos and videos. With syncing features and apps available for just every platform you can think of, it is the perfect alternative to google photos.
Buying a VPS
Buy a VPS and install it with Ubuntu 22.04 as this guide follows Ubuntu 22.04.
Login to your VPS via SSH and make sure you're under the root user.
Installing required packages
First we'll start by installing some required packages.
apt update && apt upgrade -y && apt install -y curl nginx certbot python3-certbot-nginx
Next, we can install docker and enable its systemd unit file.
curl -sSL https://get.docker.com/ | CHANNEL=stable bash
systemctl enable --now docker
We have now installed all required packages to run immich.
Initial Configuration
Let's start by creating a dedicated directory for immich and its files. In this guide, we'll be creating it under /home.
mkdir /home/immich-app
Now, We can go to the file and get the docker-compose and the needed .env file.
cd /home/immich-app && wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml && wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
Now we have all the files we'll need to configure and run immich.
Configuring Immich Server
We will now need to do the following things.
- Set the Database password to secure our install. (You may only use
A-Za-z0-9) - Change the timezone. All timezones can be found here: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
Start by opening the .env file.
nano .env
Now, It should look like this:
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=./library
# The location where your database files are stored
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 "v1.71.0"
IMMICH_VERSION=release
# 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
###################################################################################
We will be changing the TZ and DB_PASSWORD.
Uncomment the TZ line and state your timezone. It should look like this:
TZ=Asia/Kolkata
Then, Modify the DB_PASSWORD and set a strong password. It should look like this.
DB_PASSWORD=Th1s1sarand0mpa55w0rd
Now that this is done, You can press Ctrl + X on your keyboard, Then press Enter, Then press Y to exit.
Starting Immich
docker compose up -d
Now our immich server is deployed.
Configuring nginx
Before we continue, Make sure you have a domain that is pointed to the server's IP. For this guide, we'll use immich.crunchbits.net.
Let's create a new config file for nginx.
nano /etc/nginx/conf.d/immich.conf
An empty file should open, Paste the following here:
server {
listen 80;
server_name immich.crunchbits.net;
location / {
proxy_pass http://localhost:2283;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
Change immich.crunchbits.net with the domain you pointed to the server.
Now, we can restart nginx to apply the changes.
nginx -s reload
Securing immich with SSL
We can now generate a free SSL certificate from Let's Encrypt and secure our immich server.
certbot --nginx
Follow what it says on-screen and voila! Our immich is ready!
Now open the website on your browser and create your account.
Note: The first user is always created as the admin user.