Jpackage with Sun Java on FC3
The Jpackage project has RPMs for lots of Free Java packages and also SRPMs that you can build against various non-Free packages like Java from Sun.
This page explains how to install the packages required to build and deploy MKSearch on Fedora Core 3 using Apache Ant, Tomcat 5.x and JUnit regression tests. This configuration is documented because it is the primary configuration used in the development of the system. It is possible to build the project without Ant or JUnit and deploy to other servlet containers, see $mk_home/bin/README.txt
for further details.
Lines in the examples that start with a $
prompt are things you can do as a normal user, lines that start with a #
are things that have to be done by root. When copying these instructions, you do not need to copy the $
or the #
!
Configuring Yum
The first thing to do is either configure Yum (which comes with FC3) to get the Free Jpackage packages or configure Apt (which comes from other repos such as Freshrpms) - you don't need to configure both. If you are not sure which to use then Yum is probably best. The Jpackage site has Apt and Yum configuration instructions, or you can follow the short Yum instructions that have been taken from there.
GPG
To ensure that the packages you install are not corrupted you first need to install the Jpackage GPG key. You can download the key as a normal user but you need to install it as root:
$ cd /tmp/ $ wget http://jpackage.org/jpackage.asc $ su # rpm --import jpackage.asc
Yum
It is simply a matter of downloading the jpackage.repo list and installing it as root:
$ cd /tmp/ $ wget http://jpackage.org/jpackage.repo $ su # mv jpackage.repo /etc/yum.repos.d/
You can then run yum update
to update the list of available packages.
Installing Packages
The three key packages that are required for this deployment are named tomcat5
, ant
and junit
, so start by trying to install these.
# yum install tomcat5 ant junit Error: missing dep: jta >= 0:1.0.1-0.a.1 for pkg tomcat5 Error: missing dep: j2sdk = 2000:1.4.2_06-fcs for pkg java-1.4.2-sun-compat
Since Tomcat 5 depends on non-Free packages, jta
and j2sdk
the install has failed to complete, so the next thing to do is to install these dependencies.
Build environment
First you need to create some directories for building RPMs in and also set up your build environment, all this should be done as a normal user and not root.
$ cd $ mkdir rpms $ cd rpms $ mkdir {build,rpms,sources,specs,srpms,tmp}
Next you need to create a ~/.rpmmacros
file in your home directory, change chris
in the following example to suit.
%_builddir /home/chris/rpms/build %_rpmdir /home/chris/rpms/rpms %_sourcedir /home/chris/rpms/sources %_specdir /home/chris/rpms/specs %_srcrpmdir /home/chris/rpms/srpms %_tmppath /home/chris/rpms/tmp
Now you should be ready to start building the non-Free packages.
jta
First download, verify and install the jta source RPM, you can ignore the messages about user jpp not existing.
$ cd /tmp/ $ wget http://mirrors.sunsite.dk/jpackage/1.6/generic/non-free/SRPMS/jta-1.0.1-0.b.4jpp.nosrc.rpm $ rpm -K jta-1.0.1-0.b.4jpp.nosrc.rpm jta-1.0.1-0.b.4jpp.nosrc.rpm: (sha1) dsa sha1 md5 gpg OK $ rpm -Uvh jta-1.0.1-0.b.4jpp.nosrc.rpm 1:jta warning: user jpp does not exist - using root warning: group jpp does not exist - using root ########################################### [100%]
Next we can try building it.
$ cd ~/rpms/specs $ rpmbuild -ba jta.spec error: File ~/rpms/sources/jta-1_0_1B-classes.zip: No such file or directory
This error tells us what non-Free things we need to find on the Sun web site, in this case, jta-1_0_1B-classes.zip
.
So go to the jta
page and follow the download link for the Class Files 1.0.1B, click through the online agreement and save it to /tmp/
then do the same for the JavaDocs 1.0.1B.
Now you can try rebuilding the SRPM again.
$ cp /tmp/ $ cp jta-1_0_1B-classes.zip ~/rpms/sources/ $ cp jta-1_0_1B-doc.zip ~/rpms/sources/ $ cd ~/rpms/specs $ rpmbuild -ba jta.spec error: Failed build dependencies: java-devel is needed by jta-1.0.1-0.b.4jpp.noarch
So we have discovered that jta
depends on java-devel
, another non-Free package.
Java
Download, verify and install the java-1.5.0-sun
package from Jpackage, again ignore the warnings about users not existing.
$ cd /tmp/ $ wget http://mirrors.sunsite.dk/jpackage/1.6/generic/non-free/SRPMS/java-1.5.0-sun-1.5.0.01-1jpp.nosrc.rpm $ rpm -K java-1.5.0-sun-1.5.0.01-1jpp.nosrc.rpm java-1.5.0-sun-1.5.0.01-1jpp.nosrc.rpm: (sha1) dsa sha1 md5 gpg OK $ rpm -Uvh java-1.5.0-sun-1.5.0.01-1jpp.nosrc.rpm
Next try building the package to see what is needed from the Sun site.
$ cd ~/rpms/specs/ $ rpmbuild -ba java-1.5.0-sun.spec sh: ~/rpms/sources/jdk-1_5_0_01-linux-i586.bin: No such file or directory error: Bad exit status from /usr/local/src/rpms/tmp/rpm-tmp.28816 (%prep)
So now we know we need to find jdk-1_5_0_01-linux-i586.bin
from Sun.
This can be found via the J2SE 5.0 page, click though the agreement following the Download JDK link and select the Linux self-extracting file - jdk-1_5_0_01-linux-i586.bin
and save it to /tmp/
.
Next copy the file required to build the RPM.
$ cp /tmp/jdk-1_5_0_01-linux-i586.bin ~/rpms/sources/ $ cd ~/rpms/specs/ $ rpmbuild -ba java-1.5.0-sun.spec Wrote: ~/rpms/srpms/java-1.5.0-sun-1.5.0.01-1jpp.nosrc.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-devel-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-src-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-demo-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-plugin-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-fonts-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-alsa-1.5.0.01-1jpp.i586.rpm Wrote: ~/rpms/rpms/i586/java-1.5.0-sun-jdbc-1.5.0.01-1jpp.i586.rpm
Now you should be ready to install the java-1.5.0-sun-devel-1.5.0.01-1jpp.i586.rpm
package that jta
depends on, and any depandencies.
# rpm -Uvh ~/rpms/rpms/i586/java-1.5.0-sun-devel-1.5.0.01-1jpp.i586.rpm error: Failed dependencies: java-1.5.0-sun = 0:1.5.0.01-1jpp is needed by java-1.5.0-sun-devel-1.5.0.01-1jpp.i586 # rpm -Uvh ~/rpms/rpms/i586/java-1.5.0-sun-devel-1.5.0.01-1jpp.i586.rpm \ ~/rpms/rpms/i586/java-1.5.0-sun-1.5.0.01-1jpp.i586.rpm Preparing... ########################################### [100%] 1:java-1.5.0-sun ########################################### [ 50%] 2:java-1.5.0-sun-devel ########################################### [100%]
Now we can go back to the jta
build instructions above and try again; this time there should not be any errors.
$ cd ~/rpms/specs/ $ rpmbuild -ba jta.spec Wrote: ~/rpms/srpms/jta-1.0.1-0.b.4jpp.nosrc.rpm Wrote: ~/rpms/rpms/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm Wrote: ~/rpms/rpms/noarch/jta-javadoc-1.0.1-0.b.4jpp.noarch.rpm
And now install jta
.
# rpm -Uvh ~/rpms/rpms/noarch/jta-1.0.1-0.b.4jpp.noarch.rpm Preparing... ########################################### [100%] 1:jta ########################################### [100%]
Tomcat, Ant and JUnit
Now all the depandencies have been installed, we can go back to the intital install attempt and try again.
# yum install tomcat5 ant junit Dependencies Resolved Transaction Listing: Install: ant.noarch 0:1.6.2-3jpp Install: junit.noarch 0:3.8.1-4jpp Install: tomcat5.noarch 0:5.0.30-1jpp Performing the following to resolve dependencies: Install: axis.noarch 0:1.1-3jpp Install: bcel.noarch 0:5.1-5jpp Install: classpathx-jaf.noarch 0:1.0-2jpp Install: classpathx-mail.noarch 0:1.0-3jpp Install: jakarta-commons-beanutils.noarch 0:1.7.0-1jpp Install: jakarta-commons-collections.noarch 0:3.1-1jpp Install: jakarta-commons-daemon.noarch 1:1.0-2jpp Install: jakarta-commons-dbcp.noarch 0:1.2.1-3jpp Install: jakarta-commons-digester.noarch 0:1.6-2jpp Install: jakarta-commons-discovery.noarch 1:0.2-2jpp Install: jakarta-commons-el.noarch 0:1.0-3jpp Install: jakarta-commons-fileupload.noarch 1:1.0-3jpp Install: jakarta-commons-launcher.noarch 0:0.9-3jpp Install: jakarta-commons-logging.noarch 0:1.0.4-2jpp Install: jakarta-commons-modeler.noarch 0:1.1-3jpp Install: jakarta-commons-pool.noarch 0:1.2-2jpp Install: log4j.noarch 0:1.2.8-8jpp Install: mx4j.noarch 0:2.0.1-2jpp Install: regexp.noarch 0:1.3-2jpp Install: saxon.noarch 0:6.5.3-3jpp Install: servletapi5.noarch 0:5.0.18-2jpp Install: tyrex.noarch 0:1.0.1-2jpp Install: wsdl4j.noarch 0:1.4-3jpp Install: xerces-j2.noarch 0:2.6.2-4jpp Install: xml-commons.noarch 0:1.0-0.b2.7jpp Install: xml-commons-apis.noarch 0:1.0-0.b2.7jpp Install: xml-commons-resolver.noarch 0:1.1-3jpp Update: jpackage-utils.noarch 0:1.6.2-1jpp Is this ok [y/N]: y
And that's it!
Copyright MKDoc Ltd. and others.
The Free Documentation License http://www.gnu.org/copyleft/fdl.html