Guacamole之本地安裝Guacamole(二)


摘要

在網上看到一篇Guacamole官方手冊的翻譯,但是找不到后續,於是想自己也翻譯幾篇,有時間的話,會盡量多翻譯一些。 原文地址:http://guacamole.incubator.apache.org/doc/gug/index.html

可本人安裝配置總結后的步驟:http://www.cnblogs.com/ji-yun/p/4982498.html

Guacamole 分為兩個部分:一部分是guacamole-server,它提供guacd 代理和關聯包;另一部分是guacamole-client,它通過servlet容器在Tomcat上給客戶端提供服務。

編譯guacamole-server

       guacamole-server包含所有Guacamole連接遠程桌面所需的本地、服務端組件。它還提供一個通用的C庫——libguac、所有其它本地組建的依賴、以及為每個支持的協議單獨的庫和Guacamole的核心 guacd。,

      guacd是運行在Guacamole服務端上代理服務的守護進程,接收用戶請求Guacamole web應用的隧道連接,然后代替用戶連接遠程桌面。編譯guacd生成可執行文件,它可以手動執行,如果你願意,也可以讓它開機自啟動。

      為了編譯guacamole-server,你需要C編譯器(例如:GCC)以及guacamole-server所依賴的庫。一些依賴是必需的,還有一些是可選擇的。但可選擇的那些依賴可以增加一些額外的特性。

必需依賴

為了編譯guacamole-server,你需要這些包:Cairo, libjpeg, libpng, and the OSSP UUID。這些包在任何情況下都是必須安裝的,沒有它們Guacamole就編譯不了。

庫名

特性

Cairo

Cairo 是被libguac 用來繪圖的. 沒有它Guacamole就實現不了此功能。

Debian / Ubuntu package

libcairo2-dev

Fedora / CentOS / RHEL package

cairo-devel

libjpeg-turbo

libjpeg-turbo 為libguac 提供 JPEG 的支持. 沒有它Guacamole就無法編譯。

Debian / Ubuntu package

libjpeg62-turbo-dev

Fedora / CentOS / RHEL package

libjpeg-turbo-devel

如果libjpeg-turbo 在你的平台上不可用, 並且你不希望用源碼編譯它, libjpeg 也會照常工作,只是速度不會那么快。

Debian / Ubuntu package

libjpeg62-dev

Fedora / CentOS / RHEL package

libjpeg-devel

libpng

libpng 被 libguac 用來寫PNG 圖像, 它是Guacamole 協議使用的核心圖像類型. Guacamole 沒有libpng就不能正常運轉..

Debian / Ubuntu package

libpng12-dev

Fedora / CentOS / RHEL package

libpng-devel

OSSP UUID

OSSP UUID 被libguac 用來設計每一個Guacamole連接唯一的 ID. 這些唯一的ID是連接分享的基礎。

Debian / Ubuntu package

libossp-uuid-dev

Fedora / CentOS / RHEL package

uuid-devel

可選擇依賴

可選擇性的依賴決定Guacamole哪些支持的協議會被安裝,並且決定關於這些協議的額外特性是否可用。

Guacamole目前支持的協議有:VNC、RDP、SSH和telnet。每一種協議對應一個獨立的庫,如果你安裝了它對應的依賴,這些獨立的庫就會隨着guacamole-server被編譯。

VNC的支持依賴於libvncclient,它是libVNCServer的一部分,RDP的支持依賴於FreeRDP 1.0或更高的版本,SSH的支持依賴於libssh2,telnet依賴於libtelnet。Pango是一個字體、文本布局庫,為SSH和telnet提供支持。

Library name

Features

FreeRDP

FreeRDP is required for RDP support. If you do not wish to build RDP support, this library is not needed.

Debian / Ubuntu package

libfreerdp-dev

Fedora / CentOS / RHEL package

freerdp-devel

Pango

Pango is a text layout library which Guacamole's SSH and telnet support uses to render text. If you do not wish to build SSH or telnet support, this library is not needed.

Debian / Ubuntu package

libpango1.0-dev

Fedora / CentOS / RHEL package

pango-devel

libssh2

libssh2 is required for SSH support. If you do not wish to build SSH support, this library is not needed.

Debian / Ubuntu package

libssh2-1-dev

Fedora / CentOS / RHEL package

libssh2-devel

libtelnet

libtelnet is required for telnet support. If you do not wish to build telnet support, this library is not needed.

Debian / Ubuntu package

libtelnet-dev

Fedora / CentOS / RHEL package

libtelnet-devel

libVNCServer

libVNCServer provides libvncclient, which is required for VNC support. If you do not wish to build VNC support, this library is not needed.

Debian / Ubuntu package

libvncserver-dev

Fedora / CentOS / RHEL package

libvncserver-devel

PulseAudio

PulseAudio provides libpulse, which is used by Guacamole's VNC support to provide experimental audio support. If you are not going to be using the experimental audio support for VNC, you do not need this library.

Debian / Ubuntu package

libpulse-dev

Fedora / CentOS / RHEL package

pulseaudio-libs-devel

OpenSSL

OpenSSL provides support for SSL and TLS - two common encryption schemes that make up the majority of encrypted web traffic.

If you have libssl installed, guacd will be built with SSL support, allowing communication between the web application and guacd to be encrypted. This library is also required for SSH support for the sake of manipulating public/private keys.

Without SSL support, there will be no option to encrypt communication to guacd, and support for SSH cannot be built.

Debian / Ubuntu package

libssl-dev

Fedora / CentOS / RHEL package

openssl-devel

libvorbis

libvorbis provides support for Ogg Vorbis - a free and open standard for sound compression. If installed, libguac will be built with support for Ogg Vorbis, and protocols supporting audio will use Ogg Vorbis compression when possible.

Otherwise, sound will only be encoded as WAV (uncompressed), and will only be available if your browser also supports WAV.

Debian / Ubuntu package

libvorbis-dev

Fedora / CentOS / RHEL package

libvorbis-devel

libwebp

libwebp is used by libguac to write WebP images. Though support for WebP is not mandated by the Guacamole protocol, WebP images will be used if supported by both the browser and by libguac.

Lacking WebP support, Guacamole will simply use JPEG in cases that it would have preferred WebP.

Debian / Ubuntu package

libwebp-dev

Fedora / CentOS / RHEL package

libwebp-devel

獲取源代碼

      你可以在Guacamole的項目網站上獲取一份guacamole-server 源碼。最新的穩定發行版是經過了Guacamole小組的測試,認為適合公眾使用的版本。從項目網站上下載的.tar.gz格式壓縮包,可以用過下列命令解壓:

$ git clone git://github.com/glyptodon/guacamole-server.git
Cloning into 'guacamole-server'... remote: Counting objects: 6769, done. remote: Compressing objects: 100% (2244/2244), done. remote: Total 6769 (delta 3058), reused 6718 (delta 3008) Receiving objects: 100% (6769/6769), 2.32 MiB | 777 KiB/s, done. Resolving deltas: 100% (3058/3058), done. $

如果你想得到最新的代碼,並且不關心它沒有經過穩定發行版一樣嚴格的測試,你也可以用Guacamole團隊在Github上的倉庫里克隆一份:

$ git clone git://github.com/glyptodon/guacamole-server.git
Cloning into 'guacamole-server'... remote: Counting objects: 6769, done. remote: Compressing objects: 100% (2244/2244), done. remote: Total 6769 (delta 3058), reused 6718 (delta 3008) Receiving objects: 100% (6769/6769), 2.32 MiB | 777 KiB/s, done. Resolving deltas: 100% (3058/3058), done. $

編譯流程

      當你把guacamole-server源碼下載下來,並且解壓后,就可以運行configure命令。這是一個被GNU Autotools自動觸發的shell腳本,GNU Autotools是一種流行的編譯系統,也被Guacamole 所使用。正在運行的configure 命令會判斷哪些庫在你的系統上有效,並且會根據你所安裝的依賴選擇合適的組件來編譯。                       

 

注意:如果是直接從git上下載的源碼,並不包含configure腳本,因此自動生成源碼沒有包含在工程倉庫中。如果你是從git倉庫中直接下載的源碼,就需要手動生成configure

$ cd guacamole-server/ $ autoreconf -fi $

執行上面的命令會安裝GNU Autotools。

從項目官網上下載的源代碼文檔包含configure腳本和所有其它編譯所需要的文件,因此在編譯的機器上不需要安裝GNU Autotools。

 

一旦你運行了configure 命令,你就能看到已經安裝的庫的列表,它會決定你哪些功能會被編譯:

$ ./configure --with-init-dir=/etc/init.d checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes ... ------------------------------------------------ guacamole-server version 0.9.9
------------------------------------------------ Library status: freerdp ............. yes pango ............... yes libssh2 ............. yes libssl .............. yes libtelnet ........... yes libVNCServer ........ yes libvorbis ........... yes libpulse ............ yes libwebp ............. yes Protocol support: RDP ....... yes SSH ....... yes Telnet .... yes VNC ....... yes Init scripts: /etc/init.d Type "make" to compile guacamole-server. $

上面顯示的--with-init-dir=/etc/init.d命令,為guacd 安裝啟動腳本到/etc/init.d目錄,這樣我們就很容易的在系統啟動后自動運行guacd 配置腳本。如果你不希望guacd 開機自啟動,就去掉 --with-init-dir選項。如果包含你系統發行版的啟動腳本不同於/etc/init.d目錄,就需要用正確的路徑代替/etc/init.d。你也許需要查詢你發行版的文檔,或者對/etc做一個小調查來決定正確的位置。

 

在這里,configure 命令會找到所有的可選擇的依賴包,並根據所安裝的依賴包來編譯所支持的所有協議,甚至在RDP協議下支持Ogg Vorbis 聲音。如果你缺失一些包,上面顯示“yes”的結果會變成“no”。如果一個必需包缺失了,腳本將會徹底運行失敗,並且你需要安裝所缺失的依賴。如果在運行configure 命令后,你發現你想要的一些功能沒有被支持,你就需要安裝相應的依賴並且再運行一次configure 命令。

 

注意:SSH和telnet的正常支持都需要安裝了相應的字體,否則輸出到終端的內容將不能呈現出來。所需要的字體沒有安裝,也照樣會編譯對SHH和telnet的支持,但是在連接的時候會失敗:

Aug 23 14:09:45 my-server guacd[5606]: Unable to get font "monospace"

如果SHH或telnet連接沒有正常工作,你會在系統日志里看到這樣的信息,安裝字體,再次嘗試連接。

 

一旦configure 命令執行完成,只需要鍵入”make”, guacamole-server就會開始編譯:

$ make
Making all in src/libguac
make[1]: Entering directory `/home/zhz/guacamole/guacamole-server/src/libguac'
...
make[1]: Leaving directory `/home/zhz/guacamole/guacamole-server/src/protocols/vnc'
make[1]: Entering directory `/home/zhz/guacamole/guacamole-server'
make[1]: Nothing to be done for `all-am'.
make[1]: Leaving directory `/home/zhz/guacamole/guacamole-server'
$

在編譯所有的組建時,有大量的輸出信息滾動屏幕。

安裝

當以上所有的都完成時,你只需要輸入“make install”來安裝編譯好的組建,然后輸入“ldconfig”來更新你系統安裝庫的緩存:

# make install
Making install in src/libguac
make[1]: Entering directory `/home/zhz/guacamole/guacamole-server/src/libguac'
make[2]: Entering directory `/home/zhz/guacamole/guacamole-server/src/libguac'
...
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/zhz/guacamole/guacamole-server/src/protocols/vnc'
make[1]: Leaving directory `/home/zhz/guacamole/guacamole-server/src/protocols/vnc'
make[1]: Entering directory `/home/zhz/guacamole/guacamole-server'
make[2]: Entering directory `/home/zhz/guacamole/guacamole-server'
make[2]: Nothing to be done for `install-exec-am'.
make[2]: Nothing to be done for `install-data-am'.
make[2]: Leaving directory `/home/zhz/guacamole/guacamole-server'
make[1]: Leaving directory `/home/zhz/guacamole/guacamole-server'
# ldconfig
#   

這時候,所有的都安裝好了,但guacd並沒有運行起來。使用Guacamole 還需要把客戶端組建也安裝好再運行guacd。

注意在安裝guacd和它的自啟動腳本后,你可能仍然需要激活服務來運行自啟動。自啟動的方式因不同發行版系統而不同,但是每一個發行版都會有它的文檔描述如何設置自啟動。

guacamole-client

注意:一般而言,你不需要編譯guacamole-client,因為它是用Java寫的交互平台。你能很輕松的在Guacamole項目官網上獲取最新版本的guacamole-client,包括所有的支持的擴展,不需要你自己編譯。

如果你不想自己用源碼編譯guacamole-client,就直接從項目官網下載guacamole.war,以及任何所需要的擴展,就可以直接跳到“部署Guacamole”部分。

 

guacamole-client包含Guacamole的所有Java和JavaScript組建(guacamole、guacamole-common、guacamole-ext、guacamole-common-js)。這些組建最終組成web應用,為用戶提供HTML5 Guacamole 客戶端服務來連接服務端。該web應用會連接guacamole-server的一部分guacd,來代表用戶連接任何遠程桌面服務,使用戶有權限訪問它。

為了編譯guacamole-client,你還需要安裝Apache Maven和Java JDK。但不是所有人都需要,有的linux發行版已經為你安裝可這些包。

你可以從Guacamole項目的官網上獲取guacamole-client源碼的一個副本。這些發行版是最新代碼的穩定的快照,經過了Guacamole小組的測試,認為適合公眾使用的版本。從項目網站上下載的.tar.gz格式壓縮包,可以用過下列命令解壓:

$ tar -xzf guacamole-client-0.9.9.tar.gz
$ cd guacamole-client-0.9.9/
$

和guacamole-server一樣,如果你想得到最新的代碼,並且不關心它沒有經過穩定發行版一樣嚴格的測試,你也可以用Guacamole團隊在Github上的倉庫里克隆一份:

$ git clone git://github.com/glyptodon/guacamole-client.git
Cloning into 'guacamole-client'...
remote: Counting objects: 12788, done.
remote: Compressing objects: 100% (4183/4183), done.
remote: Total 12788 (delta 3942), reused 12667 (delta 3822)
Receiving objects: 100% (12788/12788), 3.23 MiB | 799 KiB/s, done.
Resolving deltas: 100% (3942/3942), done.
$

不像guacamole-server的是,即使你從git倉庫里獲取了源碼,你也不需要再編譯的時候運行任何程序。在編譯之前不需要運行任何腳本,在源碼中提供了Maven需要的pom.xml文件。

編譯guacamole-client,僅僅需要運行"mvn package"。它會請求Maven自動編譯和打包所有的組建,生成一個簡單的.war文件,它包含了web整個應用。

$ mvn package
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] guacamole-common
[INFO] guacamole-ext
[INFO] guacamole-common-js
[INFO] guacamole
[INFO] guacamole-auth-jdbc
[INFO] guacamole-auth-jdbc-base
[INFO] guacamole-auth-jdbc-mysql
[INFO] guacamole-auth-jdbc-postgresql
[INFO] guacamole-auth-ldap
[INFO] guacamole-auth-noauth
[INFO] guacamole-client
...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] guacamole-common ................................... SUCCESS [  7.566 s]
[INFO] guacamole-ext ...................................... SUCCESS [  5.594 s]
[INFO] guacamole-common-js ................................ SUCCESS [  1.249 s]
[INFO] guacamole .......................................... SUCCESS [  8.474 s]
[INFO] guacamole-auth-jdbc ................................ SUCCESS [  0.592 s]
[INFO] guacamole-auth-jdbc-base ........................... SUCCESS [  2.548 s]
[INFO] guacamole-auth-jdbc-mysql .......................... SUCCESS [  2.557 s]
[INFO] guacamole-auth-jdbc-postgresql ..................... SUCCESS [  1.990 s]
[INFO] guacamole-auth-ldap ................................ SUCCESS [  1.314 s]
[INFO] guacamole-auth-noauth .............................. SUCCESS [  0.961 s]
[INFO] guacamole-client ................................... SUCCESS [  1.721 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 34.701 s
[INFO] Finished at: 2015-06-08T17:03:15-07:00
[INFO] Final Memory: 34M/340M
[INFO] ------------------------------------------------------------------------
$

當Guacamole web應用編譯完成,在當前目錄(你運行mvn時的目錄)的子目錄guacamole/target/ 中就會生成一個.war文件,然后可以發布到一個servlet容器中,例如:Tomcat。

部署Guacamole

Guacamole的web應用部分,是被打包成一個完全獨立的 .war文件。如果你從項目官網下載Guacamole,文件名為 guacamole.war。部署這個文件到你的servlet容器使用.war的目錄中。在Tomcat環境中,這個目錄是CATALINA_HOME/webapps/。這個路徑CATALINA_HOME會因你的Tomcat是如何裝的而變化,但通常是類似於/var/lib/tomcat/var/lib/tomcat7

# cp guacamole.war /var/lib/tomcat/webapps
#

如果你是從源碼編譯的guacamole-client,所需的.war就在guacamole/target/目錄中,並且它的名字會包含一個額外的版本后綴。如Tomcat會根據.war文件來確定web應用程序的路徑,你可以在復制的時候重命名這個文件為guacamole.war:

#cp guacamole/target/guacamole-0.9.9.war  /var/lib/tomcat/webapps/guacamole.war
#

另外,如果你用的不同的servlet容器或者Tomcat安裝在不同的路徑中,你就需要去查看servlet容器或系統發行版的文檔,或者兩者共同決定部署.war文件的路徑,例如:guacamole.war。

一旦.war文件放在了正確的路徑下,你就需要重啟Tomcat來強制Tomcat部署新的web應用程序,並且如果guacd守護進程不是一直保持運行,也必須重啟。在不同的發行版中,重啟Tomcat和guacd的命令也會不同。典型的,你能通過運行相應的初始化腳本來重啟:

# /etc/init.d/tomcat7 restart
Stopping Tomcat... OK
Starting Tomcat... OK
# /etc/init.d/guacd start
Starting guacd: SUCCESS
guacd[6229]: INFO:  Guacamole proxy daemon (guacd) version 0.9.9 started
#

注意:如果你想要開機啟動Guacamole,就需要配置Tomcat和guacd自啟動。你的發行版會提供文檔來做這個。

 

在重啟Tomcat並且啟動guacd之后,Guacamole就成功的安裝好了,即使它沒有完全的運行。在目前的狀態,它還完全沒有配置,下一步就是至少為添加一個用戶,和一些連接。具體請看:Guacamole之配置Guacamole(五)《Chapter 5, Configuring Guacamole.》。

客戶端如何發送消息?

如果你的瀏覽器和servlet容器支持,Guacamole就會自動使用網絡套接字。在Guacamole不能用網絡套接字連接時,它會立刻向用戶透明的回退使用HTTP。

在Guacamole中網絡套接字能被Tomcat7.0.37或更高的版本、Jetty8或更高版本支持,並且任何servlet容器都支持JSR 256,這是Java API對網絡套接字的標准。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM