grocy-install.sh 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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 apt-transport-https
  18. msg_ok "Installed Dependencies"
  19. msg_info "Installing PHP 8.1"
  20. VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
  21. curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
  22. echo -e "deb [signed-by=/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $VERSION main" >/etc/apt/sources.list.d/php.list
  23. $STD apt-get update
  24. $STD apt-get install -y php8.1
  25. $STD apt-get install -y libapache2-mod-php8.1
  26. $STD apt-get install -y php8.1-sqlite3
  27. $STD apt-get install -y php8.1-gd
  28. $STD apt-get install -y php8.1-intl
  29. $STD apt-get install -y php8.1-mbstring
  30. msg_ok "Installed PHP 8.1"
  31. msg_info "Installing grocy"
  32. latest=$(curl -s https://api.github.com/repos/grocy/grocy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
  33. wget -q https://github.com/grocy/grocy/releases/download/v${latest}/grocy_${latest}.zip
  34. $STD unzip grocy_${latest}.zip -d /var/www/html
  35. chown -R www-data:www-data /var/www/html
  36. cp /var/www/html/config-dist.php /var/www/html/data/config.php
  37. chmod +x /var/www/html/update.sh
  38. cat <<EOF >/etc/apache2/sites-available/grocy.conf
  39. <VirtualHost *:80>
  40. ServerAdmin webmaster@localhost
  41. DocumentRoot /var/www/html/public
  42. ErrorLog /var/log/apache2/error.log
  43. <Directory /var/www/html/public>
  44. Options Indexes FollowSymLinks MultiViews
  45. AllowOverride All
  46. Order allow,deny
  47. allow from all
  48. </Directory>
  49. </VirtualHost>
  50. EOF
  51. $STD a2dissite 000-default.conf
  52. $STD a2ensite grocy.conf
  53. $STD a2enmod rewrite
  54. systemctl reload apache2
  55. msg_ok "Installed grocy"
  56. motd_ssh
  57. customize
  58. msg_info "Cleaning up"
  59. $STD apt-get autoremove
  60. $STD apt-get autoclean
  61. rm -rf /root/grocy_${latest}.zip
  62. msg_ok "Cleaned"