安装部署Guacamole,实现网页连接RDP和SSH等

By | 2021年1月16日

目前本站搭建在OVH的服务器上,OVH一到晚高峰连到国内就速度极慢,有时在服务器后台操作时极不顺畅。恰好手上有一台阿里云国际HK试用款,部署Guacamole中转连接OVH,效果还是不错的。
Guacamole只能部署在Linux上,本文以CentOS为例。

首先,先安装一些基本工具和必要的依赖:

yum -y install epel-release && yum -y update && yum -y install wget tar vim unzip git
yum -y install cairo-devel libjpeg-turbo-devel libjpeg-devel libpng-devel uuid-devel gcc gcc-c++
yum -y install ffmpeg-devel  freerdp-devel pango-devel libssh2-devel freerdp-plugins
yum -y install libtelnet-devel libvncserver-devel pulseaudio-libs-devel
yum -y install openssl-devel libvorbis-devel libwebp-devel

然后安装Guacamole服务端:
1、下载Guacamole:

cd /usr/local/src
wget https://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/1.3.0/source/guacamole-server-1.3.0.tar.gz

2、编译:

tar -xzf guacamole-server-1.3.0.tar.gz
cd guacamole-server-1.3.0
./configure --with-init-dir=/etc/init.d

3、编译后进行安装:

make
make install
ldconfig

4、启动Guacamole,会启用4822端口:

/etc/init.d/guacd start

接着安装Guacamole客户端:
1、安装Tomcat:

yum -y install tomcat
cd /usr/share/tomcat/webapps

2、下载客户端war包:

wget https://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/1.3.0/binary/guacamole-1.3.0.war
mv guacamole-1.3.0.war guacamole.war

3、启动Tomcat,会启用8080端口:

systemctl start tomcat

4、配置客户端信息:

mkdir /etc/guacamole
vim /etc/guacamole/guacamole.properties

输入以下内容后保存:

# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port: 4822
enable-clipboard-integration: true

继续配置:

vim /etc/guacamole/user-mapping.xml

输入以下内容:

<user-mapping>
<authorize username="你的登录用户名" password="你的登录密码">
        <connection name="自定义Windows服务器名称">
                <protocol>rdp</protocol>
                <param name="hostname">你的服务器IP</param>
                <param name="port">3389</param>
                <param name="username">Administrator</param>
                <param name="password">你的服务器密码</param>
                <param name="ignore-cert>true</param>
        </connection>
        <connection name="自定义Linux服务器名称">
                <protocol>ssh</protocol>
                <param name="hostname">你的服务器IP</param>
                <param name="port">22</param>
                <param name="username">root</param>
                <param name="password">你的服务器密码</param>
                <param name="color-scheme">white-black</param>
                <param name="enable-sftp">true</param>
        </connection>
</authorize>
</user-mapping>

5、重启Tomcat:

systemctl restart tomcat

至此,Guacamole就已经部署完毕,直接访问以下地址即可WEB连接你的服务器了:

http://你的服务器IP:8080/guacamole/

本文参考于官方网站@Apache Guacamole

发表评论