2017-04-05 18:33:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-03-12 22:44:55 +01:00
|
|
|
GUACVERSION="0.9.14"
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2017-07-29 21:33:15 +02:00
|
|
|
# Ubuntu and Debian have different names of the libjpeg-turbo library for some reason...
|
2018-03-12 22:44:55 +01:00
|
|
|
source /etc/os-release
|
|
|
|
if [[ "${NAME}" == "Ubuntu" ]]
|
2017-07-29 21:33:15 +02:00
|
|
|
then
|
|
|
|
JPEGTURBO="libjpeg-turbo8-dev"
|
2018-03-12 22:44:55 +01:00
|
|
|
if [[ "${VERSION_ID}" == "16.04" ]]
|
|
|
|
then
|
|
|
|
LIBPNG="libpng12-dev"
|
|
|
|
else
|
|
|
|
LIBPNG="libpng-dev"
|
|
|
|
fi
|
|
|
|
elif [[ "${NAME}" == *"Debian"* ]]
|
2017-11-12 18:13:45 +01:00
|
|
|
then
|
2018-03-12 22:44:55 +01:00
|
|
|
JPEGTURBO="libjpeg62-turbo-dev"
|
|
|
|
if [[ "${PRETTY_NAME}" == *"stretch"* ]]
|
|
|
|
then
|
|
|
|
LIBPNG="libpng-dev"
|
|
|
|
else
|
|
|
|
LIBPNG="libpng12-dev"
|
|
|
|
fi
|
2017-11-12 18:13:45 +01:00
|
|
|
else
|
2018-03-12 22:44:55 +01:00
|
|
|
echo "Unsupported Distro - Ubuntu or Debian Only"
|
|
|
|
exit
|
2017-11-12 18:13:45 +01:00
|
|
|
fi
|
|
|
|
|
2017-04-05 18:33:25 +02:00
|
|
|
# Install Server Features
|
2017-08-22 04:48:58 +02:00
|
|
|
apt update
|
2017-11-12 18:13:45 +01:00
|
|
|
apt -y install build-essential libcairo2-dev ${JPEGTURBO} ${LIBPNG} libossp-uuid-dev libavcodec-dev libavutil-dev \
|
2017-04-05 18:33:25 +02:00
|
|
|
libswscale-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev \
|
2017-07-22 00:53:17 +02:00
|
|
|
libvorbis-dev libwebp-dev jq curl wget
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2017-08-22 04:48:58 +02:00
|
|
|
# If apt fails to run completely the rest of this isn't going to work...
|
2017-04-05 18:33:25 +02:00
|
|
|
if [ $? != 0 ]
|
|
|
|
then
|
2017-08-22 04:48:58 +02:00
|
|
|
echo "apt failed to install all required dependencies."
|
2017-04-05 18:33:25 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2018-03-12 22:44:55 +01:00
|
|
|
# Hack for gcc7
|
|
|
|
if [[ $(gcc --version | head -n1 | grep -oP '\)\K.*' | awk '{print $1}' | grep "^7" | wc -l) -gt 0 ]]
|
|
|
|
then
|
|
|
|
apt-get -y install gcc-6
|
|
|
|
if [ $? -ne 0 ]
|
|
|
|
then
|
|
|
|
echo "apt-get failed to install gcc-6"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2017-11-12 18:13:45 +01:00
|
|
|
# Set SERVER to be the preferred download server from the Apache CDN
|
2018-03-12 22:44:55 +01:00
|
|
|
SERVER="http://apache.org/dyn/closer.cgi?action=download&filename=guacamole/${GUACVERSION}"
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2018-03-12 22:44:55 +01:00
|
|
|
# Download Guacamole Server
|
|
|
|
wget -O guacamole-server-${GUACVERSION}.tar.gz ${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "Failed to download guacamole-server-${GUACVERSION}.tar.gz"
|
|
|
|
echo "${SERVER}/source/guacamole-server-${GUACVERSION}.tar.gz"
|
2017-12-01 18:56:25 +01:00
|
|
|
exit
|
|
|
|
fi
|
2017-04-05 18:33:25 +02:00
|
|
|
|
|
|
|
# Extract Guacamole Files
|
2018-03-12 22:44:55 +01:00
|
|
|
tar -xzf guacamole-server-${GUACVERSION}.tar.gz
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2017-08-22 04:50:24 +02:00
|
|
|
# Make Directories
|
2017-04-05 18:33:25 +02:00
|
|
|
mkdir /etc/guacamole
|
|
|
|
|
2017-08-22 04:48:58 +02:00
|
|
|
# Install guacd
|
2018-03-12 22:44:55 +01:00
|
|
|
cd guacamole-server-${GUACVERSION}
|
|
|
|
CC="gcc-6" ./configure --with-init-dir=/etc/init.d
|
|
|
|
CC="gcc-6" make
|
|
|
|
CC="gcc-6" make install
|
2017-04-05 18:33:25 +02:00
|
|
|
ldconfig
|
|
|
|
cd ..
|
|
|
|
|
|
|
|
# Configure guacamole.properties
|
|
|
|
echo "[server]" >> /etc/guacamole/guacd.conf
|
|
|
|
echo "bind_host = 0.0.0.0" >> /etc/guacamole/guacd.conf
|
|
|
|
echo "bind_port = 4822" >> /etc/guacamole/guacd.conf
|
|
|
|
|
|
|
|
# Configure startup
|
|
|
|
systemctl enable guacd
|
|
|
|
systemctl start guacd
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm -rf guacamole-*
|