设置时区
设置CentOS-Devel.repo
vi /etc/yum.repos.d/CentOS-Devel.repo
enabled=1
安装Java 和 Tomcat
-------------------------------------------------------------------
# Step 1: Installing Java for Tomcat
dnf -y install java-11-openjdk-devel
java --version # Verify that java is installed correctly
# Step 2: Install Tomcat and make it as a system service
export TOMCAT_VER="9.0.30"
groupadd --system tomcat
useradd -d /opt/tomcat -r -s /bin/false -g tomcat tomcat
dnf -y install wget
wget https://archive.apache.org/dist/tomcat/tomcat-9/v${TOMCAT_VER}/bin/apache-tomcat-${TOMCAT_VER}.tar.gz
tar xvf apache-tomcat-${TOMCAT_VER}.tar.gz -C /opt/
rm -f /opt/tomcat
ln -s /opt/apache-tomcat-${TOMCAT_VER}/ /opt/tomcat
chown -R tomcat:tomcat /opt/tomcat
chown -R tomcat:tomcat /opt/apache-tomcat-${TOMCAT_VER}/
cat > /etc/systemd/system/tomcat.service << EOF
[Unit]
Description=Tomcat Server
After=syslog.target network.target
[Service]
Type=forking
User=tomcat
Group=tomcat
#Environment=JAVA_HOME=/usr/lib/jvm/jre
Environment='JAVA_OPTS=-Djava.awt.headless=true'
Environment=CATALINA_HOME=/opt/tomcat
Environment=CATALINA_BASE=/opt/tomcat
Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid
Environment='CATALINA_OPTS=-Xms512M -Xmx1024M'
ExecStart=/opt/tomcat/bin/catalina.sh start
ExecStop=/opt/tomcat/bin/catalina.sh stop
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl start tomcat
systemctl enable tomcat
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
--------------------------------------------------------------------
安装MySQL 8
--------------------------------------------------------------------
dnf install mysql-server
systemctl start mysqld.service
systemctl status mysqld
systemctl enable mysqld
mysql_secure_installation
CREATE DATABASE guacamole DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
create user guacamole@localhost IDENTIFIED BY 'guacamole';
GRANT ALL PRIVILEGES ON guacamole.* TO guacamole@localhost WITH GRANT OPTION;
flush privileges;
--------------------------------------------------------------------
安装Guacamole
--------------------------------------------------------------------
dnf -y install make cmake wget gcc zlib-devel
GUACAMOLE_VER="1.2.0"
MARIADB_VER="2.6.1"
# Let's download the first few Guacamole packages.
cd /tmp
wget -nv --content-disposition http://apache.org/dyn/closer.cgi?action=download\&filename=guacamole/${GUACAMOLE_VER}/binary/guacamole-${GUACAMOLE_VER}.war -O guacamole.war
wget -nv --content-disposition http://apache.org/dyn/closer.cgi?action=download\&filename=guacamole/${GUACAMOLE_VER}/binary/guacamole-auth-jdbc-${GUACAMOLE_VER}.tar.gz -O guacamole-auth-jdbc-${GUACAMOLE_VER}.tar.gz
wget -nv --content-disposition https://downloads.mariadb.com/Connectors/java/connector-java-${MARIADB_VER}/mariadb-java-client-${MARIADB_VER}.jar -O mariadb-java-client-${MARIADB_VER}.jar
# Get prerequisites
## Libtelnet
LIBTELNET_VER="0.23"
cd /usr/local/src
wget https://github.com/seanmiddleditch/libtelnet/releases/download/${LIBTELNET_VER}/libtelnet-${LIBTELNET_VER}.tar.gz
tar -xf libtelnet-${LIBTELNET_VER}.tar.gz
cd libtelnet-${LIBTELNET_VER}
./configure
make && make install
## Libssh2
dnf -y install make cmake gcc openssl-devel
LIBSSH2_VER="1.9.0"
cd /usr/local/src
wget https://github.com/libssh2/libssh2/releases/download/libssh2-${LIBSSH2_VER}/libssh2-${LIBSSH2_VER}.tar.gz
tar -xf libssh2-${LIBSSH2_VER}.tar.gz
cd libssh2-${LIBSSH2_VER}
./configure
make && make install
## libwebsockets
dnf -y install cmake
LIBWEBSOCKETS_VER=3.2.2
cd /usr/local/src
wget https://github.com/warmcat/libwebsockets/archive/v${LIBWEBSOCKETS_VER}.tar.gz -O libwebsockets-${LIBWEBSOCKETS_VER}.tar.gz
tar xf libwebsockets-${LIBWEBSOCKETS_VER}.tar.gz
cd libwebsockets-${LIBWEBSOCKETS_VER}
mkdir build && cd build
cmake ..
make && make install
dnf config-manager --set-enabled PowerTools
dnf -y install gcc cairo-devel libjpeg-turbo-devel libjpeg-devel libpng-devel libtool uuid-devel ffmpeg-devel freerdp-devel pango-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel libssh2-devel libwebsockets-devel libtheora opus lame-libs make
adduser guacd
cd /usr/local/src
wget -nv --content-disposition http://apache.org/dyn/closer.cgi?action=download\&filename=guacamole/${GUACAMOLE_VER}/source/guacamole-server-${GUACAMOLE_VER}.tar.gz -O guacamole-server-${GUACAMOLE_VER}.tar.gz
tar -xzf guacamole-server-${GUACAMOLE_VER}.tar.gz
cd guacamole-server-${GUACAMOLE_VER}
sed -i s/daemon/guacd/ src/guacd/systemd/guacd.service.in
./configure --with-systemd-dir=/etc/systemd/system/
make && make install
ldconfig
# Step 4: Install the client to Tomcat
mkdir -p /etc/guacamole/extensions/
mkdir -p /etc/guacamole/lib
ln -s /etc/guacamole/ /root/.guacamole
cd /tmp
tar -xzf guacamole-auth-jdbc-${GUACAMOLE_VER}.tar.gz
cd guacamole-auth-jdbc-${GUACAMOLE_VER}
mv mysql/guacamole-auth-jdbc-mysql*.jar /etc/guacamole/extensions/
# cat mysql/schema/*.sql | mysql -u root -p guacamole ### Uncomment for new install. Run on a computer with mysql.
rm -Rf guacamole-auth-jdbc-${GUACAMOLE_VER}* # Cleanup
cd /tmp
mv mariadb-java-client-${MARIADB_VER}.jar /etc/guacamole/lib
mv /tmp/guacamole.war /opt/tomcat/webapps # update this location to your tomcat folder
cd /tmp
wget http://apache.org/dyn/closer.cgi?action=download\&filename=guacamole/${GUACAMOLE_VER}/binary/guacamole-auth-ldap-${GUACAMOLE_VER}.tar.gz -O guacamole-auth-ldap-${GUACAMOLE_VER}.tar.gz
tar xf guacamole-auth-ldap-${GUACAMOLE_VER}.tar.gz
mv guacamole-auth-ldap-${GUACAMOLE_VER}/guacamole-auth-ldap-${GUACAMOLE_VER}.jar /etc/guacamole/extensions
rm -Rf guacamole-auth-ldap-${GUACAMOLE_VER}*
firewall-cmd --permanent --add-port=4822/tcp
firewall-cmd --permanent --add-port=8080/tcp
firewall-cmd --reload
systemctl enable guacd
systemctl daemon-reload
systemctl restart guacd
# MySQL properties
mysql-hostname: localhost
mysql-port: 3306
mysql-database: guacamole
mysql-username: guacamole
mysql-password: guacamole
重启动tomcat
systemctl restart tomcat
访问
http://server-ip:8080/guacamole
默认用户名密码都是guacadmin