前言
Guacamole 是一个提供了基于 HTML5 web 应用程序的远程桌面代理服务器。通过使用 Guacamole 服务器,我们可以很轻松的在浏览器上远程访问 Guacamole 代理的主机。
1. 配置编译环境
1) 安装 wget 等工具。
yum update yum install wget -y yum install configure -y yum install make -y yum install gcc -y yum install gcc-c++ -y
2) 安装依赖包。
yum -y install cairo-devel libjpeg-turbo-devel libjpeg-devel libpng-devel libtool uuid-devel yum -y install ffmpeg-devel freerdp-devel freerdp1.2-devel pango-devel libssh2-devel yum -y install libtelnet-devel libvncserver-devel libwebsockets-devel pulseaudio-libs-devel yum -y install openssl-devel libvorbis-devel libwebp-devel yum -y install freerdp-plugins
3) 安装 Open JDK。
yum install java-1.8.0-openjdk
4) 安装 Tomcat。
1-执行以下命令,获取 Tomcat 软件包。
cd /usr/local/src wget http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.31/bin/apache-tomcat-9.0.31.tar.gz
2-编译环境配置
1) 解压 Tomcat 软件包。
tar -xvf apache-tomcat-9.0.31.tar.gz
2) 运行 Tomcat。
sh /usr/local/src/apache-tomcat-9.0.31/bin/startup.sh
3) 配置防火墙
firewall-cmd --add-port=8080/tcp --permanent firewall-cmd --add-port=4822/tcp --permanent firewall-cmd --reload
4) 在浏览器中输入 URL:http://服务器 IP 地址:8080 并单击回车。
当出现以下页面,说明 Tomcat 服务器环境配置成功
如果以上 URL 不能访问,请检查主机安全组是否放开 8080 端口。
—-结束
2. 获取源码
1) 下载服务端软件包。
cd /usr/local/src/ wget https://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/1.1.0/source/guacamole-server-1.1.0.tar.gz
2) 获取客户端代码:
cd /usr/local/src/apache-tomcat-9.0.31/webapps/ wget http://mirror.bit.edu.cn/apache/guacamole/1.1.0/binary/guacamole-1.1.0.war
—-结束
3. 编译和安装
1) 解压软件包。
cd /usr/local/src/ tar -zxvf guacamole-server-1.1.0.tar.gz
2) 进入“guacamole-server-1.1.0”安装目录。
cd /usr/local/src/guacamole-server-1.1.0
3) 生成 makefile 文件。
./configure --with-init-dir=/etc/init.d
4) 编译 guacamole-server 源码。
make -j4 make install
4. 运行和验证
1) 创建 guacamole 的配置目录。
mkdir /etc/guacamole
2) 创建“guacamole.properties”和“user-mapping.xml”文件。
cd /etc/guacamole vim guacamole.properties
“guacamole.properties”内容如下:
guacd-port:4822
user-mapping:/etc/guacamole/user-mapping.xml
enable-clipboard-integration: true
vim user-mapping.xml
“user-mapping.xml”内容如下:
<user-mapping> <!-- 每用户身份验证和配置信息 --> <authorize username="admin" password="8520"> <!-- 第一授权连接 --> <connection name="mycentos"> <protocol>ssh</protocol> <param name="hostname">localhost</param> <param name="port">22</param> <param name="username">root</param> <param name="password">123456789</param> </connection> <!-- 第二授权连接 --> <connection name="PLVPS"> <protocol>ssh</protocol> <param name="hostname">1.0.0.9</param> <param name="port">22</param> <param name="username">root</param> <param name="password">123456789</param> </connection> <!-- 第三授权连接 --> <connection name="windows"> <protocol>rdp</protocol> <param name="hostname">1.0.1.9</param> <param name="port">3389</param> <param name="security">tls</param> #连接加密方式。默认使用标准 RDP 加密方式。可选参数:rdp,nla,tls,any 建议设置 tls <param name="ignore-cert">true</param> #如果设置为 true,则忽略服务器返回的证书。 建议 true <param name="enable-drive">true</param> #启用文件传输,需要配合下一条指定路径使用 <param name="drive-path">c:\</param> #Guacamole 服务器上应存储传输文件的目录 <param name="username">administrator</param> <param name="password">123456789</param> </connection> </authorize> <!-- 另一个用户,但使用 md5 哈希密码 (下面的示例使用“ PASSWORD”的 md5 哈希值) --> <authorize username="USERNAME2" password="319f4d26e3c536b5dd871bb2c52e3178" encoding="md5"> </authorize> </user-mapping>
其中 8520 为 Guacamole 的访问密码,123456789 为节点登录密码,请结合实际填写。其他配置选项请参考下文:参考文献 3
4) 执行以下命令, 配置“GUACAMOLE_HOME”环境变量。
echo "export GUACAMOLE_HOME=/etc/guacamole" >> /etc/profile source /etc/profile
5) 重启 guacamole-server。
service guacd restart
6) 重启 Tomcat。
sh /usr/local/src/apache-tomcat-9.0.31/bin/shutdown.sh sh /usr/local/src/apache-tomcat-9.0.31/bin/startup.sh
7) 浏览器访问如下网址。
http://服务器 IP 地址:8080/guacamole-1.1.0
界面显示如下图所示。账号为:admin;密码为:8520
参考文献:1.guacamole 手册
2.guacamole 编译和测试
3.guacamole 配置链接 RDP 参数