homarr-install.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #!/usr/bin/env bash
  2. # Copyright (c) 2021-2023 tteck
  3. # Author: tteck (tteckster)
  4. # License: MIT
  5. # https://github.com/tteck/Proxmox/raw/main/LICENSE
  6. source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
  7. color
  8. verb_ip6
  9. catch_errors
  10. setting_up_container
  11. network_check
  12. update_os
  13. msg_info "Installing Dependencies"
  14. $STD apt-get install -y curl
  15. $STD apt-get install -y sudo
  16. $STD apt-get install -y mc
  17. $STD apt-get install -y git
  18. $STD apt-get install -y ca-certificates
  19. $STD apt-get install -y gnupg
  20. msg_ok "Installed Dependencies"
  21. msg_info "Setting up Node.js Repository"
  22. mkdir -p /etc/apt/keyrings
  23. curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
  24. echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" >/etc/apt/sources.list.d/nodesource.list
  25. msg_ok "Set up Node.js Repository"
  26. msg_info "Installing Node.js"
  27. $STD apt-get update
  28. $STD apt-get install -y nodejs
  29. $STD npm install next
  30. $STD npm instal react
  31. $STD npm instal react-dom
  32. msg_ok "Installed Node.js"
  33. msg_info "Installing Yarn"
  34. $STD npm install -g yarn
  35. $STD yarn global add prisma
  36. msg_ok "Installed Yarn"
  37. msg_info "Installing Homarr (Patience)"
  38. git clone -q https://github.com/ajnart/homarr.git /opt/homarr
  39. cd /opt/homarr
  40. cat <<EOF >/opt/homarr/.env
  41. # Since the ".env" file is gitignored, you can use the ".env.example" file to
  42. # build a new ".env" file when you clone the repo. Keep this file up-to-date
  43. # when you add new variables to `.env`.
  44. # This file will be committed to version control, so make sure not to have any
  45. # secrets in it. If you are cloning this repo, create a copy of this file named
  46. # ".env" and populate it with your secrets.
  47. # When adding additional environment variables, the schema in "/src/env.js"
  48. # should be updated accordingly.
  49. # Prisma
  50. # https://www.prisma.io/docs/reference/database-reference/connection-urls#env
  51. DATABASE_URL="file:../database/db.sqlite"
  52. # Next Auth
  53. # You can generate a new secret on the command line with:
  54. # openssl rand -base64 32
  55. # https://next-auth.js.org/configuration/options#secret
  56. # NEXTAUTH_SECRET=""
  57. NEXTAUTH_URL="http://localhost:3000"
  58. NEXTAUTH_SECRET="1234"
  59. EOF
  60. $STD yarn install
  61. $STD yarn build
  62. msg_ok "Installed Homarr"
  63. msg_info "Creating Service"
  64. cat <<EOF >/etc/systemd/system/homarr.service
  65. [Unit]
  66. Description=Homarr Service
  67. After=network.target
  68. [Service]
  69. Type=exec
  70. WorkingDirectory=/opt/homarr
  71. EnvironmentFile=-/opt/homarr/.env
  72. ExecStart=/usr/bin/yarn start
  73. [Install]
  74. WantedBy=multi-user.target
  75. EOF
  76. systemctl enable -q --now homarr.service
  77. msg_ok "Created Service"
  78. motd_ssh
  79. customize
  80. msg_info "Cleaning up"
  81. $STD apt-get autoremove
  82. $STD apt-get autoclean
  83. msg_ok "Cleaned"