Apache Guacamole安装(centos6.*)
一、安装jdk,以jdk-8u161-linux-x64.tar.gz为例 下载地址:http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
(1)创建目录
mkdir /usr/java/
(2)下载jdk包,解压至目录下,更名为jdk1.8
tar xf jdk-8u161-linux-x64.tar.gz -C /usr/java/
mv jdk1.8.0_161 jdk1.8
(3)修改环境变量
vim /etc/profile
JAVA_HOME=/usr/java/jdk1.8
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/jre/lib/ext:$JAVA_HOME/lib/tools.jar
export PATH JAVA_HOME CLASSPATH
(4)立即生效
source /etc/profile
二、安装配置tomcat,以apache-tomcat-7.0.88.tar.gz为例 下载地址:https://tomcat.apache.org/download-70.cgi
(1)下载tomcat包,解压至/var/lib/目录下,更名为tomcat7
tar xf apache-tomcat-7.0.88.tar.gz -C /var/lib/
mv apache-tomcat-7.0.88 tomcat7
(2)修改tomcat启动脚本
vim /var/lib/tomcat7/bin/daemon.sh
# chkconfig: 2345 20 80
JAVA_HOME=/usr/java/jdk1.8
CATALINA_HOME=/var/lib/tomcat7
CATALINA_OPTS="-Xms1024m -Xmx4096m -XX:PermSize=256m -XX:MaxPermSize=512m"
(3)安装common-deamon,以commons-daemon-1.1.0-native-src.tar.gz为例,下载地址:http://commons.apache.org/proper/commons-daemon/download_daemon.cgi
Apache common deamon是用来提供java服务的安装,实现将一个普通的 Java 应用变成系统的一个后台服务
先安装gcc,因为编译的时候要用到
yum install gcc
tar commons-daemon-1.1.0-native-src.tar.gz
cd /root/commons-daemon-1.1.0-native-src/unix
./configure
make
cp jsvc /var/lib/tomcat7/bin/
创建tomcat用户,用来运行tomcat服务,并将其目录下的文件属组属主为tomcat
useradd -s /sbin/nologin tomcat
chown -R tomcat.tomcat /var/lib/tomcat7/
复制daemon.sh至/etc/init.d启动目录,更名为tomcat7,设置开机自启
cp /var/lib/tomcat7/bin/daemon.sh /etc/init.d/tomcat7
chmod 755 /etc/init.d/tomcat7
chkconfig --add tomcat7
检查开机启动情况
chkconfig --list | grep tomcat7
三、安装必要的库
yum -y install cairo-devel libjpeg-turbo-devel libjpeg-devel libpng-devel uuid-devel freerdp-devel pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel
四、下载安装guacamole-server 以guacamole-server-0.9.14.tar.gz为例 下载地址:http://guacamole.apache.org/releases/0.9.14/ 注意:要安装最新版本,不然会出现无法登陆的情况
tar xf guacamole-server-0.9.14.tar.gz
cd guacamole-server-0.9.14.tar.gz
./configure --with-init-dir=/etc/init.d
make && make install
ldconfig
至此 guacamole-server已经搭建好了
五、guacamole客户端的安装,直接去官方下载就好 guacamole-0.9.14.war 下载地址:http://guacamole.apache.org/releases/0.9.14/
cp guacamole-0.9.14.war /var/lib/tomcat7/webapps/guacamole.war
/etc/init.d/tomcat7 stop
/etc/init.d/tomcat7 start
/etc/init.d/guacd restart
现在在浏览器里输入 http://ip:8080/guacamole 你就能看到guacamole的界面了
六、配置guacamole的配置文件
(1)新建目录,创建以下配置文件
mkdir /etc/guacamole
touch guacamole.properties user-mapping.xml
(2)vim guacamole.properties
# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port: 4822
user-mapping:/ect/guacamole/user-mapping.xml
(3) vim user-mapping.xml
<user-mapping>
<authorize username="admin" password="admin"> #web登陆guacamole的用户和密码
<connection name="rdp"> #远程桌面协议
<protocol>rdp</protocol>
<param name="hostname">172.29.12.11</param>
<param name="port">3389</param>
<param name="username">hu.li</param>
<param name="password">test123</param>
</connection>
<connection name="telnet">
<protocol>telnet</protocol>
<param name="hostname">172.29.0.2</param>
<param name="port">23</param>
<param name="username">test</param>
<param name="password">test123</param>
</connection>
</authorize>
</user-mapping>
(4)创建目录 /usr/share/tomcat7/.guacamole 并配置文件建立软连接
mkdir -pv /usr/share/tomcat7/.guacamole
ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat7/.guacamole/
(5)添加 guacamole家目录的环境变量,并让其立即生效
vim /etc/profile
GUACAMOLE_HOME=/etc/guacamole
export PATH JAVA_HOME CLASSPATH GUACAMOLE_HOME
source /etc/profile
七、重启tomcat和guacd
/etc/init.d/tomcat7 stop
/etc/init.d/tomcat7 start
/etc/init.d/guacd restart
至此,整个guacamole已经大功告成了,登陆http://ip:8080/guacamole 用户名:admin 密码:admin