Posts Tagged ‘Linux’

Installing Hudson on Debian

Wednesday, January 28th, 2009

This post describes how to setup the continuous integration tool Hudson on a Debian Linux system.

1. Update your /etc/apt/sources.list.

You definitely need the non-free components which include the official Sun Java packages. Therefore you should have a line like the follwing in your /etc/apt/sources.list:

deb http://ftp.de.debian.org/debian/ etch main non-free contrib

2. Install JRE and JDK 1.6

On a root shell, type:

apt-get install sun-java6-jre sun-java6-jdk

3. Configure Debian to use exactly this version as the system-wide default

On a root shell, type:

update-alternatives -–config java
update-alternatives -–config javac

4. Install Tomcat

On a root shell, type:

apt-get install tomcat5.5 tomcat5.5-admin tomcat5.5-webapps

5. Make Tomcat listen on port 8080

The default for Tomcat on Debian is to start on port 8180. We want it to start on port 8080. Thus, you need to change your /etc/tomcat5.5/server.xml. In the section

<Connector port=”8180″ maxHttpHeaderSize=”8192″
maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”false” redirectPort=”8443″ acceptCount=”100″
connectionTimeout=”20000″ disableUploadTimeout=”true” />
you have to replace “8180″ by “8080″.

6. Disable Tomcat’s security mechanism

Hudson brings it’s own security management system. The Tomcat security mechanism for wepapps block the startup of Hudson and have to be in /etc/default/tomcat5.5 disabled. Search for “TOMCAT5_SECURITY” and change the line to make it look like this:

TOMCAT5_SECURITY=no

Instead, you should configure Hudsons internal security management system.

7. Setup a home directory for Hudson

In a root shell, type:

mkdir /home/hudson

chown tomcat55:nogroup /home/hudson

8. Set Hudson’s home directory environment variable

Open /etc/init.d/tomcat5.5 and add this line:

export HUDSON_HOME=/home/hudson

9. Deploy the hudson.war via the Tomcat Manager

After this step, you should be able to log into Hudson via Web browser and start configuring via the web interface.

10. Install Maven2

On a root shell, type:

apt-get install maven2

Setup your MAVEN_HOME environment variable. Open /etc/init.d/tomcat5.5 and add this line:

export MAVEN_HOME=/usr/share/maven2/

Create a Maven2 home directory for Hudson. This has to be located in /usr/share/tomcat5.5/.m2. Execute the following commands on a root shell:

mkdir /usr/share/tomcat5.5/.m2

chown tomcat55:nogroup /usr/share/tomcat5.5/.m2

11. Install ant and junit

On a root shell, type:

apt-get install ant ant-optional junit

Setup your ANT_HOME environment variable. Open /etc/init.d/tomcat5.5 and add this line:

export ANT_HOME=/usr/share/ant

12. Install SVN access plugin for Hudson

Open via http://localhost:8081/hudson/pluginManager/available in a web browser and choose SVNCompat14 Plugin for installation. Please note: For me, the install stopped with this exception at the first time:

javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Alerts.java:190) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1591) at …

But at the second try it ran through.

Starting your computer via Bluetooth

Tuesday, December 30th, 2008

Goal

My breakfast terminal should be switched on and off not only based on a time schedule but also on the information if I am at home. This turned out to be a requirement over Christmas break when the terminal was shut down by crontab entries automatically during my normal office hours when I am not at home.

Solution

Use the Bluetooth signal of my mobile phone to discover whether I am at home or not. Our Linux server runs 24/7 anyway and does the Bluetooth scan for my mobile.

Step 1: What’s my Bluetooth MAC?

Discover the Bluetooth MAC address of my mobile using hcitool.

$ hcitool scan
Scanning …
00:18:13:18:BE:B3       W810i

Alternatively, you could also use btscanner.

Step 2: Configure a monitoring daemon

First, I was trying bluemon which is available as a Debian package to monitor the Bluetooth airspace around our appartment. But it turned out that at least with my mobile (a Sony Ericson W810i) I get frequent connected/disconnected messages. This happens even when the mobile is not moved around and the link quality is good.

Instead, I switched to sdptool which comes with the Bluez, collection of Bluetooth utilities for Linux. But even with this tool, my mobile is sometimes not detected when I am executing a command like

sdptool browse 00:18:13:18:BE:B3

I’ve played around a little and it seems like after invoking it a couple of times, the mobile is detected properly if available.

Step 3: Booting the terminal

As described before the terminal is started via Wake on LAN by our server. All I had to do was to add support to check for the availability of my mobile whenever the terminal is to be booted or shut down.

You can also have a look on the Bash script I wrote for this. It is merely a collection of ugly hacks, so use at your own risk: check_mobile.sh