2017-04-05 18:33:25 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-03-04 20:24:53 +01:00
|
|
|
# Check if user is root or sudo
|
|
|
|
if ! [ $(id -u) = 0 ]; then echo "Please run this script as sudo or root"; exit 1 ; fi
|
|
|
|
|
2018-03-12 22:54:36 +01:00
|
|
|
# Version number of Guacamole to install
|
2021-01-03 16:16:32 +01:00
|
|
|
GUACVERSION="1.3.0"
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2020-12-27 06:41:33 +01:00
|
|
|
# Different version of Ubuntu/Linux Mint and Debian have different package names...
|
2018-03-12 22:44:55 +01:00
|
|
|
source /etc/os-release
|
2020-12-27 06:41:33 +01:00
|
|
|
if [[ "${NAME}" == "Ubuntu" ]] || [[ "${NAME}" == "Linux Mint" ]]; then
|
2020-03-04 20:24:53 +01:00
|
|
|
# Ubuntu > 18.04 does not include universe repo by default
|
|
|
|
# Add the "Universe" repo, don't update
|
|
|
|
add-apt-repository -yn universe
|
|
|
|
# Set package names depending on version
|
2017-07-29 21:33:15 +02:00
|
|
|
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
|
2020-12-27 06:41:33 +01:00
|
|
|
elif [[ "${NAME}" == *"Debian"* ]] || [[ "${NAME}" == *"Raspbian GNU/Linux"* ]] || [[ "${NAME}" == *"Kali GNU/Linux"* ]] || [[ "${NAME}" == "LMDE" ]]; then
|
2018-03-12 22:44:55 +01:00
|
|
|
JPEGTURBO="libjpeg62-turbo-dev"
|
2020-12-27 06:41:33 +01:00
|
|
|
if [[ "${PRETTY_NAME}" == *"stretch"* ]] || [[ "${PRETTY_NAME}" == *"buster"* ]] || [[ "${PRETTY_NAME}" == *"Kali GNU/Linux Rolling"* ]] || [[ "${NAME}" == "LMDE" ]]; then
|
2018-03-12 22:44:55 +01:00
|
|
|
LIBPNG="libpng-dev"
|
|
|
|
else
|
|
|
|
LIBPNG="libpng12-dev"
|
|
|
|
fi
|
2017-11-12 18:13:45 +01:00
|
|
|
else
|
2020-12-27 06:41:33 +01:00
|
|
|
echo "Unsupported Distro - Ubuntu, Linux Mint, Debian, Kali or Raspbian Only"
|
2020-03-04 20:24:53 +01:00
|
|
|
exit 1
|
2017-11-12 18:13:45 +01:00
|
|
|
fi
|
|
|
|
|
2017-04-05 18:33:25 +02:00
|
|
|
# Install Server Features
|
2020-03-04 20:24:53 +01:00
|
|
|
apt-get -qq update
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2020-07-04 03:24:18 +02:00
|
|
|
apt-get -y install build-essential libcairo2-dev ${JPEGTURBO} ${LIBPNG} libossp-uuid-dev libavcodec-dev libavformat-dev libavutil-dev \
|
2020-02-05 21:24:52 +01:00
|
|
|
libswscale-dev freerdp2-dev libpango1.0-dev libssh2-1-dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev \
|
2020-03-04 20:24:53 +01:00
|
|
|
libvorbis-dev libwebp-dev libwebsockets-dev wget libtool-bin
|
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...
|
2020-03-04 20:24:53 +01:00
|
|
|
if [ $? != 0 ]; then
|
|
|
|
echo "apt-get failed to install all required dependencies."
|
2017-04-05 18:33:25 +02:00
|
|
|
exit
|
|
|
|
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
|
2020-03-04 20:24:53 +01:00
|
|
|
else
|
|
|
|
# Extract Guacamole Files
|
|
|
|
tar -xzf guacamole-server-${GUACVERSION}.tar.gz
|
2017-12-01 18:56:25 +01:00
|
|
|
fi
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2017-08-22 04:50:24 +02:00
|
|
|
# Make Directories
|
2020-03-04 20:24:53 +01:00
|
|
|
mkdir -p /etc/guacamole
|
2017-04-05 18:33:25 +02:00
|
|
|
|
2020-03-04 20:24:53 +01:00
|
|
|
# Install guacd (Guacamole-server)
|
2018-03-12 22:44:55 +01:00
|
|
|
cd guacamole-server-${GUACVERSION}
|
2019-01-23 23:15:59 +01:00
|
|
|
./configure --with-init-dir=/etc/init.d
|
|
|
|
make
|
|
|
|
make install
|
2018-03-12 23:15:26 +01:00
|
|
|
|
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 start guacd
|
2020-03-04 20:24:53 +01:00
|
|
|
systemctl enable guacd
|
2017-04-05 18:33:25 +02:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm -rf guacamole-*
|