11#! /usr/bin/env bash
22
3- # Copyright (c) 2021-2025 tteck
4- # Author: tteck (tteckster)
5- # Co-Author: MickLesk (Canbiz)
3+ # Copyright (c) 2021-2025 community-scripts ORG
4+ # Author: MickLesk (Canbiz)
65# License: MIT
76# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
87# Source: https://github.com/ajnart/homarr
@@ -20,6 +19,7 @@ $STD apt-get install -y \
2019 sudo \
2120 mc \
2221 curl \
22+ redis-server \
2323 ca-certificates \
2424 gnupg \
2525 make \
@@ -30,32 +30,40 @@ msg_ok "Installed Dependencies"
3030msg_info " Setting up Node.js Repository"
3131mkdir -p /etc/apt/keyrings
3232curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
33- echo " deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20 .x nodistro main" > /etc/apt/sources.list.d/nodesource.list
33+ echo " deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_22 .x nodistro main" > /etc/apt/sources.list.d/nodesource.list
3434msg_ok " Set up Node.js Repository"
3535
36- msg_info " Installing Node.js/Yarn "
36+ msg_info " Installing Node.js/pnpm "
3737$STD apt-get update
3838$STD apt-get install -y nodejs
39- $STD npm install -g yarn
40- msg_ok " Installed Node.js/Yarn "
39+ $STD npm install -g pnpm
40+ msg_ok " Installed Node.js/pnpm "
4141
4242msg_info " Installing Homarr (Patience)"
43- RELEASE=$( curl -s https://api.github.com/repos/ajnart/homarr/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
44- wget -q " https://github.com/ajnart/homarr/archive/refs/tags/v${RELEASE} .zip"
43+ cd /opt
44+ RELEASE=$( curl -s https://api.github.com/repos/homarr-labs/homarr/releases/latest | grep " tag_name" | awk ' {print substr($2, 3, length($2)-4) }' )
45+ wget -q " https://github.com/homarr-labs/homarr/archive/refs/tags/v${RELEASE} .zip"
4546unzip -q v${RELEASE} .zip
46- rm -rf v${RELEASE} .zip
4747mv homarr-${RELEASE} /opt/homarr
48+ mkdir -p /opt/homarr_db
49+ touch /opt/homarr_db/db.sqlite
50+ AUTH_SECRET=" $( openssl rand -base64 18 | tr -dc ' a-zA-Z0-9' | cut -c1-13) "
51+ SECRET_ENCRYPTION_KEY=" $( openssl rand -base64 32 | tr -dc ' a-zA-Z0-9' | cut -c1-32) "
52+
4853cat << EOF >/opt/homarr/.env
49- DATABASE_URL="file:./database/db.sqlite"
50- NEXTAUTH_URL="http://localhost:3000"
51- NEXTAUTH_SECRET="$( openssl rand -base64 32) "
52- NEXT_PUBLIC_DISABLE_ANALYTICS="true"
53- DEFAULT_COLOR_SCHEME="dark"
54+ AUTH_SECRET="${AUTH_SECRET} "
55+ DB_DRIVER='better-sqlite3'
56+ SECRET_ENCRYPTION_KEY="${SECRET_ENCRYPTION_KEY} "
57+ DB_URL='/opt/homarr_db/db.sqlite'
58+ TURBO_TELEMETRY_DISABLED=1
59+ NODE_OPTIONS='-r @homarr/log/override'
5460EOF
61+
5562cd /opt/homarr
56- $STD yarn install
57- $STD yarn build
58- $STD yarn db:migrate
63+ $STD pnpm run db:migration:sqlite:run
64+ $STD pnpm build
65+ mkdir build
66+ cp ./node_modules/better-sqlite3/build/Release/better_sqlite3.node ./build/better_sqlite3.node
5967echo " ${RELEASE} " > " /opt/${APPLICATION} _version.txt"
6068msg_ok " Installed Homarr"
6169
@@ -69,18 +77,19 @@ After=network.target
6977Type=exec
7078WorkingDirectory=/opt/homarr
7179EnvironmentFile=-/opt/homarr/.env
72- ExecStart=/usr/bin/yarn start
80+ ExecStart=/usr/bin/pnpm start
7381
7482[Install]
7583WantedBy=multi-user.target
7684EOF
77- systemctl enable -q --now homarr.service
85+ systemctl enable -q --now homarr
7886msg_ok " Created Service"
7987
8088motd_ssh
8189customize
8290
8391msg_info " Cleaning up"
92+ rm -rf /opt/v${RELEASE} .zip
8493$STD apt-get -y autoremove
8594$STD apt-get -y autoclean
8695msg_ok " Cleaned"
0 commit comments