Proxmox/install/grocy-install.sh

69 lines
2.0 KiB
Bash
Raw Normal View History

#!/usr/bin/env bash
2024-01-01 17:13:05 +00:00
# Copyright (c) 2021-2024 tteck
# Author: tteck (tteckster)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
setting_up_container
network_check
update_os
msg_info "Installing Dependencies"
$STD apt-get install -y curl
$STD apt-get install -y sudo
$STD apt-get install -y mc
$STD apt-get install -y apt-transport-https
msg_ok "Installed Dependencies"
2024-02-18 23:25:35 +00:00
msg_info "Installing PHP8.3"
VERSION="$(awk -F'=' '/^VERSION_CODENAME=/{ print $NF }' /etc/os-release)"
curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
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
$STD apt-get update
2024-02-18 23:40:42 +00:00
$STD apt-get install -y php8.3 php8.3-{cli,bz2,curl,mbstring,intl,sqlite3,fpm,gd,zip,xml}
2024-02-18 23:38:05 +00:00
a2enconf php8.3-fpm
systemctl reload apache2
2024-02-18 23:25:35 +00:00
msg_ok "Installed PHP8.3"
msg_info "Installing grocy"
latest=$(curl -s https://api.github.com/repos/grocy/grocy/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
wget -q https://github.com/grocy/grocy/releases/download/v${latest}/grocy_${latest}.zip
$STD unzip grocy_${latest}.zip -d /var/www/html
chown -R www-data:www-data /var/www/html
cp /var/www/html/config-dist.php /var/www/html/data/config.php
chmod +x /var/www/html/update.sh
cat <<EOF >/etc/apache2/sites-available/grocy.conf
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/public
ErrorLog /var/log/apache2/error.log
<Directory /var/www/html/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
EOF
$STD a2dissite 000-default.conf
$STD a2ensite grocy.conf
$STD a2enmod rewrite
systemctl reload apache2
msg_ok "Installed grocy"
motd_ssh
2023-05-15 11:39:30 +00:00
customize
msg_info "Cleaning up"
$STD apt-get autoremove
$STD apt-get autoclean
rm -rf /root/grocy_${latest}.zip
msg_ok "Cleaned"