Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

[TUTORIAL] Jetty and Guacamole

Tue Mar 04, 2014 9:35 am

This first post was edited because I've finally wrote the tutorial to use Guacamole with Jetty.

You will find it just some posts ahead! :D Or here.
Last edited by Angelus88 on Thu Jul 10, 2014 5:44 pm, edited 2 times in total.

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: Jetty and Guacamole

Wed Mar 05, 2014 7:36 am

Anyone?

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: Jetty and Guacamole

Tue Mar 11, 2014 2:34 pm

Ok I solved the problem.

This night or during these days I'll post a tutorial ;)

jamaisx
Posts: 1
Joined: Thu Dec 27, 2012 1:53 pm

Re: Jetty and Guacamole

Thu Mar 20, 2014 2:49 pm

Bravo, mi servirebbe... quando posti il tutorial?

Good, i need it, when you will post the tutorial?

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: Jetty and Guacamole

Thu Jul 03, 2014 8:01 pm

I would love to see this tutorial as I just started playing with Guacamole on a Linux VM and it would honestly be the perfect use for one of my Pi's.

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: Jetty and Guacamole

Thu Jul 03, 2014 8:35 pm

Yeah, sorry guys but I completely forgot to do the tutorial :?

I promise I'm going to do it tomorrow night :D

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: Jetty and Guacamole

Fri Jul 04, 2014 2:21 am

Looking forward to it :D

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: Jetty and Guacamole

Sun Jul 06, 2014 9:54 pm

Ok, as I promised here's the tutorial to run Guacamole with Jetty instead of Tomcat.

If someone's wondering why using Jetty, I simply answer saying that Jetty is way more lightweighted than Tomcat to run on our RPi :D Besides that, there could be other reasons to not use Tomcat.

Anyway, let's start with the tutorial!

First of all, we want that everything is updated:

Code: Select all

sudo apt-get update
sudo apt-get upgrade
Now, let's install Jetty:

Code: Select all

sudo apt-get install jetty
This could take a while if you don't already have the openjdk packages.

After that, we have to edit the file /etc/default/jetty:

Code: Select all

sudo nano /etc/default/jetty
and change

NO_START=1 to NO_START=0
JETTY_HOST=$(uname -n) to JETTY_HOST=0.0.0.0

The first line makes Jetty to start at every boot while the second line makes Jetty webpage accessible from any network and not just from localhost. After that we could do:

Code: Select all

sudo service jetty start
Now, if we browse to http://ipaddressofrpi:8080 we should see Jetty 6 homepage.

Then we need some libraries first:

Code: Select all

sudo apt-get install libfreerdp-dev
sudo apt-get install libtelnet-dev
sudo apt-get install libvncserver-dev
sudo apt-get install libssh-dev libssh2-1-dev
Now, as I prefer using the last release of Guacamole, we could build everything we need from the sources. So let's head to this link to download the Guacamole Server that is the guacd daemon. Then:

Code: Select all

tar -zxvf guacamole-server-0.9.1.tar.gz
cd guacamole-server-0.9.1
./configure --with-init-dir=/etc/init.d
If you have an error about the png support and/or ssh support, take a look here.

At this point, when the command ends, we should read:
Protocol support:

RDP ....... yes
SSH ....... yes
Telnet .... yes
VNC ....... yes

Init scripts: /etc/init.d
If so, then:

Code: Select all

make
sudo make install
sudo ldconfig
sudo service guacd restart
Now, let's check if the server is correctly running by doing:

Code: Select all

ps aux | grep guacd
and we should see a line with "/usr/local/sbin/guacd" running.

If so, now we can move to the client part. You can download the war for Jetty from this link. Once you have the war, we have to:

Code: Select all

sudo mv guacamole-0.9.1.war /usr/share/jetty/webapps/guacamole.war
sudo service jetty restart
Now if we browse to http://ipaddressofrpi:8080/guacamole/ we should see the homepage of Guacamole asking to login with user and password. If so, we're good but not finished yet.

Now we have to set those login information so:

Code: Select all

sudo mkdir /usr/share/jetty/.guacamole
cd /usr/share/jetty/.guacamole/
sudo nano
here let's copy and paste this inside the text editor:

Code: Select all

# Hostname and port of guacamole proxy
guacd-hostname: localhost
guacd-port:     4822

# Location to read extra .jar's from
lib-directory:  /usr/share/jetty/.guacamole

# Authentication provider class
auth-provider: net.sourceforge.guacamole.net.basic.BasicFileAuthenticationProvider

# Properties used by BasicFileAuthenticationProvider
basic-user-mapping: /usr/share/jetty/.guacamole/user-mapping.xml
now save the file with CTRL+O giving it the name guacamole.properties

Now we have to create the file /usr/share/jetty/.guacamole/user-mapping.xml and its content will tell Guacamole which user can login and which connection protocols are available.

This is a working example of the file:

Code: Select all

<user-mapping>

    <authorize username="USERNAME" password="PASSWORD">
        <connection name="VNC-Connection">
             <protocol>vnc</protocol>
             <param name="hostname">localhost</param>
             <param name="port">5900</param>
             <param name="password">VNCPASSWORD</param>
       </connection>
    </authorize>

</user-mapping>
We could use any protocol we want but we must have the server installed and running. I mean, if you choose VNC, then you must have a VNC server running on the RPi and listening to a port you know. For example, if you just run tightvncserver from the command line for the first time, it will ask you to set a password and after that, you should read New 'X' desktop is yourraspberrypiname:1

In that case, the port would be 5901 and so the file could be:

Code: Select all

<user-mapping>

    <authorize username="raspberrypi" password="12345678">
        <connection name="VNC-Connection">
             <protocol>vnc</protocol>
             <param name="hostname">localhost</param>
             <param name="port">5901</param>
             <param name="password">raspberry</param>
       </connection>
    </authorize>

</user-mapping>
Remember that you could choose everything you want for the first username and password but after <param name="password"> you MUST write the same password you previously set on tightvncserver.

When everything is done, let's restart jetty just to be sure:

Code: Select all

sudo service jetty restart
Now, if you browse to http://ipaddressofrpi:8080/guacamole/ , you will see the login page and if you put there the username and password you choose in the guacamole.properties, the login should work and you will see the "All Connections" section and under that, the DEFAULT connection that will activate the connection protocol you previously set inside the user-mapping.xml file.

:D :D :D :D
Last edited by Angelus88 on Fri Jan 23, 2015 7:41 pm, edited 7 times in total.

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: Jetty and Guacamole

Sun Jul 06, 2014 10:56 pm

Awesome!

I'll be trying this out very, very soon.

Thanks again!

Yroark

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: Jetty and Guacamole

Sun Jul 06, 2014 11:44 pm

ylindsay wrote:Awesome!

I'll be trying this out very, very soon.

Thanks again!

Yroark
Ok, now the tutorial is complete! I wrote it while I was following the same steps on my RaspberryPi so I know it should work.
Let me know :D

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: [TUTORIAL] Jetty and Guacamole

Tue Jul 08, 2014 4:48 pm

When I type the sudo service jetty start i get the following

pi@ycl-ras-guac ~ $ sudo service jetty start
[FAIL] Could not start Jetty servlet engine because no Java Development Kit ... failed!
[FAIL] (JDK) was found. Please download and install JDK 1.4 or higher and set ... failed!
[FAIL] JAVA_HOME in /etc/default/jetty to the JDK's installation directory. ... failed!
pi@ycl-ras-guac ~ $

I've not played with Java on Pi as of yet so any hints you can give me here would be awesome!

Thanks,

Yroark

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: [TUTORIAL] Jetty and Guacamole

Tue Jul 08, 2014 4:54 pm

Mmm it looks like you just need the java jdk.

Try this from command line:

Code: Select all

sudo apt-get install openjdk-7-jdk

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: [TUTORIAL] Jetty and Guacamole

Tue Jul 08, 2014 5:54 pm

Trying this now thanks for the quick replies. I really appreciate the help.

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: [TUTORIAL] Jetty and Guacamole

Tue Jul 08, 2014 6:13 pm

I still get the same error.
If I examine the Java_Home field in my /etc/default/jetty file its blank.

Any idea what this should be I did a simple apt-get install of the openjdk-7-jdk per your suggestion.

Once again thanks for the assistance.

Yroark

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: [TUTORIAL] Jetty and Guacamole

Tue Jul 08, 2014 6:36 pm

Look under /usr/lib/jvm/ if you have a folder like java-7-openjdk-armhf and set that folder inside that file like

Code: Select all

JAVA_HOME=/usr/lib/jvm/java-7-openjdk-armhf


and remember to remove the # at the beginning of that line!

ylindsay
Posts: 10
Joined: Tue Dec 24, 2013 4:42 am

Re: [TUTORIAL] Jetty and Guacamole

Tue Jul 08, 2014 7:00 pm

That did it! And the removing the comment # very good tip I totally would have missed it.

Thanks once more!

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: [TUTORIAL] Jetty and Guacamole

Wed Jul 09, 2014 1:07 am

ylindsay wrote:That did it! And the removing the comment # very good tip I totally would have missed it.

Thanks once more!
You're welcome buddy, just let me know if the rest works ;)

meetjack
Posts: 4
Joined: Sat May 03, 2014 2:50 pm

Re: [TUTORIAL] Jetty and Guacamole

Thu Jul 10, 2014 5:40 pm

..
Last edited by meetjack on Mon Jul 14, 2014 3:47 am, edited 1 time in total.

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: [TUTORIAL] Jetty and Guacamole

Thu Jul 10, 2014 5:46 pm

As I said on the first post, the tutorial is already written. You can find it some posts before this one

bobert0670
Posts: 1
Joined: Sun Aug 10, 2014 9:35 pm

Re: [TUTORIAL] Jetty and Guacamole

Sun Aug 10, 2014 9:40 pm

Great write up, I have been using Guac on my Ubuntu servers for a while, I am now putting it on a pi to test for a new application. I started from scratch on my pi, and noticed the Java dev kit is not part of the base image when using raspbian at least the noobs version. Thought I would let you know so you could append your guide to go ahead and install and set the path. Glad I I found this rather than starting from scratch.

Thanks Again.

drawde
Posts: 1
Joined: Mon Nov 17, 2014 11:50 pm

Re: [TUTORIAL] Jetty and Guacamole

Tue Nov 18, 2014 12:04 am

got jetty and guacamole installed thanks to this tutorial. it's my first time using anything like this, is it supposed to be as fast as the regular viewing? i'm seeing like 5+ seconds between redraws, is this normal? is the pi not powerful enough?

RyanHughesTV
Posts: 1
Joined: Tue Nov 18, 2014 3:18 pm
Location: Horsham, United Kingdom
Contact: Website

Re: [TUTORIAL] Jetty and Guacamole

Tue Nov 18, 2014 3:29 pm

Thanks a lot for this :D

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: [TUTORIAL] Jetty and Guacamole

Tue Nov 18, 2014 8:34 pm

drawde wrote:got jetty and guacamole installed thanks to this tutorial. it's my first time using anything like this, is it supposed to be as fast as the regular viewing? i'm seeing like 5+ seconds between redraws, is this normal? is the pi not powerful enough?
Well, I know with the Pi is not in realtime but... more than 5 seconds it's probably too much.

Try to set up everything on a clean system and try to boot the Pi without the GUI to free resources.
Remember that the Pi has a 100 Mbit network card so try to low the quality of the images.

chkchaitu
Posts: 2
Joined: Mon May 27, 2013 6:39 am

Re: [TUTORIAL] Jetty and Guacamole

Sun Dec 14, 2014 8:07 pm

Thank you so much for a great tutorial.

I was able to install guacamole 0.9.3 on jetty successfully by following the instructions. I setup MySQL Auth as well.

I am able to create users, new connections etc, but when I click on a connection it says internal server error and does not connect. this happens to all connections, be it SSH or RDP.

Any idea what could be wrong.

Angelus88
Posts: 442
Joined: Mon May 13, 2013 9:25 am
Location: Ivrea, TO (Italy)

Re: [TUTORIAL] Jetty and Guacamole

Mon Dec 15, 2014 12:01 am

chkchaitu wrote:Thank you so much for a great tutorial.

I was able to install guacamole 0.9.3 on jetty successfully by following the instructions. I setup MySQL Auth as well.

I am able to create users, new connections etc, but when I click on a connection it says internal server error and does not connect. this happens to all connections, be it SSH or RDP.

Any idea what could be wrong.
Well, "internal server error" could mean everything and nothing.
Guacd should log everything inside syslog file so maybe you could find a more detailed error there.
So try again to click on a connection and when it shows that error, take a note of the current time (HH:MM)
Then open /var/log/syslog and scroll until you reach that time and look if there's a more detailed error from jetty or guacd.
If you don't find anything, look if there's a file like /var/log/guacd or /var/log/jetty

Return to “Java”

Who is online

Users browsing this forum: No registered users and 3 guests