mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-08 00:39:16 +00:00
Compare commits
2 Commits
7009862251
...
a9a15dc7d5
Author | SHA1 | Date | |
---|---|---|---|
|
a9a15dc7d5 | ||
|
25e50f21b9 |
@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#Copyright (c) 2021-2024 community-scripts ORG
|
#Copyright (c) 2021-2024 community-scripts ORG
|
||||||
# Author: Michel Roegl-Brunner (michelroegl-brunner)
|
# Author: Michel Roegl-Brunner (michelroegl-brunner) | MickLesk (CanbiZ)
|
||||||
# License: MIT
|
# License: MIT
|
||||||
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
@ -41,53 +41,21 @@ $STD apt-get install -y \
|
|||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
msg_info "Setup Apache Tomcat"
|
msg_info "Setup Apache Tomcat"
|
||||||
mkdir /opt/apache-guacamole
|
|
||||||
mkdir /opt/apache-guacamole/tomcat9
|
|
||||||
RELEASE=$(wget -qO- https://dlcdn.apache.org/tomcat/tomcat-9/ | grep -oP '(?<=href=")v[^"/]+(?=/")' | sed 's/^v//')
|
RELEASE=$(wget -qO- https://dlcdn.apache.org/tomcat/tomcat-9/ | grep -oP '(?<=href=")v[^"/]+(?=/")' | sed 's/^v//')
|
||||||
wget -q --directory-prefix=/root/ https://dlcdn.apache.org/tomcat/tomcat-9/v${RELEASE}/bin/apache-tomcat-${RELEASE}.tar.gz
|
mkdir -p /opt/apache-guacamole/tomcat9
|
||||||
$STD tar xzf ~/apache-tomcat-${RELEASE}.tar.gz -C /opt/apache-guacamole/tomcat9 --strip-components=1
|
mkdir -p /opt/apache-guacamole/server
|
||||||
useradd -r -d /opt/tomcat9 -s /bin/false tomcat
|
wget -qO- "https://dlcdn.apache.org/tomcat/tomcat-9/v${RELEASE}/bin/apache-tomcat-${RELEASE}.tar.gz" | tar -xz -C /opt/apache-guacamole/tomcat9 --strip-components=1
|
||||||
chown -R tomcat: /opt/apache-guacamole/tomcat9/{logs,temp,webapps,work}
|
useradd -r -d /opt/apache-guacamole/tomcat9 -s /bin/false tomcat
|
||||||
chown -R :tomcat /opt/apache-guacamole/tomcat9/
|
chown -R tomcat: /opt/apache-guacamole/tomcat9
|
||||||
chmod -R g+r /opt/apache-guacamole/tomcat9/conf
|
chmod -R g+r /opt/apache-guacamole/tomcat9/conf
|
||||||
chmod g+x /opt/apache-guacamole/tomcat9/conf
|
chmod g+x /opt/apache-guacamole/tomcat9/conf
|
||||||
JAVA_HOME=$(update-alternatives --query javadoc | grep Value: | head -n1 | sed 's/Value: //' | sed 's@bin/javadoc$@@')
|
|
||||||
cat <<EOF >/etc/systemd/system/tomcat.service
|
|
||||||
[Unit]
|
|
||||||
Description=Apache Tomcat Web Application Container
|
|
||||||
After=network.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=forking
|
|
||||||
|
|
||||||
Environment="JAVA_HOME=${JAVA_HOME}"
|
|
||||||
Environment="CATALINA_PID=/opt/apache-guacamole/tomcat9/temp/tomcat.pid"
|
|
||||||
Environment="CATALINA_HOME=/opt/apache-guacamole/tomcat9/"
|
|
||||||
Environment="CATALINA_BASE=/opt/apache-guacamole/tomcat9/"
|
|
||||||
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
|
|
||||||
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
|
|
||||||
|
|
||||||
ExecStart=/opt/apache-guacamole/tomcat9/bin/startup.sh
|
|
||||||
ExecStop=/opt/apache-guacamole/tomcat9/bin/shutdown.sh
|
|
||||||
|
|
||||||
User=tomcat
|
|
||||||
Group=tomcat
|
|
||||||
UMask=0007
|
|
||||||
RestartSec=10
|
|
||||||
Restart=always
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
msg_ok "Setup Apache Tomcat"
|
msg_ok "Setup Apache Tomcat"
|
||||||
|
|
||||||
msg_info "Setup Apache Guacamole"
|
msg_info "Setup Apache Guacamole"
|
||||||
mkdir -p /etc/guacamole/{extensions,lib}
|
mkdir -p /etc/guacamole/{extensions,lib}
|
||||||
RELEASE_SERVER=$(curl -sL https://api.github.com/repos/apache/guacamole-server/tags | jq -r '.[0].name')
|
RELEASE_SERVER=$(curl -sL https://api.github.com/repos/apache/guacamole-server/tags | jq -r '.[0].name')
|
||||||
mkdir /opt/apache-guacamole/apache-guacamole-server-${RELEASE_SERVER}
|
wget -qO- https://api.github.com/repos/apache/guacamole-server/tarball/refs/tags/${RELEASE_SERVER} | tar -xz --strip-components=1 -C /opt/apache-guacamole/server
|
||||||
wget -q -O apache-guacamole-server-${RELEASE_SERVER} https://api.github.com/repos/apache/guacamole-server/tarball/refs/tags/${RELEASE_SERVER}
|
cd /opt/apache-guacamole/server
|
||||||
$STD tar -xvf apache-guacamole-server-${RELEASE_SERVER} -C /opt/apache-guacamole/apache-guacamole-server-${RELEASE_SERVER} --strip-components=1
|
|
||||||
cd /opt/apache-guacamole/apache-guacamole-server-${RELEASE_SERVER}
|
|
||||||
$STD autoreconf -fi
|
$STD autoreconf -fi
|
||||||
$STD ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
|
$STD ./configure --with-init-dir=/etc/init.d --enable-allow-freerdp-snapshots
|
||||||
$STD make
|
$STD make
|
||||||
@ -95,9 +63,6 @@ $STD make install
|
|||||||
$STD ldconfig
|
$STD ldconfig
|
||||||
RELEASE_CLIENT=$(curl -sL https://api.github.com/repos/apache/guacamole-client/tags | jq -r '.[0].name')
|
RELEASE_CLIENT=$(curl -sL https://api.github.com/repos/apache/guacamole-client/tags | jq -r '.[0].name')
|
||||||
wget -q -O /opt/apache-guacamole/tomcat9/webapps/guacamole.war https://downloads.apache.org/guacamole/${RELEASE_CLIENT}/binary/guacamole-${RELEASE_CLIENT}.war
|
wget -q -O /opt/apache-guacamole/tomcat9/webapps/guacamole.war https://downloads.apache.org/guacamole/${RELEASE_CLIENT}/binary/guacamole-${RELEASE_CLIENT}.war
|
||||||
msg_ok "Setup Apache Guacamole"
|
|
||||||
|
|
||||||
msg_info "Setup Databas"
|
|
||||||
cd /root
|
cd /root
|
||||||
wget -q --directory-prefix=/root/ https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz
|
wget -q --directory-prefix=/root/ https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-8.0.26.tar.gz
|
||||||
$STD tar -xf ~/mysql-connector-java-8.0.26.tar.gz
|
$STD tar -xf ~/mysql-connector-java-8.0.26.tar.gz
|
||||||
@ -105,9 +70,9 @@ mv ~/mysql-connector-java-8.0.26/mysql-connector-java-8.0.26.jar /etc/guacamole/
|
|||||||
wget -q --directory-prefix=/root/ https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-jdbc-1.5.5.tar.gz
|
wget -q --directory-prefix=/root/ https://downloads.apache.org/guacamole/1.5.5/binary/guacamole-auth-jdbc-1.5.5.tar.gz
|
||||||
$STD tar -xf ~/guacamole-auth-jdbc-1.5.5.tar.gz
|
$STD tar -xf ~/guacamole-auth-jdbc-1.5.5.tar.gz
|
||||||
mv ~/guacamole-auth-jdbc-1.5.5/mysql/guacamole-auth-jdbc-mysql-1.5.5.jar /etc/guacamole/extensions/
|
mv ~/guacamole-auth-jdbc-1.5.5/mysql/guacamole-auth-jdbc-mysql-1.5.5.jar /etc/guacamole/extensions/
|
||||||
msg_ok "Setup Databse"
|
msg_ok "Setup Apache Guacamole"
|
||||||
|
|
||||||
msg_info "Setup Service"
|
msg_info "Setup Database"
|
||||||
DB_NAME=guacamole_db
|
DB_NAME=guacamole_db
|
||||||
DB_USER=guacamole_user
|
DB_USER=guacamole_user
|
||||||
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13)
|
||||||
@ -130,6 +95,32 @@ cat *.sql | mysql -u root ${DB_NAME}
|
|||||||
echo "mysql-password: $DB_PASS"
|
echo "mysql-password: $DB_PASS"
|
||||||
|
|
||||||
} >> /etc/guacamole/guacamole.properties
|
} >> /etc/guacamole/guacamole.properties
|
||||||
|
msg_ok "Setup Database"
|
||||||
|
|
||||||
|
msg_info "Setup Service"
|
||||||
|
JAVA_HOME=$(update-alternatives --query javadoc | grep Value: | head -n1 | sed 's/Value: //' | sed 's@bin/javadoc$@@')
|
||||||
|
cat <<EOF >/etc/systemd/system/tomcat.service
|
||||||
|
[Unit]
|
||||||
|
Description=Apache Tomcat Web Application Container
|
||||||
|
After=network.target
|
||||||
|
[Service]
|
||||||
|
Type=forking
|
||||||
|
Environment="JAVA_HOME=${JAVA_HOME}"
|
||||||
|
Environment="CATALINA_PID=/opt/apache-guacamole/tomcat9/temp/tomcat.pid"
|
||||||
|
Environment="CATALINA_HOME=/opt/apache-guacamole/tomcat9/"
|
||||||
|
Environment="CATALINA_BASE=/opt/apache-guacamole/tomcat9/"
|
||||||
|
Environment="CATALINA_OPTS=-Xms512M -Xmx1024M -server -XX:+UseParallelGC"
|
||||||
|
Environment="JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom"
|
||||||
|
ExecStart=/opt/apache-guacamole/tomcat9/bin/startup.sh
|
||||||
|
ExecStop=/opt/apache-guacamole/tomcat9/bin/shutdown.sh
|
||||||
|
User=tomcat
|
||||||
|
Group=tomcat
|
||||||
|
UMask=0007
|
||||||
|
RestartSec=10
|
||||||
|
Restart=always
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
systemctl -q enable --now tomcat guacd mysql
|
systemctl -q enable --now tomcat guacd mysql
|
||||||
msg_ok "Setup Service"
|
msg_ok "Setup Service"
|
||||||
|
|
||||||
@ -137,10 +128,8 @@ motd_ssh
|
|||||||
customize
|
customize
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
msg_info "Cleaning up"
|
||||||
$STD rm ~/mysql-connector-java-8.0.26.tar.gz
|
rm -rf ~/mysql-connector-java-8.0.26{,.tar.gz}
|
||||||
$STD rm -rf ~/mysql-connector-java-8.0.26
|
rm -rf ~/guacamole-auth-jdbc-1.5.5{,.tar.gz}
|
||||||
$STD rm ~/guacamole-auth-jdbc-1.5.5.tar.gz
|
|
||||||
$STD rm -rf ~/guacamole-auth-jdbc-1.5.5
|
|
||||||
$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"
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"categories": [
|
"categories": [
|
||||||
11
|
11
|
||||||
],
|
],
|
||||||
"date_created": "2024-12-02",
|
"date_created": "2024-12-19",
|
||||||
"type": "ct",
|
"type": "ct",
|
||||||
"updateable": false,
|
"updateable": false,
|
||||||
"privileged": false,
|
"privileged": false,
|
||||||
|
Loading…
Reference in New Issue
Block a user