# Setting up Immich

# Setup

## Set up the server

### Step 1 - Download the required files

Create a directory of your choice (e.g. `./immich-app`) to hold the `docker-compose.yml` and `.env` files.

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk-move-to-the-director"><div class="codeBlockTitle_UNZE">Move to the directory you created</div><div class="codeBlockContent_TgK4"></div></div>```
mkdir ./immich-app
cd ./immich-app

```

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk-"><div class="codeBlockContent_TgK4"><div class="buttonGroup_czYj"><button aria-label="Copy code to clipboard" class="clean-btn" title="Copy" type="button"><span aria-hidden="true" class="copyButtonIcons_IbBy"><svg class="copyButtonIcon_YAb6" viewbox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" fill="currentColor"></path></svg><svg class="copyButtonSuccessIcon_WHhR" viewbox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" fill="currentColor"></path></svg></span></button></div></div></div>Download [`docker-compose.yml`](https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml) and [`example.env`](https://github.com/immich-app/immich/releases/latest/download/example.env) by running the following commands:

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk-get-docker-compose.y"><div class="codeBlockTitle_UNZE">Get docker-compose.yml file</div><div class="codeBlockContent_TgK4"></div></div>```
wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml

```

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk--1"><div class="codeBlockContent_TgK4"><div class="buttonGroup_czYj"><button aria-label="Copy code to clipboard" class="clean-btn" title="Copy" type="button"><span aria-hidden="true" class="copyButtonIcons_IbBy"><svg class="copyButtonIcon_YAb6" viewbox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" fill="currentColor"></path></svg><svg class="copyButtonSuccessIcon_WHhR" viewbox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" fill="currentColor"></path></svg></span></button></div></div></div><div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk-get-.env-file"><div class="codeBlockTitle_UNZE">Get .env file</div><div class="codeBlockContent_TgK4"></div></div>```
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env

```

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk--2"><div class="codeBlockContent_TgK4"><div class="buttonGroup_czYj"><button aria-label="Copy code to clipboard" class="clean-btn" title="Copy" type="button"><span aria-hidden="true" class="copyButtonIcons_IbBy"><svg class="copyButtonIcon_YAb6" viewbox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" fill="currentColor"></path></svg><svg class="copyButtonSuccessIcon_WHhR" viewbox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" fill="currentColor"></path></svg></span></button></div></div></div>You can alternatively download these two files from your browser and move them to the directory that you created, in which case ensure that you rename `example.env` to `.env`.

### Step 2 - Populate the .env file with custom values

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk-default-environmenta"><div class="codeBlockTitle_UNZE">Default environmental variable content</div><div class="codeBlockContent_TgK4"></div></div>```
# 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

```

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk--3"><div class="codeBlockContent_TgK4"><div class="buttonGroup_czYj"><button aria-label="Toggle word wrap" class="clean-btn" title="Toggle word wrap" type="button"><svg aria-hidden="true" class="wordWrapButtonIcon_O7_H" viewbox="0 0 24 24"><path d="M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z" fill="currentColor"></path></svg></button><button aria-label="Copy code to clipboard" class="clean-btn" title="Copy" type="button"><span aria-hidden="true" class="copyButtonIcons_IbBy"><svg class="copyButtonIcon_YAb6" viewbox="0 0 24 24"><path d="M19,21H8V7H19M19,5H8A2,2 0 0,0 6,7V21A2,2 0 0,0 8,23H19A2,2 0 0,0 21,21V7A2,2 0 0,0 19,5M16,1H4A2,2 0 0,0 2,3V17H4V3H16V1Z" fill="currentColor"></path></svg><svg class="copyButtonSuccessIcon_WHhR" viewbox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" fill="currentColor"></path></svg></span></button></div></div></div>- Populate `UPLOAD_LOCATION` with your preferred location for storing backup assets. It should be a new directory on the server with enough free space.
- Consider changing `DB_PASSWORD` to a custom value. Postgres is not publicly exposed, so this password is only used for local authentication. To avoid issues with Docker parsing this value, it is best to use only the characters `A-Za-z0-9`. `pwgen` is a handy utility for this.
- Set your timezone by uncommenting the `TZ=` line.
- Populate custom database information if necessary.

### Step 3 - Start the containers

From the directory you created in Step 1 (which should now contain your customized `docker-compose.yml` and `.env` files), run the following command to start Immich as a background service:

<div class="language-bash codeBlockContainer_F09z theme-code-block" id="bkmrk-start-the-containers"><div class="codeBlockTitle_UNZE">Start the containers</div><div class="codeBlockContent_TgK4"></div></div>```
docker compose up -d
```

All of this documentation can also be found on [https://docs.immich.app/overview/quick-start/](https://docs.immich.app/overview/quick-start/)

# Docker install 1st

Before you install Docker Engine for the first time on a new host machine, you need to set up the Docker `apt` repository. Afterward, you can install and update Docker from the repository.

1. Set up Docker's `apt` repository.
    
    ```bash
    # 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:
    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
    Signed-By: /etc/apt/keyrings/docker.asc
    EOF
    
    sudo apt update
    ```
2. Install the Docker packages.
    
    <div aria-role="tabpanel" class="tabs" x-data="{ selected: 'Latest' }"><div aria-role="tablist" class="tablist"><button class="tab-item border-blue border-b-4 dark:border-b-blue-600">Latest</button> <button class="tab-item">Specific version</button></div><div><div :class="selected !== 'Latest' && 'hidden'" aria-role="tab" class="">  
    </div></div></div>To install the latest version, run:
    
    ```console
     sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
    
    ```
    
    > <div class="admonition-header"><span class="admonition-icon"><svg fill="none" height="24" viewbox="0 0 24 24" width="24"><path d="M12 16V12m0-4H12.01M22 12c0 5.5228-4.4772 10-10 10C6.47715 22 2 17.5228 2 12 2 6.47715 6.47715 2 12 2c5.5228.0 10 4.47715 10 10z" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"></path></svg></span><span class="admonition-title">Note</span></div>The Docker service starts automatically after installation. To verify that Docker is running, use:
    > 
    > ```console
    >  sudo systemctl status docker
    > 
    > ```
    > 
    > Some systems may have this behavior disabled and will require a manual start:
    > 
    > ```console
    >  sudo systemctl start docker
    > 
    > ```
3. Verify that the installation is successful by running the `hello-world` image:
    
    <div class="group mt-2 mb-4 flex w-full scroll-mt-2 flex-col items-start gap-4 rounded bg-gray-50 p-2 outline outline-1 outline-offset-[-1px] outline-gray-200 dark:bg-gray-900 dark:outline-gray-800" data-pagefind-ignore="" x-data="" x-ref="root"><div class="relative w-full"><div class="syntax-light dark:syntax-dark not-prose w-full"><button class="top-1
    absolute right-2 z-10 text-gray-300 dark:text-gray-500" title="copy"><span class="icon-svg hidden group-hover:block"><svg height="48" viewbox="0 -960 960 960" width="48"><path d="M3e2-2e2q-24 0-42-18t-18-42v-560q0-24 18-42t42-18h440q24 0 42 18t18 42v560q0 24-18 42t-42 18H3e2zM180-80q-24 0-42-18t-18-42v-590q0-13 8.5-21.5T150-760t21.5 8.5T180-730v590h470q13 0 21.5 8.5T680-110t-8.5 21.5T650-80H180z"></path></svg></span></button><div class="highlight"></div></div></div></div>```console
     sudo docker run hello-world
    ```