HomePage
WikiBlog
RecentChanges
LikePages
BackLinks
FindPage

Blog entries

2010-02-16: RSS-Feeds für ricardo.ch-Suchergebnisse

2010-02-15_spam: Disabling public editing

2010-02-15: Show Processes waiting for I/O in Linux

2010-02-13: Sony Vaio P in der Schweiz...

2009-06-17: Wie man plötzlich zum Mörder wird (weil's einfach besser 'rüberkommt!)

2008-05-18: Recreating SSL keys for stunnel, lighttpd and dovecot following the Debian-OpenSSL debacle

2008-02-12: Patch for aoeserver in Kernel 2.6.24

2008-02-07: Usage of open-iscsi on Linux

2008-02-05: Linux and Windows working in harmony with iSCSI

2008-01-19: Linksys PAP2 FXS Port Impedance

< July, 2010 >
Sun Mon Tue Wed Thu Fri Sat
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

Advanced Software Engineering Course On Debian

Install Instructions for GNU/Linux (Debian)

This is an adaption of http://diuf.unifr.ch/courses03-04/ase/271003/EJBsoftware.html to Debian Linux. No warranty or guarantee, just a report how it worked over here. In case of any questions ask hannes@phpug.ch or nicola.fankhauser@variant.ch

Prerequisites:

You need to be logged in as root, your machine is connected to the internet, your /etc/apt/sources.list is set up correctly. My /etc/apt/apt.conf file reads APT::Default-Release "unstable";, so all the following calls to apt-get will try to install the very latest release of the software in question.

It's recommended to run apt-get update to refresh your package list.

In the following directions, the # sign stands for the command prompt (BASH in our case).

All in all, the installations are quite straightforward. On Linux systems other than those based on the Debian distribution these tasks would be a little bit more difficult to achieve, I guess.

Quickstart

To install everything needed (with the exception of JBoss, JBoss IDE and xDoclet), run this:

# apt-get install eclipse-* mysql-server mysqlcc ant junit libmysql-java

You have to download these files manually:

  • JBoss 3.2.2
  • JBoss IDE for Eclipse
  • xDoclet

Follow each chapter of this tutorial to see how it has to be set up. In case you ran the apt-get install above and downloaded the additional files already, you can skip all apt-get install and wget parts, but keep in mind the places where you saved the files.

Java

URL: http://java.sun.com

There are several options, I think the most reliable is to get it right from Sun. After the guided installation you should care about the $JAVA_HOME environment variable:

# emacs /etc/profile

Set and export the environment variable JAVA_HOME:

export JAVA_HOME=/usr/lib/j2se/1.4/

Eclipse

URL: http://eclipse.org/

# apt-get install eclipse-*

This installs the Eclipse plattform and some add-ons, e.g. eclipse-xerces, eclipse-webdav-ftp and, if need be, java, libswt etc. This command might install more than actually needed (e.g. eclipse-source). If you just want to install the bare minimum, be more explicit when launching apt-get install.

MySQL

URL: http://mysql.com/

# apt-get install mysql-server

You might have to answer some simple questions while installing. To have the same configuration as Patrik, you first create two directories for data and log files:

# mkdir /var/lib/mysql/innodb
# chown mysql /var/lib/mysql/innodb

and

# mkdir /var/log/mysql/innodb
# chown mysql /var/log/mysql/innodb

Then you open the configuration file /etc/mysql/my.cnf, e.g. by typing

# emacs /etc/mysql/my.cnf

Then you delete the line containing skip-innodb and paste the following lines into the section beginning with mysqld:

innodb_data_home_dir = /var/lib/mysql/innodb/
innodb_data_file_path = ibdata1:50M;ibdata2:50M
set-variable = innodb_buffer_pool_size=70M
set-variable = innodb_additional_mem_pool_size=10M
innodb_log_group_home_dir = /var/log/mysql/innodb/
innodb_log_arch_dir =  /var/log/mysql/innodb/
innodb_log_archive=0
set-variable = innodb_log_files_in_group=3
set-variable = innodb_log_file_size=10M
set-variable = innodb_log_buffer_size=8M
innodb_flush_log_at_trx_commit=1
set-variable = innodb_file_io_threads=4
set-variable = innodb_lock_wait_timeout=50

Then you save that file and exit your editor. Still being root, you type:

# /etc/init.d/mysql reload

This reads and applies your changes.

Now, we set up a new database called mytest and create a new MySQL user for this database.

First, start the MySQL client:

# mysql -uroot

Now you have a console to the MySQL database. Enter the following statements. Be sure to end them always with a semicolon ;.

CREATE DATABASE mytest;
INSERT INTO mysql.user (host,user,password) VALUES ('localhost', 'jboss', '11223344');
GRANT ALL PRIVILEGES ON mytest.* TO jboss@localhost IDENTIFIED BY '11223344';
GRANT ALL PRIVILEGES ON mytest.* TO jboss@'%' IDENTIFIED BY "11223344";

Try to login to database mytest as user jboss:

# mysql -ujboss -p mytest

Note: mytest here is the database name, not the password. You will be prompted for the password. After giving the password (11223344), you should be logged into the mytest database as the user jboss.

MySQL Control Center

# apt-get install mysqlcc

And you're done with this part.

MySQL Connector/J

This is the Java archive providing the MySQL database connectivity for Java.

# apt-get install libmysql-java

In order to make things work, you need to copy /usr/share/java/mysql-3.0.8.jar (might be a more recent version) to the server/default/lib directory of your Jboss installation. But first things first, here's how to install Jboss:

JBoss

URL: http://www.jboss.com/

There's no recent jboss version distributed as Debian package, so we'll have to download it ourselves.

Change to the temporary directory to download jboss, download jboss from a mirror and unpack it:

# cd /tmp
# wget -q -O - \
  http://heanet.dl.sourceforge.net/sourceforge/jboss/jboss-3.2.2.tgz \
  | tar zxvf -

This will take some time...

After that you'll have a directory /tmp/jboss-3.2.2/ containing all the jboss stuff. You can run a first test by launching

# chmod +x /tmp/jboss-3.2.2/bin/run.sh;
# /tmp/jboss-3.2.2/bin/run.sh

If the download went right, you'll see a lot of lines rushing by. When I tried, the last line was:

Server JBoss (MX MicroKernel) [3.2.2 (build: CVSTag=JBoss_3_2_2 date=200310182216)],
Started in 48s:482ms

You should get someting alike.

If you direct your Webbrowser to http://localhost:8080/web-console/, you see the jboss management console. Note that you need to have a java plugin for you browser to use that tool.

In order to compile applications using jboss you need to set the $JBOSS_DIST environment variable. Proceed as above when we set $JAVA_HOME.

Now you go on configuring jboss. First of all stop it by hitting CTRL-C. Then open the configuration file:

# emacs /tmp/jboss-3.2.2/server/default/deploy/mysql-ds.xml

You delete everything and paste these lines:

<?xml version="1.0" encoding="UTF-8"?>

<datasources>
  <local-tx-datasource>
    <jndi-name>DefaultDS</jndi-name>
    <connection-url>jdbc:mysql://localhost/mytest</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>jboss</user-name>
    <password>11223344</password>
    <security-domain>MySqlDbRealm</security-domain>
  </local-tx-datasource>
</datasources>

Save the file.

Open now /tmp/jboss-3.2.2/server/default/conf/standardjbosscmp-jdbc.xml in your editor. Change the name and mapping of datasource:

<datasource>java:/DefaultDS</datasource>
<datasource-mapping>mySQL</datasource-mapping>
(...)
<fk-constraint>true</fk-constraint>

Open /tmp/jboss-3.2.2/server/default/conf/standardjaws.xml and change the name and mapping of datasource:

<datasource>java:/DefaultDS</datasource>
<type-mapping>mySQL</type-mapping>
# mv /tmp/jboss-3.2.2/docs/examples/jms/mysql-jdbc2-service.xml \
     /tmp/jboss-3.2.2/server/default/deploy/jms/
# rm /tmp/jboss-3.2.2/server/default/deploy/jms/hsql*.xml

Now there are only two files left to be edited:

# emacs /tmp/jboss-3.2.2/server/default/deploy/jms/mysql-jdbc2-service.xml

Search for the first line and set name=DefaultDS as content of the depends tag.

(...)
<mbean code="org.jboss.mq.pm.jdbc2.PersistenceManager"
       name="jboss.mq:service=PersistenceManager">
  <depends optional-attribute-name="ConnectionManager">
    jboss.jca:service=LocalTxCM,name=DefaultDS
  </depends>
(...)

Let's edit the second file:

# emacs /tmp/jboss-3.2.2/server/default/conf/login-config.xml

Insert this XML fragment almost at the end of the file, just before the </policy> tag:

<application-policy name="MySqlDbRealm">
  <authentication>
    <login-module
      code="org.jboss.resource.security.ConfiguredIdentityLoginModule"
      flag="required">
      <module-option name="principal">jboss</module-option>
      <module-option name="userName">jboss</module-option>
      <module-option name="password">11223344</module-option>
      <module-option name="managedConnectionFactoryName">
        jboss.jca:service=LocalTxCM,name=DefaultDS
      </module-option>
    </login-module>
  </authentication>
</application-policy>

Now try to launch jboss again - it should still be working. :) If it does, you can now finish your jboss installation by moving jboss to a better place than /tmp:

# mv /tmp/jboss-3.2.2 /usr/local/jboss

Ant and jUnit

# apt-get install ant junit

xDoclet

# cd /tmp
# mkdir xdoclet
# cd xdoclet
# wget -q -O - \
  http://heanet.dl.sourceforge.net/sourceforge/xdoclet/xdoclet-bin-1.2b3.tgz \
  | tar zxvf -

# cp -v ./lib/*.jar /usr/share/java/

To test xdoclet:

# cd ./samples
# ant

JBoss-IDE for Eclipse

# cd /tmp/
# wget http://heanet.dl.sourceforge.net/sourceforge/jboss/org.jboss.ide.eclipse_1.2.0.bin.dist.zip
# unzip org.jboss.ide.eclipse_1.2.0.bin.dist.zip
# mv /tmp/plugins/*  /usr/share/eclipse/plugins/

To test Ecplise: Become an ordinary user again and run it.

# exit
# eclipse &

Final notes

Enjoy, don't cry if it doesn't work at first try ;) Note again that these are just some notes taken while setting up Hannes' testing environment. They may very well be both inaccurate and wrong.


Last edited on 10.01.2004 12:14.


Edit | PageHistory | Diff | PageInfo

© Copyright 2004 - 2006 Nicola Fankhauser. All Rights Reserved.