Friday, February 11, 2011

Scripted Java Install on Ubuntu 10, part II: remote install

Part deux follows quickly as a simple extension of Part I.

Yes, you say, it is simple enough to install java without having to click accept, but how can I do that over the wire, remotely via ssh, from java.

So, just to recap: install java via ssh from java on ubuntu 10.

To be able to do anything from java via ssh, I strongly recommend jsch. I cannot tell you enough how cool it is, and it is used in a lot of open source projects.
One minor drawback: there is hardly any documentation on it. I mean really, close to none. But don't let that get you down, this is the reason we're all into open source in the first place, isn't it?

The code is divided into 2 main parts:

- the jsch wrapper, which only helps out with the ssh details, also it provides some higher level abstractions, like running a remote command. this is not tied to Ubuntu, it will work on any *nix like system, provided the commands are correct.
Here is the very lightweight version of the class:


- and the actual bash scripts, that come from Part I.


I'm just trying things out with gists from git right now, so if this doesn't turn out to be a good idea, don't take it personally ;)

Moreover, in an effort to improve the quality of this blog, and also to revive it, as it is been a while since I've written anything useful here, I've decided to publish everything in git hub.
This also helps me to play around a bit with the cool kids, as it seems that SVN is considered passé these days.
So, this is the link to todays project/snippet: remote-java-install.

enjoy!

0 comments:

Post a Comment