mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-03-09 23:30:01 +00:00
Keycloak: Update installation script (#2714)
* Update installation script * fixed tar command * fix tar again * fixes * Update keycloak-install.sh
This commit is contained in:
parent
c730b5c009
commit
0ac0cc263e
@ -1,11 +1,11 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 tteck
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
# Author: tteck (tteckster)
|
# Author: tteck (tteckster) | Co-Author: Slaviša Arežina (tremor021)
|
||||||
# License: MIT
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# Source: https://github.com/keycloak/keycloak
|
||||||
|
|
||||||
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
||||||
color
|
color
|
||||||
verb_ip6
|
verb_ip6
|
||||||
catch_errors
|
catch_errors
|
||||||
@ -13,40 +13,51 @@ setting_up_container
|
|||||||
network_check
|
network_check
|
||||||
update_os
|
update_os
|
||||||
|
|
||||||
msg_info "Installing Dependencies (Patience)"
|
msg_info "Installing Dependencies"
|
||||||
$STD apt-get install -y curl
|
$STD apt-get install -y \
|
||||||
$STD apt-get install -y sudo
|
curl \
|
||||||
$STD apt-get install -y mc
|
sudo \
|
||||||
$STD apt-get install -y ca-certificates-java
|
mc \
|
||||||
$STD apt-get install -y openjdk-17-jre-headless
|
gnupg
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Installing OpenJDK"
|
||||||
|
wget -qO- https://packages.adoptium.net/artifactory/api/gpg/key/public | gpg --dearmor >/etc/apt/trusted.gpg.d/adoptium.gpg
|
||||||
|
echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/adoptium.gpg] https://packages.adoptium.net/artifactory/deb bookworm main' >/etc/apt/sources.list.d/adoptium.list
|
||||||
|
$STD apt-get update
|
||||||
|
$STD apt-get install -y temurin-21-jre
|
||||||
|
msg_ok "Installed OpenJDK"
|
||||||
|
|
||||||
|
msg_info "Installing Keycloak"
|
||||||
|
temp_file=$(mktemp)
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
RELEASE=$(curl -s https://api.github.com/repos/keycloak/keycloak/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
msg_info "Installing Keycloak v$RELEASE"
|
wget -q https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz -O $temp_file
|
||||||
cd /opt
|
tar xzf $temp_file
|
||||||
wget -q https://github.com/keycloak/keycloak/releases/download/$RELEASE/keycloak-$RELEASE.tar.gz
|
mv keycloak-$RELEASE /opt/keycloak
|
||||||
$STD tar -xvf keycloak-$RELEASE.tar.gz
|
|
||||||
mv keycloak-$RELEASE keycloak
|
|
||||||
msg_ok "Installed Keycloak"
|
msg_ok "Installed Keycloak"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
service_path="/etc/systemd/system/keycloak.service"
|
cat <<EOF >/etc/systemd/system/keycloak.service
|
||||||
echo "[Unit]
|
[Unit]
|
||||||
Description=Keycloak
|
Description=Keycloak Service
|
||||||
After=network-online.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
User=root
|
User=root
|
||||||
WorkingDirectory=/opt/keycloak
|
WorkingDirectory=/opt/keycloak
|
||||||
ExecStart=/opt/keycloak/bin/kc.sh start-dev
|
ExecStart=/opt/keycloak/bin/kc.sh start-dev
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target" >$service_path
|
WantedBy=multi-user.target
|
||||||
$STD systemctl enable --now keycloak.service
|
EOF
|
||||||
|
systemctl enable -q --now keycloak
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
|
rm -f $temp_file
|
||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleaned"
|
msg_ok "Cleaned"
|
||||||
|
Loading…
Reference in New Issue
Block a user