guacamole 0.9.9安装与配置

时间:2024-10-04 14:37:38

以下命令很多都需要管理权限,建议使用管理员账号执行,遇到问题可以留言。

Guacamole官网文档介绍翻译:http://www.cnblogs.com/ji-yun/p/5657709.html

1.首先需要安装guacamole所需要的依赖库

  必需安装的库有:Cairolibjpeg-turbolibpngOSSP UUID

   建议用阿里云的源,不然依赖关系可能存在问题。

    若在Debian / Ubuntu系统下执行命令:

sudo apt-get -y --allow install libcairo2-dev libjpeg62-dev libpng12-dev libossp-uuid-dev

    若在Fedora / CentOS / RHEL系统中执行以下命令:

sudo yun -y --allow install cairo-devel libjpeg-turbo-devel libjpeg-devel libpng-devel uuid-devel

  可选择安装的库有:FFmpegFreeRDPPangolibssh2libtelnetlibVNCServerPulseAudioOpenSSLlibvorbislibwebp

    若在Debian / Ubuntu系统下执行命令:

sudo apt-get -y --allow install libavcodec-dev libavutil-dev libswscale-dev libfreerdp-dev libpango1.-dev libssh2--dev libtelnet-dev libvncserver-dev libpulse-dev libssl-dev libvorbis-dev libwebp-dev 

    若在Fedora / CentOS / RHEL系统中执行以下命令:

sudo yun -y --allow install freerdp-devel pango-devel libssh2-devel libtelnet-devel libvncserver-devel pulseaudio-libs-devel openssl-devel libvorbis-devel libwebp-devel

2.安装配置Maven

 (1).安装JAVA

sudo apt-get -y --force-yes install default-jre
sudo apt-get -y --force-yes install default-jdk

 (2).下载Maven

sudo mkdir /data
cd /data
sudo wget http://apache.fayea.com/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz
sudo tar -xzf apache-maven-3.3.-bin.tar.gz

 (3).环境的配置

cd ~ && vim .bashrc

  在文件末尾添加

# set maven environment
export JAVA_HOME=/usr/lib/jvm/java-1.7.-openjdk-amd64
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export M2_HOME=/data/apache-maven-3.3.
export PATH=$M2_HOME/bin:$PATH

  验证环境是否配置好

source .bashrc
mvn --version

  若显示如下,则环境配置成功

Apache Maven 3.3. (bb52d8502b132ec0a5a3f4c09453c07478323dc5; --10T16::+:)
Maven home: /data/apache-maven-3.3.
Java version: 1.7.0_85, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java--openjdk-amd64/jre
Default locale: en_US, platform encoding: ANSI_X3.-
OS name: "linux", version: "3.13.0-68-generic", arch: "amd64", family: "unix"

3.安装配置tomcat

  若在Debian / Ubuntu系统下执行命令:

#下载tomcat
sudo apt-get -y install tomcat8
#配置环境变量
sudo echo "" >> /etc/default/tomcat8
sudo echo "# GUACAMOLE EVN VARIABLE" >> /etc/default/tomcat8
sudo echo "GUACAMOLE_HOME=/etc/guacamole" >> /etc/default/tomcat8

   其中GUACAMOLE_HOME文件夹在后面创建。

4.安装guacamole

 请到官网下载最新稳定版本:http://guacamole.incubator.apache.org/releases/,这里我以暂时最新的0.9.9为例。

  首先是安装guacamole-server

cd ~ && wget http://mirrors.hust.edu.cn/apache/guacamole/0.9.13-incubating/source/guacamole-server-0.9.13-incubating.tar.gz
tar -zxvf guacamole-server-0.9.13-incubating.tar.gz
cd guacamole-server-0.9.13-incubating/
#开机自启动guacd
sudo ./configure --with-init-dir=/etc/init.d
make
make install
ldconfig

  接下来是guacamole-client,以下两种方式,任选一种:

  (1).源码安装

cd ~ && wget http://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/0.9.13-incubating/source/guacamole-client-0.9.13-incubating.tar.gz
tar -zxvf guacamole-client-0.9.13-incubating.tar.gz
cd guacamole-client-0.9.13-incubating/
mvn package #需要下载项目所需要的各种依赖,注意GWF
#部署到Tomcat
cp guacamole/target/guacamole-0.9.13-incubating.war /var/lib/tomcat8/webapps/guacamole.war # Debian / Ubuntu系统中
(或:cp guacamole/target/guacamole-0.9.13-incubating.war /usr/share/tomcat8/webapps/guacamole.war #Fedora / CentOS / RHEL系统中)

  (2).直接使用编译包

cd && wget http://mirrors.tuna.tsinghua.edu.cn/apache/guacamole/0.9.13-incubating/binary/guacamole-0.9.13-incubating.war
#部署到Tomcat
cp guacamole-0.9.13-incubating.war /var/lib/tomcat8/webapps/guacamole.war # Debian / Ubuntu系统中
(或:cp guacamole-0.9.13-incubating.war /usr/share/tomcat8/webapps/guacamole.war #Fedora / CentOS / RHEL系统中)

5.配置guacamole

mkdir -p /etc/guacamole/ && gedit /etc/guacamole/guacamole.properties

  将文件内容改为下面的

# 配置用户映射文件
basic-user-mapping: /etc/guacamole/user-mapping.xml

  编写用户映射配置文件,具体参数配置文档:http://guacamole.apache.org/doc/gug/configuring-guacamole.html

gedit /etc/guacamole/user-mapping.xml

  在配置文件内,按下面的格式输入信息:

<user-mapping>

    <!-- Per-user authentication and config information -->
<authorize username="USERNAME" password="PASSWORD">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port"></param>
<param name="password">VNCPASS</param>
</authorize> <!-- Another user, but using md5 to hash the password
(example below uses the md5 hash of "PASSWORD") -->
<authorize
username="USERNAME2"
password="319f4d26e3c536b5dd871bb2c52e3178"
encoding="md5"> <!-- First authorized connection -->
<connection name="localhost">
<protocol>vnc</protocol>
<param name="hostname">localhost</param>
<param name="port"></param>
<param name="password">VNCPASS</param>
</connection> <!-- Second authorized connection -->
<connection name="otherhost">
<protocol>vnc</protocol>
<param name="hostname">otherhost</param>
<param name="port"></param>
<param name="password">VNCPASS</param>
</connection> </authorize> </user-mapping>

6.重启tomcat,并启动guacd服务

/etc/init.d/tomcat8 restart
/etc/init.d/guacd start

在浏览器地址栏输入 http://localhost:8080/guacamole/,可以看到如下登入界面

guacamole 0.9.9安装与配置