In ubuntu in building guacamole

[Write on August 15, 2016]

[Since I do not have time to try to build working under other linux systems, so this post for only in the case of ubuntu set up under the guacamole]

Before building guacamole, you need to be ready operating system environment, if feasible, is recommended to install the latest version of ubuntu (I use an older version (12.04), when built, encountered a number of dependencies too old and not compatible with the problem, after changing the latest version of ubuntu16.04, these problems did not happen again). Here are two ways to install, you can choose one according to their needs.

 

Before you begin, first understand guacamole architecture. The picture from the guacamole official website (http://guacamole.incubator.apache.org/). In the tutorial official website, the entire project is divided into two parts guacamole, guacamole-client and guacamole-server. In the official website of the tutorial, this picture is in the guacd guacamole-server, Container in the Servlet in this picture is the Guacamole guacamole-client (Why so it is my understanding that:? Guacd after compiled, as a daemon , independent operation. it is responsible for the specific RDP Server / VNC Server and other communication. the Servlet Container in the Guacamole is sent to the browser as the ultimate client interaction with the server guacd).

 

 

0.5 System Overview

 

 

guacamole as a proxy, is connected anywhere RDP server (guacamole and rdp server can be on the same machine). Phone and PC, as long as the browser, and the browser supports HTML5, you can access guacamole proxy browser.

 

1. The most simple installation

 

The first is one of the most simple installation process, a total of three steps.

1 $ apt-get install guacamole-tomcat

Then set the web container (here tomcat7, it may be a different version of tomcat, it may also be other web container). This tells tomcat, where guacamole.war (this war package and its configuration file is guacamole-client) as well as its configuration file.

1  $ ln -s /var/lib/guacamole/guacamole.war /var/lib/tomcat7/webapps
2  $ ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat7/.guacamole

 Then set up a profile, which is to tell the guacamole-client, what setting is. guacamole-client configuration file has two. guacamole.properties and user-mapping.xml. The former tells guacamole-client, guacd (guacamole-server) address and port number, and the location of user-mapping.xml and so on. The latter is mainly set up a user name and password when end users log in guacamole, and, ultimately RDP Server guacamole to be accessed / VNC Server ip address and password. In the simplest installation method, guacamole.properties they have configured, without modification, only need to modify the content of user-mapping.xml. Let's look at the contents of user-mapping.xml.

<user-mapping>
  <authorize 
  username="guacamoleusername" 
  password="5f4dcc3b5aa765d61d8327deb882cf99" 
  encoding="md5">
    <connection name="SSH1">
      <protocol>ssh</protocol>
      <param name="hostname">192.168.0.18</param>
      <param name="port">22</param>
      <param name="username">gacanepa</param>
    </connection>
    <connection name="RDP2">
      <protocol>rdp</protocol>
      <param name="hostname">192.168.0.19</param>
      <param name="port">3389</param>
      <param name="password">123456</param>
    </connection>
  </authorize>
</user-mapping>

<Authorize> tag of, username and password are the user login guacamole in the browser when the required user name and password. Here is the string password "password" of md5 value (where you can also set the parameter password in plain text, then do not encoding = "md5"). Subsequent <connection> tag is the ip address and access protocols and access password to access the RDP Server / VNC Server in. If the final RDP Server / VNC Server without a password, you can not <connection> where <param name = "password"> item. <Connection> item can have one or more (in this example there are two), guacamole supports multiple connections, this effect can be seen from the official web page of the video presentation.

 

Here, the most simple installation is complete.

(I, only when installed in ubuntu12.04 had the most simple to install, this time, this is the easiest way to install the module does not support .rdp proxy rdp agents are not included. Then ubuntu16.04 , there is no attempt to install the most simple, is not clear at this time whether to support the simplest installation rdp agent)

Here's the simplest installation support vnc. Configuring anywhere in the <connection> in a VNC Server is possible. Just make sure VNC Server can access it. I am here on this machine vnc4server used.

If you're like me, ubuntu is also accessible in the vnc4server, to do a set in advance. Open Desktop Sharing settings (Chinese can search desktop sharing). Select allow "others to view your desktop." Also lower "must be on each visit to this machine will be confirmed," this one, if not checked, each remote connection, a screen will pop up asking if you allow, every time you need to come in on this machine here manually click OK to confirm. So according to your own security needs, set this option. (Under the second map from: http: //itoedr.blog.163.com/blog/static/12028429720149113614962/)

 

 

Start vnc4server

$ vnc4server

Start guacd (guacamole-server)

$ guacd

Restart tomcat (guacamole-client)

$ sudo /etc/init.d/tomcat7 restart

Then you can visit in the browser. E.g

127.0.0.1:8080/guacamole

Here's ip address, you run into the address of guacamole. Then the following interface will appear, here enter the user name <authorize> tag set "guacamoleusername" and the password "password" (I am in this picture is my username and password, you changed like you set up) .

You can log into it.

 

These are deployed guacamole by the most simple installation, and then process it as vnc agent.

A If the machine to access the machine B, the case of access failure occurs. You can first try to ping it and see if the two machines communicate, but if you can not communicate with the network and no problem. Then try to turn off the firewall try the ubuntu (firewall turned off at your own risk).

 

$ sudo ufw disable

 

 

2. The source code compiler installation

 

2.1guacamole-server (guacd) compiled and installed

 

源代码编译安装可以自由选择自己需要或者不需要的功能。我这里是把全部的功能都编译进去。

约束:ubuntu16.04 tomcat7 openjdk-8-jdk(一般来说,用最新版的就好了)。tomcat请自行安装。

 

先编译guacd。也就是guacamole-server的部分。首先需要先安装依赖项。最好各个依赖项都安装最新的版本(其完整的依赖项列表参见官网http://guacamole.incubator.apache.org/doc/gug/installing-guacamole.html)。按如下方式安装依赖项

$ sudo apt-get install libcairo2-dev libjpeg62-dev libpng12-dev libossp-uuid-dev libfreerdp-dev libpango1.0-dev libssh2-1-dev libssh-dev

 然后去官网下载,稳定版的源代码。注意,可以通过git clone的方式,直接从github里克隆出来编译,但是那是最新的版本,未经过完全测试,编译的时候可能会有更大概率出问题,如果不是非常确定和必要,建议直接从官网提供的下载链接里下载,这是经过充分测试的版本,最大限度提供了对不同环境的适应性。在 http://guacamole.incubator.apache.org/releases/0.9.9/ 可以找到下载链接。我下载的是,截至目前,官网首页发布的稳定版。

下载之后,解压(下载时存储文件的位置,解压后的位置,其实都不重要,因为编译流程完成后,自动就把文件放置到了合适的位置,无需手手动去把文件放置到某个确定的位置)。然后进入到guacamole-server的目录

$ cd guacamole-server/

 然后,执行configure命令,它的工作包括检查各个依赖项的情况。

$ ./configure --with-init-dir=/etc/init.d

 

( 这里跟的参数的意思是,把guacd加入到随系统启动的列表中。)

这个命令运行的时候,会有许多输出,也会执行一会儿时间,保持耐心。最重要的信息,它会最后输出。不必担心它快速滚动的很多内容没看见。最后会出现如下图的界面。

这里可以看到,所有的依赖项都yes,表示这些依赖项都准备好了。(这里并不是每个都是必须的,如果你不需要的功能是no,也没关系。不过依赖项里有必要项,必要项是不能缺少的,至于哪些是必要项,官网的依赖项列表里有说明)。如果某一项是no,而你又需要,可以直接通过关键字搜索。安装对应的库。这里要注意,每个库最好都安装最新的。因为我编译的时候,遇到过因为某个库版本太旧而导致运行失败的问题。

 

然后

$ make 

 

然后

$ make install 

 

到这里guacamole-server安装好了。然后执行ldconfig来更新安装库的时候的缓存

$ ldconfig

然后,就可以

$ guacd

来运行guacd(下次系统启动的时候,guacd会随着系统自动启动)。

 

2.2 guacamole-client的打包和安装 

 

2.2.1直接使用打包好的guacamole.war文件

然后是guacamole-client的部分。也就是web容器里的部分。这里其实有个简单的方法。就是在官网下载guacamole-0.9.9.war。然后直接放置使用就可以了。因为guacamole-client其实并不需要编译。它只是需要一个打包过程。而这个.war文件就是打包好的文件。

 

如果是按照直接下载这个guacamole-0.9.9.war的方式。那么,下载好之后(随便下载到某个位置)。目的是告诉tomcat,guacamole-client(也就是guacamole-0.9.9.war)在哪里。可以通过创建软链接的方式,也可以通过直接把.war文件拷贝过去的方式。这里使用直接把.war文件拷贝过去的方式。

$ cp /Downloads/guacamole/guacamole-0.9.9.war /var/lib/tomcat7/webapps/guacamole.war

注意,拷贝过去后,文件名一定要改为guacamole.war。

2.2.2手动打包

 

如果却有必要,可以下载guacamole-client的源码手动打包。最好使用与guacamole-server相同的版本。在官网下载稳定版的guacamole-client的源码(http://guacamole.incubator.apache.org/releases/0.9.9/)。

然后,解压缩。进入到这个目录

$ cd  guacamole-client-0.9.9/

 

然后执行

$ mvn package 

 

打包成功后,会输出build success的信息。打包完成后,在当前目录的子目录guacamole/target(也就是guacamole-client-0.9.9/guacamole/target)中,有guacamole-0.9.9.war文件。按照2.2.1的方式,将其放置到tomcat容器中。记得改名字。

 

2.2.3配置guacamole-client

 

然后就是,最简安装方式里也提到过的配置文件的问题。guacamole.properties 和user-mapping.xml。按现在的方法安装的过程中,到现在,是没有guacamole.properties 和user-mapping.xml这两个文件的。需要自己手动创建。然后填入内容。先创建两个目录(如果已经存在,就不要再创建)

# mkdir /etc/guacamole
# mkdir /usr/share/tomcat7/.guacamole

 

 然后创建文件

# touch /etc/guacamole/guacamole.properties

 

在刚刚创建的这个文件guacamole.properties中,插入如下内容

 

guacd-hostname: localhost
guacd-port:    4822
user-mapping:    /etc/guacamole/user-mapping.xml
auth-provider:    net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider
basic-user-mapping:    /etc/guacamole/user-mapping.xml

 

这里面user-mapping项和basic-user-mapping项都是指示user-mapping.xml文件的位置。

关于user-mapping.xml的内容。请参见第一种方法里user-mapping.xml文件的内容。这里是一样的。设置好自己要访问的远程桌面的server的位置和密码。

然后创建一个软连接,告诉tomcat到哪里去找guacamole.properties这个配置文件。

# ln -s /etc/guacamole/guacamole.properties /usr/share/tomcat7/.guacamole/

 

然后是修改配置文件的权限和所有者(否则tomcat即使找到了配置文件也没有权限去读它)

# chmod 600 /etc/guacamole/user-mapping.xml
# chown tomcat7:tomcat7 /etc/guacamole/user-mapping.xml

 

然后重启tomcat。启动guacd。就完成了。在浏览器里访问

127.0.0.1:8080/guacamole

登录进去。就能看到远端桌面了。

 

这是我配置一个例子。浏览器通过guacamole代理访问RDP Server(这里是virtualbox,它支持RDP协议的远程桌面)。

 

 

参考文章:

http://itoedr.blog.163.com/blog/static/12028429720149113614962/

这个链接提供了最简安装方式。

 

http://www.cnblogs.com/ji-yun/p/5657709.html

这个链接提供了官网安装教程的中文翻译

 

http://www.tecmint.com/guacamole-access-remote-linux-windows-machines-via-web-browser/

这个链接提供了完整安装教程,特别是guacamole.properties和user-mapping.xml这两个配置文件的具体使用方法。(英文文章)

转载于:https://www.cnblogs.com/zhang-ming/p/5772227.html

Guess you like

Origin blog.csdn.net/weixin_33831196/article/details/93249073