一、测试环境:
CentOS-7-x86_64-1611
Apache Guacamole 0.9.10
Tomcat 9
二、tomcat安装:
wget http://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M15/bin/apache-tomcat-9.0.0.M15.tar.gz
tar -zxv -f apache-tomcat-9.0.0.M15.tar.gz
mv apache-tomcat-9.0.0.M15 /usr/local/tomcat
三、guacamole服务器安装:
1、依赖安装(必要):
yum install -y cairo-devel libjpeg-turbo-devel libpng-devel uuid-devel
2、依赖安装(非必要):
yum install -y freerdp-devel pango-devel libssh2-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel
3、guacamole安装:
wget http://mirrors.hust.edu.cn/apache/incubator/guacamole/0.9.10-incubating/source/guacamole-server-0.9.10-incubating.tar.gz
tar -zxv -f guacamole-server-0.9.10-incubating.tar.gz
cd guacamole-server-0.9.10-incubating/
./configure --prefix=/usr/local/guacamole --with-init-dir=/etc/init.d
make
make install
ldconfig
四、获取guacamole客户端war文件,并移入tomcat目录
wget http://mirror.bit.edu.cn/apache/incubator/guacamole/0.9.10-incubating/binary/guacamole-0.9.10-incubating.war
cp guacamole-0.9.10-incubating.war /usr/local/tomcat/webapps/guacamole.war
五、配置:
1、增加配置文件 guacamole.properties 及 user-mapping.xml
mkdir /etc/guacamole
touch /etc/guacamole/guacamole.properties
touch /etc/guacamole/user-mapping.xml
2、guacamole.properties 格式:
guacd-hostname: localhost
guacd-port: 4822
3、user-mapping.xml 格式:
<user-mapping>
<!-- 登陆账号密码 -->
<authorize username="admin" password="123456">
<connection name="win">
<protocol>rdp</protocol>
<param name="hostname">192.168.1.2</param>
<param name="port">3389</param>
<!-- 需要链接的服务器的账号密码 -->
<param name="username">administrator</param>
<param name="password">123456</param>
<!-- 大小自动变化 -->
<param name="resize-method">display-update</param>
<!-- 分辨率 -->
<param name="dpi">100</param>
</connection>
<connection name="linux">
<protocol>ssh</protocol>
<param name="hostname">192.168.1.3</param>
<param name="port">22</param>
<!-- 需要链接的服务器的账号密码 -->
<param name="username">root</param>
<param name="password">123456</param>
</connection>
</authorize>
</user-mapping>
4、修改环境变量 /etc/profile:
#最后添加:
export GUACAMOLE_HOME=/etc/guacamole
source /etc/profile
六、启动:
service guacd start #启动guacamole
/usr/local/tomcat/bin/startup.sh #启动tomcat
网页访问localhost:8080/guacamole即可
七、被访问服务器(linux)安装xrdp:
vi /etc/yum.repos.d/xrdp.repo
[xrdp]
name=xrdp
baseurl=http://li.nux.ro/download/nux/dextop/el7/x86_64/
enabled=1
gpgcheck=0
yum -y install xrdp tigervnc-server
#启动服务:
systemctl start xrdp.service
systemctl enable xrdp.service
#防火墙:
firewall-cmd --permanent --zone=public --add-port=3389/tcp
firewall-cmd --reload
#配置SELinux
chcon --type=bin_t /usr/sbin/xrdp
chcon --type=bin_t /usr/sbin/xrdp-sesman
八、被访问服务器(win)配置:
1、开启防火墙
2、远程桌面设置选择:允许运行任意版本远程桌面的计算机连接(较不安全)
九、其他:
1、外网访问,防火墙开启8080端口:
firewall-cmd --permanent --zone=public --add-port=8080/tcp
firewall-cmd --reload
2、源码生成guacamole客户端war文件:
(1)安装maven:
wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
yum install -y apache-maven
(2)安装ant:
yum install -y ant
(3)下载guacamole-client-0.9.10-incubating.tar.gz,生成 war 文件:
wget http://mirror.bit.edu.cn/apache/incubator/guacamole/0.9.10-incubating/source/guacamole-client-0.9.10-incubating.tar.gz
tar -zxv -f guacamole-client-0.9.10-incubating.tar.gz
cd guacamole-client-0.9.10-incubating
mvn package
(4):war文件将会生成在 guacamole-client-0.9.10-incubating/guacamole/target 目录下
3、java环境错误:
(1)、找出目录位置:
[root@localhost ~]# which java
/usr/bin/java
[root@localhost ~]# ls -l /usr/bin/java
lrwxrwxrwx. 1 root root 22 1月 9 13:25 /usr/bin/java -> /etc/alternatives/java
[root@localhost ~]# ls -l /etc/alternatives/java
lrwxrwxrwx. 1 root root 73 1月 9 13:25 /etc/alternatives/java -> /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.111-2.b15.el7_3.x86_64/jre/bin/java
(2)、修改环境变量 /etc/profile:
#最后添加
export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64 #CentOS-7-x86_64-1611
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
source /etc/profile