Thursday, December 30, 2004

Wednesday, December 29, 2004

An Insight into the History of Webhost

An Insight into the History of Illusionfxnet

It all started in 2001, when Evan T. started a small free hosting provider that provided hosting for sites about the game SubSpace/Continuum. Later down the road, people wanted their personal and miscellaneous sites hosted too. Seven hundred miles away, Evan W. founded a web design company under the name Illusionfxnet. He helped Evan T. run the servers for SubSpace Xtreme Hosting.

One day, they started a simple conversation, and Evan W. asked what Evan T. thought about starting a free website hosting company under the name of Illusionfxnet. Evan T. instantly agreed. Everything was set-up at Evan T.'s place of employment with a simple dedicated T1 line. All applications were sent to an e-mail account in which Evan T., Evan W., and a former administrator by the name of EpidemiK reviewed manually.

Evan W. made a post advertising Illusionfxnet in the FreeWebSpace.net Forums, and there was a large string of applications pouring into the mailbox. This started forming a community. With the large amount of people joining in everyday, the administrators found a great designer by the name of Freeloader who generously donated a design for Illusionfxnet. Evan T. programmed a PHP script to review applications, and Illusionfxnet purchased a non-profit cPanel license.

Things seemed to be perfect when tragedy struck. Evan T.'s place of employment's ISP went out of business, and the administrators searched frantically for another place for the server. Illusionfxnet's services were down for three months.

In September 2003, the services returned, and not a whole lot had changed. EpidemiK had left, and Chris K. stepped up to fill in for his position. Chris proved that he could be counted on, and had been a big help to all Illusionfxnet members and administrators.

In October 2003, Illusionfxnet added Google Ads to the Illusionfxnet site in an attempt to reimburse the money that came out of their own pockets. To everyone's surprise, the Google Ads were a massive success, which allowed Illusionfxnet to increase the quality of hosting.

Recently we have gotten a more professional feel, with a more desirable site design and better management. We have made many updates and added many new features, and everyday we strive to reach new heights in the hosting industry, and in the pleasure of our customers.

Tuesday, December 28, 2004

How to Make Money With Google Adsense

How to Make Money With Google Adsense: "Make Money With Google Adsense"

Virtualmin Virtual Servers Module

Virtualmin Virtual Servers Module

SourceForge.net: Project Info - RDBS2J

SourceForge.net: Project Info - RDBS2J

Postfix

Chapter?10.?Postfix: "Postfix is an efficient and feature-rich mail server that was designed by Wietse Venema at the IBM T.J. Watson Research Center. It was intended to be a replacement for the popular Sendmail."

apache no longer find its ssl certificate file

on mandrake 10.0, I updated apache to the latest version (urpmi).

when I tried to restart apache I got the following error:

[root@server1 root]# service httpd start
Starting httpd2: Syntax error on line 44 of /etc/httpd/conf.d/41_mod_ssl.default-vhost.conf:
SSLCertificateFile: file '/etc/ssl/apache2/server.crt' does not exist or is empty

did an updatedb, then locate server.crt and server.crt turned up in /etc/ssl/apache/server.crt

and the same for server.key

made the relevant changes to /etc/httpd/conf.d/41_mod_ssl.default-vhost.conf,

then service httpd start, and it worked this time

Sunday, December 26, 2004

Friday, December 24, 2004

ActiveMQ - Home

ActiveMQ - Home: "ActiveMQ is an open source, Apache 2.0 licensed, high performance Messaging Fabric consisting of a scalable cluster of Message Brokers and a complete JMS 1.1 provider which integrates seamlessly into J2EE containers, light weight containers and any Java application."

Thursday, December 23, 2004

TheServerSide.com - Using The Digester Component

TheServerSide.com - Using The Digester Component: "Introducing the Digester Component"

ActiveSOAP - XMLBeans

ActiveSOAP - XMLBeans: "XMLBeans is a tool for handling typically XSD typed XML with support for the autogenerating of beans to map to a WSDL or XSD file."

Simplify XML file processing with the Jakarta Commons Digester

Simplify XML file processing with the Jakarta Commons Digester: "Simplify XML file processing with the Jakarta Commons Digester"

IBM WebSphere Developer Technical Journal: Extending the IBM WebSphere Platform with Adobe Intelligent Documents

IBM WebSphere Developer Technical Journal: Extending the IBM WebSphere Platform with Adobe Intelligent Documents: "Extending the IBM WebSphere Platform with Adobe Intelligent Documents"

Thomas Dudziak's Weblog

Thomas Dudziak's Weblog: "I just read the 'Struts Best Practices' article, and overall it gives IMO some good hints for using Struts in real-world projects. But there are a few minor comments that I have: "

ONJava.com: Extending Struts

ONJava.com: Extending Struts: "Struts is not only a very powerful framework, but also very extensible."

XML.com: Implementing REST Web Services: Best Practices and Guidelines

XML.com: Implementing REST Web Services: Best Practices and Guidelines: "Implementing REST Web Services: Best Practices and Guidelines"

A brief introduction to REST that describes how to build Web services in the REST style

: "A brief introduction to REST that describes how to build Web services in the REST style"

Sunday, December 19, 2004

Understanding Portals and Portlets: Part Two (SYS-CON)(Printview)

Understanding Portals and Portlets: Part Two (SYS-CON)(Printview)

Tomcat Installed

Downloaded maven and setup environment variable and path in /etc/profile.d/maven.sh

Downloaded Tortoise for Subversion http://tortoisesvn.tigris.org/download.html

Downloaded pluto from http://svn.apache.org/repos/asf/.

Run the maven fullDeployment command in the pluto directory.

Running Tomcat as a Service on Linux

This is the script that im using to startup and shutdown tomcat automatically on Linux

1. Save tomcat start / stop script
Copy and paste the following script into your text editor:




#!/bin/bash
#
# Startup script for Tomcat
#
# chkconfig: 345 84 16
# description: Tomcat jakarta JSP server

TOMCAT_HOME=/usr/local/tomcat
startup=$TOMCAT_HOME/bin/startup.sh
shutdown=$TOMCAT_HOME/bin/shutdown.sh

#Necessary environment variables
export JAVA_HOME="/usr/local/java/java"
export CATALINA_HOME="/usr/local/tomcat"
#export LD_KERNEL_ASSUME="2.2.5"

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

#Check for tomcat script
if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
then
echo "Tomcat not available..."
exit
fi

start(){
echo -n $"Starting Tomcat service: "
#daemon -c
$startup
RETVAL=$?
echo
}

stop(){
action $"Stopping Tomcat service: "
$shutdown
RETVAL=$?
echo
}


status() {
ps ax --width=1000 grep "[o]rg.apache.catalina.startup.Bootstrap start" awk '{printf $1 " "}' wc awk '{print $2}' > /tmp/tomcat_process_count.txt
read line < /tmp/tomcat_process_count.txt if [ $line -gt 0 ]; then echo -n "tomcatd ( pid " ps ax --width=1000 grep "[o]rg.apache.catalina.startup.Bootstrap start" awk '{printf $1 " "}' echo -n ") is running..." echo else echo "Tomcat is stopped" fi } case "$1" in start) start ;; stop) stop ;; restart) stop sleep 3 start ;; status) status ;; *) echo "Usage: tomcatd {start stop restart status}" exit 1 esac exit 0 Edit the lines that start with tomcat and export to match where you installed tomcat and your jdk. 2. Save to /etc/init.d and chmod
Save the edited file above to /etc/init.d directory as "tomcatd"

Then you have to allow execute access to the script, so run:
chmod a+x tomcat

3. Add to appropriate run level directories
The easy way to do this is to just simply run:
chkconfig --add tomcat

thats it.

this will also allow you to start and stop tomcat manually

service tomcatd start
service tomcatd stop

Saturday, December 18, 2004

Installing Apache on Tomcat on Mandrake 10.0

1. Install Mandrake 10.0 from CD's

If you need help, please use the following link:

Select the following groups:


· Console Tools

· Development

· KDE Workstation (or Gnome)



Additionally you need the following packages:

· Webmin

· Apache2

· PostgreSQL

PostgreSQL server is not setup on Mandrake by default (Client is, but not server), used control centre install to dowload server and jdbc.

login as root

/etc/rc.d/init.d/postgresql restart

# su - postgres
$ createuser youruser

Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
$ createdb youruser
CREATE DATABASE

$ exit
# exit
# su youruser
$ psql
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.
youruser=> create table states (state_code varchar(2) primary key, state_name varchar(30) not null);

CREATE TABLE
youruser=> insert into states(state_code, state_name) values ('VA','Virgina');
INSERT 16981 1
youruser=> insert into states(state_code, state_name) values ('MD','Maryland');
INSERT 16982 1

youruser=> select * from states;
state_code | state_name
------------+----------
VA | Virgina
MD | Maryland

(2 rows)

youruser=> \q




Please use the Mandrake Control Center to perform an update of your software. By clicking on “Mandrake Update” the system will be connected to the nearest FTP server and will get security updates, bugfixes and normal updates.




1.1 Get Webmin running



It is time to get Webmin running. Webmin is a web-based interface for system administration for UNIX. Using any browser that supports tables and forms (and Java for the File Manager module), you can setup user accounts, Apache, DNS, MySQL, file sharing and so on. Webmin consists of a simple web server, and a number of CGI programs which directly update system files like /etc/inetd.conf and /etc/passwd. The web server and all CGI programs are written in Perl version 5, and use no non-standard Perl modules. Please get more information about Webmin here:



http://www.webmin.com/



Honestly, we really do not need Webmin to get everything running, but it is a wonderful tool for a LINUX system administrator and it will help us to configure stuff. After the installation please check if Webmin is already running:

/etc/init.d/webmin status

If not, please start it like this:

/etc/init.d/webmin start

You can now use the Webmin interface with your favorite browser via the following URLs:

https://localhost:10000 or https://IP-address:10000



1.3 Configure PostgreSQL

Please edit the following configuration file:

/var/lib/pgsql/data/postgresql.conf

and make sure that the this line is anabled:

tcpip_socket = true

In the file /var/lib/pgsql/data/pg_hba.conf we need this the following:

local all all trust
host all all 127.0.0.1 255.255.255.255 trust

Please use Webmin to open PostgreSQL Database Server by clicking on Servers - PostgreSQL Database Server. In this phase just make sure that PostgresSQL starts and stops without an error.

Note: You need the perl-DBD-Pg package installed to avoid error messages.

1.4 Configuring Apache2

To configure Apache2 use Webmin – Servers – Apache Webserver and click on Module Config.

Please change the following entries:

Path to httpd executable to: /usr/sbin/httpd2

Path to httpd.conf to: /etc/httpd/2.0/conf/httpd2.conf


Configure the necessary modules (just leave it like it is) and you will find the global configuration overview. In this phase just make sure that Apache starts and stops without an error message. We will configure it later.

2.1 Java stuff

Lets go to Sun first. Download the following files and store them in your favourite installation directory: (i.e. /installations)

http://java.sun.com/j2se/1.4.2/download.html
download j2sdk-1_4_2_05-linux-i586.bin

http://java.sun.com/products/javamail/downloads/index.html
download javamail-1_3_1-upd.zip

http://java.sun.com/products/javabeans/glasgow/jaf.html
download jaf-1_0_2-upd.zip

http://java.sun.com/products/jta/
download the class files and javadocs.

http://java.sun.com/products/servlet/archive.html
download Java Servlet Development Kit 2.0 for Solaris (jsdk20-solaris2-sparc.tar.Z).

Install j2sdk like this:

cd /installations

chmod 700 j2sdk-1_4_2_05-linux-i586.bin

./j2sdk-1_4_2_05-linux-i586.bin

(need to add create java_home and add to path

create /etc/profile.d/java.sh

JAVA_HOME=/download/j2sdk1.4.2_05
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

chmod 755 /etc/profile.d/java.sh
)




Install javamail like this:



cd /installations

unzip javamail-1_3_1-upd.zip

cd javamail-1.3.1/

cp mail.jar /usr/share/java





Install jaf like this:



cd /installations

unzip jaf-1_0_2-upd.zip

cd jaf-1.0.2

cp –R * /usr/share/java





Install Jta like this:



Unzip the following files and copy the content to /usr/share/java:

jta-1_0_1B-classes.zip

jta-1_0_1B-doc.zip


Install jsdk20



cd /installations

tar xzf jsdk20-solaris2-sparc.tar.Z

chown –R root:root JSDK2.0/

cp -R JSDK2.0 /usr/local/





2.2 Install additional RPM packages from Installation CD



Please use RPMDrake in Mandrake Control Center to install the following files:



jdom-1.0.0.b8.2jpp
ant-1.5.4-2jpp
postgresql-jdbc-7.3.4-2mdk
apache2-devel-2.0.47-6.6.92mdk

Note: If RPMDrake asks to install depended files, please do it.

2.4 Installing Jakarta Tomcat 5

Please download jakarta-tomcat-5.0.28.tar.gz from here and store it in you installation directory:

http://jakarta.apache.org/site/binindex.cgi

Install Tomcat like this:

cd /installation

tar xzf jakarta-tomcat-5.0.28.tar.gz

cd jakarta-tomcat-5.0.28

mkdir /usr/local/tomcat

cp –R * /usr/local/tomcat

/usr/local/tomcat/bin/startup.sh

Use your favourite browser to check if tomcat is installed properly.

http://yourserver:8080


At the end do not forget to restart Tomcat 5 like this:

/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh


2.6 Install Apache Module Mod_jk

I couldn’t find this Apache Module on the CDs. So I searched for files I can download out of the net. Here is my solution:

I downloaded jakarta-tomcat-connectors-jk2-2.0.4-src.zip
from here:

http://www.apache.de/dist/jakarta/tomcat-connectors/jk2/source/


To compile the source we need to do the following steps:

cd /installation
unzip jakarta-tomcat-connectors-jk2-2.0.4-src.zip

This will create a folder called jakarta-tomcat-connectors-jk2-2.0.4-src. Rename it to jakarta-tomcat-connector.

Move this folder to wherever you store source files on your system. I used /usr/src.

copy –R jakarta-tomcat-connector /usr/src

Then run the buildconf script to create the configuration file.

cd /usr/src/jakarta-tomcat-connector/jk/native2
./buildconf.sh
Run the configure script with the path to the apxs file on your system and the options below:

./configure --with-apxs2=/usr/sbin/apxs2
Note: You need to install rpm package apache2-devel-2.0.47 first!

Build mod_jk2 with the following command:

make

If all went well, the mod_jk2.so file was successfully created. Manually copy it to Apache's shared object files directory:



cp /usr/src/jakarta-tomcat-connector/jk/build/jk2/apache2/mod_jk2.so /etc/httpd/2.0/modules

cp /usr/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/server/apache2/mod_jk2.c /etc/httpd/2.0/modules

cp /usr/src/jakarta-tomcat-connector/jk/native2/server/apache2/mod_jk2.c /etc/httpd/2.0/modules

Add the following line to the file /etc/httpd/2.0/conf/httpd2.conf:

LoadModule jk2_module modules/mod_jk2.so

Copy the file workers2.properties to /etc/httpd/conf

Restart Apache like this:

service httpd restart

Tuesday, December 14, 2004

Linux Tutorial: PostgreSQL Database and Linux

Linux Tutorial: PostgreSQL Database and Linux: "YoLinux Tutorial: The PostgreSQL Database and Linux"

Linux Forum: Apache, Webmin and Mandrake - Linux Operating System Help

Linux Forum: Apache, Webmin and Mandrake - Linux Operating System Help: "To configure the Webmin module for Mandrake's (10.0) default installation of Apache2 (it was expecting Apache 1.x,) change the following:

Apache server root directory: /etc/httpd/2.0
Path to httpd executable: /usr/sbin/httpd2
Path to httpd.conf: /etc/httpd/conf/httpd2.conf" (slight change here)

PostgreSQL 7.3 Documentation

PostgreSQL 7.3 Documentation: "PostgreSQL 7.3 Documentation"

Monday, December 13, 2004

Learn the basic steps necessary to download, install, and configure a basic Apache server

Dev Shed: "Learn the basic steps necessary to download, install, and configure a basic Apache server"

Sunday, December 12, 2004

How to install OPEN-XCHANGE™ with Webmin, APACHE2, OpenLDAP and PostgreSQL on Mandrake 9.2

How to install OPEN-XCHANGE™ with Webmin, APACHE2, OpenLDAP and PostgreSQL on Mandrake 9.2?





By Frank Neugebauer


http://www.linux-tip.net

linux-tip@web.de


Last Modified: 28/09/2004 8:11 PM




0. Introduction





OPEN-XCHANGE™ is a collaboration and integration server environment with a continuous right management for modules and objects.
OPEN-XCHANGE™ ("OX") is a GPL Groupware solution provided by Netline.
It's the "community" version of Novell/SUSE LINUX OPEN-XCHANGE™ Server ("SLOX").
The product is based on existing components like a web server, mail server, directory server and a database.
OPEN-XCHANGE™ is JAVA™ based with some pieces of C for security components.


OPEN-XCHANGE™ provides the following modules:

- Portal
- Calendar
- Contacts
- Addresses
- Tasks
- Projects
- Documents
- Knowledge
- Bookmarks
- Pinbord
- Forums
- Webmailer

This guide contains all the necessary information for installing and understanding the architectural layout of the implementation. It was written with the assumption that you understand how to install programs and have a basic understanding of Linux Mandrake. This includes installing Linux Mandrake and RPM packages, editing files, making directories, compiling software and understanding general UNIX commands. This guide doesn’t explain how to use or configure OPEN-XCHANGE™, Apache, Postfix, Cyrus and all the other server but information on where to obtain this information can be found in the “Additional information” section.

Please note, the way the software is installed here is good enough for testing purposes, but certainly not for a production environment. I am also not responsible of possible data losses caused by the use of this guide.

The guide is divided in three parts. In the first part we will perform a basic Mandrake 9.2 installation and the basic configuration of the needed servers. The second part continues with Java installation and compiling. This guide ends with the Post-Installation process and the basic OPEN-XCHANGE™ configuration.









1.0 Basic Mandrake 9.2 Installation


I’m using Mandrake Linux PowerPack 9.2 (9 CDs) for this installation. You can already find this distribution (DVD) in some computer magazines or please purchase the software here:

http://store.mandrakesoft.com


I don’t want to explain how to install Mandrake. It is very easy theses days. If you need help, please use the following link:




http://www.mandrakelinux.com/en/fdoc.php3

It is now time to specify which programs you wish to install on your system. There are thousands of packages available for Mandrake Linux, and to make it simpler to manage the packages have been placed into groups of similar applications. We just need a basis system. For that reason you should select the following groups:



· Console Tools

· Development

· KDE Workstation (or Gnome)



Additionally you need the following packages:



· Webmin

· Apache2

· PostgreSQL

· Open-LDAP
(urpmi openldap-servers openldap-migration)

· Postfix

· Cyrus


PostgreSQL server is not setup on Mandrake by default (Client is, but not server), used control centre install to dowload server and jdbc.

login as root

/etc/rc.d/init.d/postgresql restart

# su - postgres
$ createuser youruser

Shall the new user be allowed to create databases? (y/n) y
Shall the new user be allowed to create more new users? (y/n) n
CREATE USER
$ createdb youruser
CREATE DATABASE

$ exit
# exit
# su youruser
$ psql
Welcome to psql 7.3.2, the PostgreSQL interactive terminal.
youruser=> create table states (state_code varchar(2) primary key, state_name varchar(30) not null);

CREATE TABLE
youruser=> insert into states(state_code, state_name) values ('VA','Virgina');
INSERT 16981 1
youruser=> insert into states(state_code, state_name) values ('MD','Maryland');
INSERT 16982 1

youruser=> select * from states;
state_code | state_name
------------+----------
VA | Virgina
MD | Maryland

(2 rows)

youruser=> \q




Please use the Mandrake Control Center to perform an update of your software. By clicking on “Mandrake Update” the system will be connected to the nearest FTP server and will get security updates, bugfixes and normal updates.




1.1 Get Webmin running



It is time to get Webmin running. Webmin is a web-based interface for system administration for UNIX. Using any browser that supports tables and forms (and Java for the File Manager module), you can setup user accounts, Apache, DNS, MySQL, file sharing and so on. Webmin consists of a simple web server, and a number of CGI programs which directly update system files like /etc/inetd.conf and /etc/passwd. The web server and all CGI programs are written in Perl version 5, and use no non-standard Perl modules. Please get more information about Webmin here:



http://www.webmin.com/



Honestly, we really do not need Webmin to get everything running, but it is a wonderful tool for a LINUX system administrator and it will help us to configure Apache, PostgresSQL, Open-LDAP and all other servers. After the installation please check if Webmin is already running:



/etc/init.d/webmin status



If not, please start it like this:



/etc/init.d/webmin start



You can now use the Webmin interface with your favorite browser via the following URLs:



https://localhost:10000 or https://IP-address:10000






1.2 Create users and databases



OPEN-XCHANGE™ needs few users and groups on Mandrake and PostgresSQL to make the installation go without an error message.



useradd ox
su postgres
createuser -A -D -P openexchange
createdb openexchange exit



Note: Please remember the passwords.





1.3 Configure PostgreSQL

Please edit the following configuration file:

/var/lib/pgsql/data/postgresql.conf

and make sure that the this line is anabled:

tcpip_socket = true

In the file /var/lib/pgsql/data/pg_hba.conf we need this the following:

local all all trust
host all all 127.0.0.1 255.255.255.255 trust




Please use Webmin to open PostgreSQL Database Server by clicking on Servers - PostgreSQL Database Server. You will find the database openexchange (just empty) and the openexchange user already installed. In this phase just make sure that PostgresSQL starts and stops without an error.



Note: You need the perl-DBD-Pg package installed to avoid error messages.



1.4 Configuring Apache2



To configure Apache2 use Webmin – Servers – Apache Webserver and click on Module Config.



Please change the following entries:



Path to httpd executable to: /usr/sbin/httpd2

Path to httpd.conf to: /etc/httpd/2.0/conf/httpd2.conf


Configure the necessary modules (just leave it like it is) and you will find the global configuration overview. In this phase just make sure that Apache starts and stops without an error message. We will configure it later.




1.5 Configuring Open-LDAP



To configure Open-LDAP use Webmin – Servers – OpenLDAP Server. Leave everything like it is. Just make sure that the daemon starts and stops without error.







2.0 Installing Java and compiling OPEN-XCHANGE™



This part is not so easy like the first part. We need to download a lot more rpm packages and other files from different locations. It is not always uncomplicated to find the correct file on the 9 Mandrake 9.2 CDs. I downloaded some software from Sun as well.





2.1 Java stuff



Lets go to Sun first. Download the following files and store them in your favourite installation directory: (i.e. /installations)

http://java.sun.com/j2se/1.4.2/download.html
download j2sdk-1_4_2_05-linux-i586.bin

http://java.sun.com/products/javamail/downloads/index.html
download javamail-1_3_1-upd.zip

http://java.sun.com/products/javabeans/glasgow/jaf.html
download jaf-1_0_2-upd.zip

http://java.sun.com/products/jta/
download the class files and javadocs.

http://java.sun.com/products/servlet/archive.html
download Java Servlet Development Kit 2.0 for Solaris (jsdk20-solaris2-sparc.tar.Z).



Install j2sdk like this:



cd /installations

chmod 700 j2sdk-1_4_2_05-linux-i586.bin

./j2sdk-1_4_2_05-linux-i586.bin

(need to add create java_home and add to path

create /etc/profile.d/java.sh

JAVA_HOME=/download/j2sdk1.4.2_05
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH
)




Install javamail like this:



cd /installations

unzip javamail-1_3_1-upd.zip

cd javamail-1.3.1/

cp mail.jar /usr/share/java





Install jaf like this:



cd /installations

unzip jaf-1_0_2-upd.zip

cd jaf-1.0.2

cp –R * /usr/share/java





Install Jta like this:



Unzip the following files and copy the content to /usr/share/java:

jta-1_0_1B-classes.zip

jta-1_0_1B-doc.zip


Install jsdk20



cd /installations

tar xzf jsdk20-solaris2-sparc.tar.Z

chown –R root:root JSDK2.0/

cp -R JSDK2.0 /usr/local/





2.2 Install additional RPM packages from Installation CD



Please use RPMDrake in Mandrake Control Center to install the following files:



jdom-1.0.0.b8.2jpp
ant-1.5.4-2jpp
postgresql-jdbc-7.3.4-2mdk
apache2-devel-2.0.47-6.6.92mdk advx-build,libgdbm2-devel


We also need some perl libraries:



perl-Concert-ASN1-0.16-4mdk
perl-ldap-0.29-1mdk
perl-IO-Socket-SSL-0.95-1mdk
perl-Authen-SASL-2.04-2mdk
perl-Net_SSLeay-1.25-1mdk


Note: If RPMDrake asks to install depended files, please do it.





2.3 Compiling OPEN-XCHANGE™ and first check



Please download the OPEN-XCHANGE™ from the following website and store it in your installation directory:



http://mirror.open-xchange.org/ox/EN/community/



cd /installations

tar xzf open-xchange-0.7.1.tar.gz

cd open-xchange.0.7.1/

./configure --prefix=/usr/local/ox --with-mailjar=/usr/share/java/mail.jar --with-activationjar=/usr/share/java/activation.jar --with-jdomjar=/usr/share/java/jdom.jar --with-xercesjar=/usr/share/java/xerces-j2.jar --with-jsdkjar=/usr/local/JSDK2.0/lib/jsdk.jar --with-jdbcjar=/usr/share/pgsql/pg73jdbc3.jar --with-runuid=ox --with-rungid=ox

make

make install
chown –R ox:ox /usr/local/ox/var


Note: To avoid the following error message, you should start PostgrSQL sever first:



configure: WARNING: it seems that the database can not be reached ... maybe the application will not work as expected



Next we need to copy the following files to Apache’s cgi-bin directory: login.pl and login.pm



cd /usr/local/ox/share/perl

cp login.* /var/www/cgi-bin



Please try to enter the login screen using your favourite browser:



http://servername/cgi-bin/login.pl or http://IPaddress/cgi-bin/login.pl





I had an Internal Server error. Checking the Apache error log file I discovered the following message:



Can't locate auto/Net/SSLeay/randomize.al in @INC (@INC contains:
/usr/lib/perl5/5.8.1/i386-linux-thread-multi /usr/lib/perl5/5.8.1


I found out that the RPM package perl-Net_SSLeay-1.25-mdk.i586.rpm doesn't have the file randomize.al.

Here is my workaround:

I regenerated the file SSLeay.pm with the following commands:

cd /usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi
perl -e 'use AutoSplit; autosplit("Net/SSLeay", "auto", 0, 1, 1)'


2.4 Installing Jakarta Tomcat 5

Please download jakarta-tomcat-5.0.28.tar.gz from here and store it in you installation directory:

http://jakarta.apache.org/site/binindex.cgi


Install Tomcat like this:





cd /installation

tar xzf jakarta-tomcat-5.0.28.tar.gz

cd jakarta-tomcat-5.0.28

mkdir /usr/local/tomcat

cp –R * /usr/local/tomcat

/usr/local/tomcat/bin/startup.sh



Use your favourite browser to check if tomcat is installed properly.



http://yourserver:8080







2.5 Installling Servlets

Copy intranet.class and webmail.class in the tomcat webapps tree :

cd /usr/local/tomcat/webapps
mkdir servlet
mkdir servlet/WEB-INF
mkdir servlet/WEB-INF/classes
cd servlet/WEB-INF/classes
cp /usr/local/ox/share/servlets/*.class .



Now create the file web.xml in
/usr/local/tomcat/webapps/servlet/WEB-INF.

Use this as an example:






Servlet OpenXchange

Servlet OpenXchange 0.7.1




intranet
intranet



webmail
webmail



intranet
/intranet



webmail
/webmail








The servlets won't work until you modify the classpath. So do this:



cd /usr/local/tomcat/webapps/servlet/WEB-INF
mkdir lib
cd lib
cp /usr/local/ox/lib/*.jar .





At the end do not forget to restart Tomcat 5 like this:



/usr/local/tomcat/bin/shutdown.sh
/usr/local/tomcat/bin/startup.sh



To check if everything is working fine, open you favourite Browser and go to the following URL:



http://myhost:8080/servlet/intranet



You should see a message "No running Server found“: it means that all is OK.




2.6 Install Apache Module Mod_jk

I couldn’t find this Apache Module on the CDs. So I searched for files I can download out of the net. Here is my solution:

I downloaded jakarta-tomcat-connectors-jk2-2.0.4-src.zip
from here:

http://www.apache.de/dist/jakarta/tomcat-connectors/jk2/source/


To compile the source we need to do the following steps:

cd /installation
unzip jakarta-tomcat-connectors-jk2-2.0.4-src.zip

This will create a folder called jakarta-tomcat-connectors-jk2-2.0.4-src. Rename it to jakarta-tomcat-connector.

Move this folder to wherever you store source files on your system. I used /usr/src.

copy –R jakarta-tomcat-connector /usr/src

Then run the buildconf script to create the configuration file.

cd /usr/src/jakarta-tomcat-connector/jk/native2
./buildconf.sh
Run the configure script with the path to the apxs file on your system and the options below:

./configure --with-apxs2=/usr/sbin/apxs2
Note: You need to install rpm package apache2-devel-2.0.47 first!

Build mod_jk2 with the following command:

make

If all went well, the mod_jk2.so file was successfully created. Manually copy it to Apache's shared object files directory:



cp /usr/src/jakarta-tomcat-connector/jk/build/jk2/apache2/mod_jk2.so /etc/httpd/2.0/modules

cp /usr/src/jakarta-tomcat-connectors-jk2-2.0.4-src/jk/native2/server/apache2/mod_jk2.c /etc/httpd/2.0/modules

cp /usr/src/jakarta-tomcat-connector/jk/native2/server/apache2/mod_jk2.c /etc/httpd/2.0/modules

Add the following line to the file /etc/httpd/2.0/conf/httpd2.conf:

LoadModule jk2_module modules/mod_jk2.so

Copy the file workers2.properties to /etc/httpd/conf

Restart Apache like this:

service httpd restart




3.0 Post-Installation and first run

3.1 Postgresql database

In the last part we’ll finally configure Postgresql, LDAP and will start the necessary services.

Lets start to populate the database. Just do the following:

psql -dopenexchange -h localhost -Uopenexchange -W -f /usr/local/ox/share/init_database.sql
psql -dopenexchange -h localhost -Uopenexchange -W
INSERT INTO sys_gen_rights_template values
('now','admin','now','','default_template','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y','y','y',
'y','y','y','y','y','y','y','y','y','y','y','y','y');
\q



3.2 Configuring LDAP
Edit your /etc/openldap/slapd.conf and add the following lines:

include /usr/local/ox/share/openxchange.schema

suffix "dc=example,dc=org"
rootdn "cn=Manager,dc=example,dc=org"
rootpw secret

index uid,mailEnabled,cn,sn,givenname,lnetMailAccess,alias,loginDestination eq,sub

Now create a password as stated in the INSTALL file:

$perl -e 'print crypt("mypassword",pack("C2",(int(rand 26)+65),(int(rand 26)+65)))."\n";'
CGPbeX4Qyrui2
$

Edit /usr/local/ox/share/init_ldap.ldif and modify the line

userPassword: {CRYPT}newmailadminpass

... to the result of the perl command. In my example it is:

userPassword: {CRYPT}CGPbeX4Qyrui2
Now insert the LDAP data :

slapadd -l /usr/local/ox/share/init_ldap.ldif
If you have an error, check your config and try again until it works ... If you need to reset the LDAP database, here's the solution:

/etc/init.d/lapd stop
rm /var/lib/ldap/*
/etc/init.d/lapd start

(you need to remove any duplicated entries from the indicated files,dont understand why these things are wrong out of the box?)

Note: Please check if all files in /var/lib/ldap are owned by ldap.

Now modify your /etc/openldap/ldap.conf like this:

BASE dc=example,dc=org
HOST localhost

Note: Do not put any space after the comma in dc=example,dc=org !!!

Create a symbolic link like this:

ln -s /etc/openldap/ldap.conf /usr/local/ox/etc/groupware/ldap.conf



3.3 Create a user

Let's try your PostgreSQL / LDAP config by adding a user:

adduser_ox --username="john" --passwd="password" --name="doe" --sname="john" --maildomain="example.org" --ox_timezone="Europe/Paris"



Check carefully the feedback of the command. Even if you have a green "OK" message, you can have an error message ... If this is the case, don't go further until it is corrected!

If we still follow the INSTALL file, we now add a openxchange group:

addgroup_ox --group=developers




3.4 Website files preparation

Copy the following files to wwwroot (Mandrake normally uses /var/www/html)

cd /var/www/html

mkdir cfintranet
mkdir cfintranet/webmail

cd /usr/local/ox/share/groupware/data
cp -R images css javascript /var/www/html/cfintranet

cd /usr/local/ox/share/webmail/data
cp -R images css javascript /var/www/html/cfintranet/webmail





3.5 Creating the filespool

The documentation says this script can "take some time". It's true! If you have a slow server, it is time for a tea or coffee.

cd /usr/local/ox/sbin

sh correctfilespool



Now, all should be OK for starting. First, start the openxchange service :

/usr/local/ox/etc/init.d/openexchange start
Then open the login page http://myhost/cgi-bin/login.pl, and login with the username and password supplied previously to the command adduser_ox :



4.0 Face Lifting

OK, what you now see is not nice. (no icons but ugly squares instead). Fortunately somebody did allady great work.

Please download the file ox_zenith_iconset-0.1.tar.gz from here:

http://ox.cutmasta.org/

Install the new icons like this:

tar xzf ox_zenith_iconset-0.1.tar.gz
cd ox_zenith_iconset/top
cp * /var/www/html/cfintranet/images/top/EN/
cp * /var/www/html/cfintranet/images/top/DE/

installing tomcat on linux - restart

I wasnt happy with the way the install of apache/tomcat/database (postgresql) had gone so far so I decided to start again.

Basically im reinstalling Mandrake 10.0 on my p200 64mb PC.

The first problem that I had previously encountered is that a vncserver is not installed as default in Mandrake. The thing that makes this confusing is that the tightvnc client is!

By googling I discovered that

urpmi tightvnc-server

would perform an install of tightvnc server, and it did, excellent.

Typed vncserver and setup my passwords, and im in business connected to my linux box in the office from the the laptop

Daemon scripts

Daemon scripts: Files in /etc/rc.d/init.d (tomcatd, postgresql, httpd)

tomcatd
#You can add this line for status in tomcatd. It outputs all tomcat processes
ps ax --width=1000 grep "[o]rg.apache.catalina.startup.Bootstrap start" awk '{printf $1 " "}'


postgresql
Here's a brief explanation of unusual features in my daemon scripts
You can make these changes in a daemon script to allow it to connect with jdbc
Edit /etc/rc.d/init.d/postgresql. JDBC needs to connect via tcp/ip, so
add "-i" next to "-p ${PGPORT}" so that the line contains this:
'-i -p ${PGPORT}'


/etc/rc.d/init.d/tomcatd

#!/bin/bash
#
# Startup script for Tomcat
#
# chkconfig: 345 84 16
# description: Tomcat jakarta JSP server
TOMCAT_HOME=/usr/local/tomcat
TOMCAT_START=$TOMCAT_HOME/bin/startup.sh
TOMCAT_STOP=$TOMCAT_HOME/bin/shutdown.sh
#Necessary environment variables
export JAVA_HOME="/usr/local/java/java"
export CATALINA_HOME="/usr/local/tomcat"
#export LD_KERNEL_ASSUME="2.2.5"
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
#Check for tomcat script
if [ ! -f $TOMCAT_HOME/bin/catalina.sh ]
then
echo "Tomcat not available..."
exit
fi
start() {
echo -n "Starting Tomcat: "
su - tomcat -c $TOMCAT_START
echo
touch /var/lock/subsys/tomcatd
# We may need to sleep here so it will be up for apache
sleep 3
#Instead should check to see if apache is up by looking for httpd.pid
}
stop() {
echo -n $"Shutting down Tomcat: "
su - tomcat -c $TOMCAT_STOP
rm -f /var/lock/subsys/tomcatd
echo
}
status() {
ps ax --width=1000 grep "[o]rg.apache.catalina.startup.Bootstrap start" awk '{printf $1 " "}' wc awk '{print $2}' > /tmp/tomcat_process_count.txt
read line < /tmp/tomcat_process_count.txt
if [ $line -gt 0 ]; then
echo -n "tomcatd ( pid "
ps ax --width=1000 grep "[o]rg.apache.catalina.startup.Bootstrap start" awk '{printf $1 " "}'
echo -n ") is running..."
echo
else
echo "Tomcat is stopped"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
status)
status
;;
*)
echo "Usage: tomcatd {startstoprestartstatus}"
exit 1
esac

/etc/rc.d/init.d/postgresqld

#! /bin/sh
# postgresqld This is the init script for starting up the PostgreSQL
# server
#
# chkconfig: 345 83 17
# description: Starts and stops the PostgreSQL backend daemon that handles # all database requests.
# processname: postmaster
# pidfile: /var/run/postmaster.pid
PG_HOME="/usr/local/pgsql"
# Source function library.
INITD=/etc/rc.d/init.d
. $INITD/functions
# Get function listing for cross-distribution logic.
TYPESET=`typeset -F`
# Get config.
. /etc/sysconfig/network
# Find the name of the script
#NAME=`basename $0`
NAME="PostgreSQLd"
# Set defaults for port and database directory
PGPORT=5432
export PGDATA=/usr/local/pgsql/data
# Check that networking is up.
# Pretty much need it for postmaster.
[ "${NETWORKING}" = "no" ] && exit 0
[ -f /$PG_HOME/bin/postmaster ] exit 0
start(){
PSQL_START=$"Starting ${NAME} service: "
echo -n $"Initializing database: "
if [ ! -d $PGDATA ]
then
mkdir -p $PGDATA
chown postgres.postgres $PGDATA
chmod go-rwx $PGDATA
fi
# Make sure the locale from the initdb is preserved for later startups...
[ -f $PG_HOME/i18n ] && cp $PG_HOME/i18n $PGDATA/../initdb.i18n
# Just in case no locale was set, use en_US
[ ! -f $PG_HOME/i18n ] && echo "LANG=en_US" > $PGDATA/../initdb.i18n
# Is expanded this early to be used in the command su runs
echo "export LANG LC_ALL LC_CTYPE LC_COLLATE LC_NUMERIC LC_CTYPE LC_TIME" >> $PGDATA/../initdb.i18n
# Initialize the database
su -l postgres -s /bin/sh -c "$PG_HOME/bin/initdb --pgdata=$PGDATA > /dev/null 2>&1" < /dev/null
[ -f $PGDATA/PG_VERSION ] && echo_success
[ ! -f $PGDATA/PG_VERSION ] && echo_failure
echo
# Check for postmaster already running...
# note that pg_ctl only looks at the data structures in PGDATA
# you really do need the pidof()
pid=`pidof -s $PG_HOME/bin/postmaster`
if [ $pid ] && $PG_HOME/pg_ctl status -D $PGDATA > /dev/null 2>&1
then
echo $"Postmaster already running."
else
#all systems go -- remove any stale lock files
rm -f /tmp/.s.PGSQL.${PGPORT} > /dev/null
echo -n "$PSQL_START"
su -l postgres -s /bin/sh -c "$PG_HOME/bin/pg_ctl -D $PGDATA -p $PG_HOME/bin/postmaster -o '-i -p ${PGPORT}' start > /dev/null 2>&1" < /dev/null
sleep 1
pid=`pidof -s $PG_HOME/bin/postmaster`
if [ $pid ]
then
if echo "$TYPESET"grep "declare -f success" >/dev/null
then
success "$PSQL_START"
else
echo " [ OK ]"
fi
touch /var/lock/subsys/${NAME}
echo $pid > /var/run/postmaster.${PGPORT}.pid
echo
else
if echo "$TYPESET"grep "declare -f failure" >/dev/null
then
failure "$PSQL_START"
else
echo " [ FAILED ]"
fi
echo
fi
fi
}
stop(){
echo -n "Stopping $NAME..."
PSQL_STOP=$"Stopping ${NAME} service: "
su -l postgres -s /bin/sh -c "$PG_HOME/bin/pg_ctl stop -D $PGDATA -s -m fast" > /dev/null 2>&1
ret=$?
if [ $ret -eq 0 ]
then
if echo "$TYPESET"grep "declare -f success" >/dev/null
then
success "$PSQL_STOP"
else
echo " [ OK ]"
fi
else
if echo "$TYPESET"grep "declare -f failure" >/dev/null
then
failure "$PSQL_START"
else
echo " [ FAILED ]"
fi
fi
echo
rm -f /var/run/postmaster.${PGPORT}.pid
rm -f /var/lock/subsys/${NAME}
echo
}
restart(){
stop
start
}
condrestart(){
[ -e /var/lock/subsys/${NAME} ] && restart
}
reload(){
su -l postgres -s /bin/sh -c "$PG_HOME/bin/pg_ctl reload -D $PGDATA -s" > /dev/null 2>&1
}
# This script is slightly unusual in that the name of the daemon (postmaster)
# is not the same as the name of the subsystem (postgresql)
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status postmaster
;;
restart)
restart
;;
condrestart)
condrestart
;;
reloadforce-reload)
reload
;;
*)
echo $"Usage: $0 {startstopstatusrestartcondrestartreloadforce-reload}"
exit 1
esac
exit 0

/etc/rc.d/init.d/httpd

#!/bin/bash
#
# Startup script for the Apache Web Server
#
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve # HTML files and CGI.
# processname: httpd
# pidfile: /var/run/httpd.pid
# config: /usr/local/apache2/conf/access.conf
# config: /usr/local/apache2/conf/httpd.conf
# config: /usr/local/apache2/conf/srm.conf
# Source function library.
. /etc/rc.d/init.d/functions
# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""
# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=/usr/local/apache2/bin/httpd
prog=httpd
RETVAL=0
# Find the installed modules and convert their names into arguments httpd
# can use.
moduleargs() {
moduledir=/usr/local/apache2/modules
moduleargs=`
/usr/bin/find ${moduledir} -type f -perm -0100 -name "*.so" env -i tr '[:lower:]' '[:upper:]' awk '{gsub(/.*\//,"");gsub(/^MOD_/,"");gsub(/^LIB/,"");gsub(/\.SO$/,"");print "-DHAVE_" $0}'`echo ${moduleargs}
}
# The semantics of these two functions differ from the way apachectl does
# things -- attempting to start while running is a failure, and shutdown
# when not running is also a failure. So we just do it the way init scripts
# are expected to behave here.
start() {
echo -n $"Starting $prog: with SSL"
daemon $httpd -DSSL `moduleargs` $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/httpd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/httpd /var/run/httpd.pid
}
reload() {
echo -n $"Reloading $prog: "
killproc $httpd -HUP
RETVAL=$?
echo
}
# See how we were called.
case "$1" in
start)
start
;;
startssl)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/httpd.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
gracefulhelpconfigtest)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {startstartsslstoprestartcondrestartreloadstatusfullstatusgracefulhelpconfigtest}"
exit 1
esac
exit $RETVAL

chkconfig
This installs scripts to start at startup and shutdown when system is halted
After you've copied all daemon scripts to /etc/rc.d/init.d, make sure you've changed the chkconfig line to reflect the appropriate runlevels
First make sure they are disabled, or else chkconfig sometimes gets confused
/sbin/chkconfig --del tomcatd
/sbin/chkconfig --del httpd
/sbin/chkconfig --del postgresql
Now add them
/sbin/chkconfig --add tomcatd
/sbin/chkconfig --add httpd
/sbin/chkconfig --add postgresql

JDBC Configuration

JDBC Configuration

ln -s /usr/local/pgsql/share/java/postgresql.jar /usr/local/tomcat/common/lib/postgresql.jar

I use the dbcp-commons connection pool.

This is in /usr/local/tomcat/webapps/mywebapp/WEB-INF/web.xml

Saturday, December 11, 2004

Setting up java tomcat on linux X - Install Pgaccess

Install Pgaccess

cd /usr/local/src
gunzip pgaccess-0_99_0_20040219.tgz
tar -xf pgaccess-0_99_0_20040219.tar

cp -R pgaccess-0_99_0_20040219 /usr/local/pgaccess

cd pgaccess-0_99_0_20040219

make clean
make all
cat "/usr/local/pgaccess/lib" >> /etc/ld.so.conf
ldconfig

Setting up java tomcat on linux IX - Install Postgresql


Creating the “postgres” User
Create a UNIX user account to own and manage the PostgreSQL database files. Typically, this user is named postgres, but it can be named anything that you choose.

You will need to have root privileges to create the PostgreSQL superuser. You can use the command shown to add the postgres user.

su - -c "useradd postgres"

Install Postgresql

cd /usr/local/src
tar xvfz postgresql-7.3.4.tar.gz
cd postgresql-7.3.4

then logoff and login as the postgres user (this wont work if your java and ant environment variables and path additions are not setup properly)

./configure --with-tcl --with-java

gmake
su -c "gmake install"
su -c "chown -R postgres.postgres /usr/local/pgsql"

Setting Environment Variables
The use of the PostgreSQL environment variables is not required. However, they are helpful when performing tasks within PostgreSQL, including starting and shutting down the postmaster processes.
The environment variables that should be set are for the man pages and the bin directory. You can do so by adding the following statements into the /etc/profile file.

PATH=$PATH:/usr/local/pgsql/bin
MANPATH=$MANPATH:/usr/local/pgsql/man
export PATH MANPATH

Initializing and Starting PostgreSQL
/usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data

Running postmaster in the background
/usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /tmp/pgsql.log start

Configuring the PostgreSQL SysV Script
The SysV script will allow the graceful control of the PostgreSQL database through the use of the SysV runlevel system. The SysV script can be used for starting, stopping, and status-checking of PostgreSQL. It is known to work with most Red Hat based versions of Linux, including Mandrake; however, it should work with other SysV systems (e.g., UnixWare, Solaris, etc.) with little modification. The script is named linux. To use it, you will first need to copy the linux script to your init.d directory. You may require root access to do this.
First, change to the directory where you unpacked the PostgreSQL source. eg /usr/local/src/postgresql-7.1.3/. Then, issue a cp command to copy the script from contrib/start-scripts into the init.d

Copying the linux script
cd /usr/local/src/postgresql-7.4.6
su -c "cp contrib/start-scripts/linux /etc/rc.d/init.d/postgresql"

Making the linux script executable
su -c "chmod a+x /etc/rc.d/init.d/postgresql"

There are no additional requirements to use the SysV script with Red Hat, if you do not intend on using it to start PostgreSQL automatically (i.e., if you wish to use the script manually). However, if you do wish for the script to startup PostgreSQL automatically when the machine boots up (or changes runlevels), you will need to have the chkconfig program installed. If chkconfig is installed, you will also need to add the following two lines, including the hash (#) symbol, at the beginning of the /etc/rc.d/init.d/postgresql file:

# chkconfig: 345 85 15
# description: PostgreSQL RDBMS

Starting PostgreSQL with the SysV script:

service postgresql start
Starting PostgreSQL: ok

service postgresql stop
Stopping PostgreSQL: ok

The next step will be to create a new database. This will be a simple test database. We do not recommend using the default template1 database for testing purposes. As you have not created any users with database-creation rights, you will want to make sure that you are logged in as the postgres user when adding a new database.

To create a new database named testdb, enter the command shown:
createdb testdb

psql testdb

You can now start entering SQL commands (e.g., such as SELECT) at the psql prompt
To verify that the database is working correctly, you can issue the command shown in which should give you a listing of the languages installed in the database

SELECT * FROM pg_language;

lanname lanispl lanpltrusted lanplcallfoid lancompiler
----------+---------+--------------+---------------+-------------
internal f f 0 n/a
C f f 0 /bin/cc
sql f f 0 postgres

10 Steps to Installing PostgreSQL

10 Steps to Installing PostgreSQL

Problem setting PATH on Mandrake 10

I posted these instructions earlier

Configure Environment Variables

Edit and add the lines below to '/etc/profile'

Make sure you logout and login for this to take effect.

It's really good to get this straight from the beginning.
JAVA_HOME=/usr/local/java/java
CATALINA_HOME=/usr/local/tomcat
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin:/sbin:/usr/sbin
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/common/lib/servlet.jar:/usr/local/pgsql/share/java/postgresql.jar:../lib/struts.jar:.
Now add the PATH JAVA_HOME CATALINA_HOME & CLASSPATH if any aren't in the export line
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC JAVA_HOME CATALINA_HOME CLASSPATH"

I had problems with this because when I logged off and on again, the variables had been created, but the path wasnt being changed.

Turns out this happens because I was logged on as root, so the PATH gets overridden after its set. Logging on as another user showed that the PATH does indeed get set properly. Helpdesk closed!

Thursday, December 09, 2004

The K-Zone: Understanding the Linux boot process

The K-Zone: Understanding the Linux boot process: "Understanding the Linux boot process"

Formatting and sorting dates in Displaytag

I use Displaytag for displaying data in an as400 Work-With Subfile type format in web pages, and it works very well.

One problem I came across was formatting the dates, whilst still using the automatic sorting. I thought I would have to format my data in my POJO and lose the automatic sorting.

But in fact Displaytag solves this problem by allowing you to apply decorators to columns

eg:

package com.decorator;

import java.util.Date;

import org.apache.commons.lang.time.FastDateFormat;
import org.displaytag.decorator.ColumnDecorator;


/**
* Simple column decorator which formats a date.
* @author epesh
* @author Fabrizio Giustina
* @version $Revision: 1.11 $ ($Author: fgiust $)
*/
public class DatetoDMY implements ColumnDecorator
{

/**
* FastDateFormat used to format the date object.
*/
private FastDateFormat dateFormat = FastDateFormat.getInstance("dd.MM.yyyy HH:mm:ss"); //$NON-NLS-1$

/**
* transform the given object into a String representation. The object is supposed to be a date.
* @param columnValue Object
* @return String
*/
public final String decorate(Object columnValue)
{
Date date = (Date) columnValue;
return this.dateFormat.format(date);
}
}

Wednesday, December 08, 2004

Setting up java tomcat on linux VIII - Configure Tomcat for mod_jk Connector

Configure Tomcat for mod_jk Connector

Directly below this line in '/usr/local/tomcat/conf/server.xml'

<Server port='8005' shutdown='SHUTDOWN' debug='1'\>

Add these lines:
<Listener className='org.apache.ajp.tomcat4.config.ApacheConfig'
modJk='/usr/local/apache2/modules/mod_jk.so'
workersConfig='/usr/local/tomcat/conf/jk/workers.properties'/>

Directly below this line in '/usr/local/tomcat/conf/server.xml'

<Host name='localhost' debug='0' appBase='webapps'>

Add this line

<Listener className='org.apache.ajp.tomcat4.config.ApacheConfig'
append='true' forwardAll='false'
modJk='/usr/local/apache2/modules/mod_jk.so' />

Comment out JK2 connector, and uncomment AJP1.3 connector (jk).(Does not appear to be required for tomcat5)
Change instances of localhost to whatever your domain name is

Create file '/usr/local/tomcat/conf/jk/workers.properties' with these contents:

# Setting Tomcat & Java Home
workers.tomcat_home=/usr/local/tomcat
workers.java_home=/usr/local/java/java
ps=/
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13

Setting up java tomcat on linux VII - HowTo make your own Self-Signed SSL Certificate

cd /usr/local/ssl/bin

### Create server key

openssl genrsa -out mysite.key 1024

Generating RSA private key, 1024 bit long modulus
........................................++++++
....++++++
e is 65537 (0x10001)

### Create certificate request

openssl req -new -key mysite.key -out mysite.csr

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:GB
State or Province Name (full name) [Some-State]:Norfolk
Locality Name (eg, city) []:Norwich
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Manic Miner Ltd
Organizational Unit Name (eg, section) []:Web Development
Common Name (eg, YOUR name) []:dooley.com
Email Address []:webmaster@dooley.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:freedom1
An optional company name []:Manic Miner Ltd

### self sign key (increment the serial number "N" for each new cert)

openssl x509 -req -days 365 -set_serial 001 -in mysite.csr -signkey mysite.key -out mysite.crt

Signature ok
subject=/C=GB/ST=Norfolk/L=Norwich/O=Manic Miner Ltd/OU=Web Development/CN=mysite/emailAddress=webmaster@mysite
Getting Private key

cp myhost.mydomain.* /usr/local/apache2/conf

#edit http.conf (or ssl.conf) file

SSLCeritifcateFile /usr/local/apache2/conf/myhost.mydomain.cert
SSLCertificateKeyFile /usr/local/apache2/conf/myhost.mydomain.key

Tuesday, December 07, 2004

Basic Vim

Vim (Vi improved) is a very popular, full featured text editor for Linux/Unix systems. It is practically guaranteed to be installed on most systems. If you are using a Linux/Unix shell account, you will appreciate Vim's ability to open, edit, create, and save files. Unfortunately, Vim is not very intuitive. Most will remember the helpless feeling they had on their first encounter.

There are an astounding number of commands for Vim. Even advanced users only use a subset of the available commands. This tutorial will endeavor to teach you enough to be productive and point you in the right direction should you desire to learn more.

Vim operates from within a shell. All commands are made from the keyboard. There is no mouse support, no fancy GUI, and no hints appear on the screen.

To start Vim, simply type vi at the command line.
This will open Vim with a new document and give you some basic version information and a hint or two. As soon as you begin inserting text, the information will disappear.
A variation on this is to type vi filename which will open Vim with that file loaded.
This is where most people will get stuck. Right at the beginning with no idea of how to insert text, save a file, or even exit the program! It seems to be some sort of a cruel joke. Windows users may even resort to rebooting the system or crashing the shell. (Linux systems can run for years without rebooting, this is never a good option.)

Here are the most important commands that you need to know. Commands for saving, writing and exiting are available when you are not in insert mode and are in the form ":command". That is a colon followed by the command. To toggle from command mode to insert mode, press i to enter insert mode. Press the "Esc key" to get back to command mode..

To change to INSERT mode press i or "insert".
To change out of INSERT mode press "Esc".
To exit the program type: :q.
To exit without saving type: :q!.
To write your file type: :w.
To write a new file and name it, type: :w filename.
OK, that will get you started. You can now do the most important things that you would want to do with a text editor. You can now open, create, edit, and save files as well as start and exit the program. Whew...

Moving around within a document:

You will quickly notice that the arrow keys, and the "home" and "end" keys do just about what you would expect them to do. Some of the behavior, however, is not really what you are looking for. Notice that when you arrow up or down the cursor jumps to the carriage returns rather than the screen lines.

There are an over abundance of ways to move around a document. Most will require that you are not in insert mode. Get use to moving in and out of insert mode! Note that you can add a number before most commands to modify the command.

*Screen lines are different than lines terminated by a carriage return!
To move to the left type: h, Ctrl-H, "back space", or the left arrow key.
To move to the right type: l, "space key", or the right arrow key.
To move to the end of a line type: $ or "End".
To move to the beginning of a line type: 0 or ^.
To move to the first character in a screen line type: g0, or 0.
To move to the last character in a screen line type: g$, or $.
To move to the middle of a screen line type: gm.
To move to a character number (position) in a line type: num |. (pipe symbol)
To move to the n-th occurrence of a character from the right type: num t char.
To move to the n-th occurrence of a character from the left type: num T char.
To move to the right a number of words type: num W.
To move to the left a number of words type: num B.
To move forward a number of sentences type: num ).
To move backward a number of sentences type: num (.
To move forward a number of paragraphs type: num }.
To move backward a number of paragraphs type: num {.
There are many more... This is a good start though.


To move down a line type: j.
To move up a line type: k.
To move down a screen line type: gj, or g[down_arrow].
To move up a screen line type: gk, or g[up_arrow].
To goto a specified line type: num G.
To goto a percentage of the document type: num %.
There are many more...


To scroll the screen down type: Ctrl-E.
To scroll the screen up type: Ctrl-Y.

This is enough to get you started with Vim. This is, however, not even the tip of the iceberg. Vim includes a complete scripting language and is highly configurable. You can work with multiple files, make command line commands, incorporate other programs, and much more.

Search for text in vi or vim

Very useful for a guy with little vim knowledge

Description
vi and vim have powerful searching capabilities because they bring to bear the richness of regular expressions.


Directions
To search for the next occurence of the text 'maybe' from the current cursor position, type:


/maybe<ENTER>


Search backward from the current position by using ? instead of / in the command.

Once you have searched for something, you can find the next occurrence by pressing n or the previous occurrence with N.

Searching in vi/vim is enhanced with regular expressions. For example, to find the next occurence of the text 'Total' that occurs at the beginning of a line, use:


/^Total

Saturday, December 04, 2004

Setting up java tomcat on linux VI - Configure APACHE SSL

Configure Apache/SSL

mkdir /usr/local/htdocs/secure
mkdir /usr/local/htdocs/secure/myhost.mydomain
#Now make changes in ssl.conf
#Look for similar lines and make sure it looks like this:

# General setup for the virtual host
DocumentRoot '/usr/local/htdocs/secure/myhost'
ServerName myhost.mydomain:443
ServerAdmin me@myhost.mydomain
ErrorLog logs/error_log
TransferLog logs/access_log

#Redirect / https://myhost.mydomain/mywebapp

# Static files
Alias /mywebapp "/usr/local/tomcat/webapps/mywebapp"



Options Indexes FollowSymLinks
DirectoryIndex index.jsp


# Deny direct access to WEB-INF and META-INF

AllowOverride None
deny from all



AllowOverride None
deny from all


JkMount /mywebapp/*.do ajp13
JkMount /mywebapp/*.jsp ajp13

JkMount /mywebapp ajp13
JkMount /mywebapp/* ajp13

Thursday, December 02, 2004

Setting up java tomcat on linux V - Configure APACHE non-ssl

Configure APACHE/NON-SSL

  • md /www
  • md /www/hosts
  • md /www/hosts/nonsecure
  • md /www/hosts/nonsecure/www.mydomain.com
  • md /www/hosts/nonsecure/www.mydomain.com/docs
  • md /www/hosts/cgi-bin
  • md /www/hosts/cgi-bin/www.mydomain.com
  • md /www/hosts/cgi-bin/www.mydomain.com/cgi-bin

#Make sure you have VirtualHost like this

NameVirtualHost 192.168.2.101


<VirtualHost *:80>
ServerName www.mydomain.com
ServerAdmin webmaster@www.mydomain.com
DocumentRoot /www/hosts/nonsecure/www.mydomain.com/docs
ErrorLog logs/www.mydomain.com_public-err_log
CustomLog logs/www.mydomain.com_public-access_log common
ScriptAlias /cgi-bin/ /www/hosts/cgi-bin/www.mydomain.com/cgi-bin


# Static files
Alias /mywebapp "/usr/local/tomcat/webapps/mywebapp" <


Directory "/usr/local/tomcat/webapps/mywebapp">
Options Indexes FollowSymLinks
DirectoryIndex index.jsp
</Directory>


#Deny direct access to WEB-INF and META-INF
<Location "/mywebapp/WEB-INF/*">
Allowoverride None
deny from all
</Location>


<Location "/mywebpp/META-iNF/*">
AllowOverride None
deny from all
</Location>

JkMount /mywebapp_nonsecure/*.do ajp13
JkMount /mywebapp_nonsecure/*.jsp ajp13
JkMount /mywebapp_nonsecure ajp13
JkMount /mywebapp_nonsecure/* ajp13
</VirtualHost>

JkWorkersFile "/usr/local/tomcat/conf/jk/workers.properties"
JkLogFile "/usr/local/tomcat/logs/mod_jk.log"

Wednesday, December 01, 2004

Setting up java tomcat on linux IV - Install APACHE

Install APACHE

  • cd /usr/local/src
  • tar xfz httpd-2.0.52.tar.gz
  • cd httpd-2.0.52
  • ./configure --prefix=/usr/local/apache2 --enable-so --enable-rewrite --enable-ssl --with-ssl=/usr/local/ssl --enable-proxy
  • make
  • make install (supposed to places in /usr/local/apache2, but make install placed it into /usr/locacl/apache2, see if this causes any problems later)


Build/Install MOD_JK Connector

  • cd /usr/local/src
  • unzip jakarta-tomcat-connectors-jk-1.2-src-current.zip
  • cd jakarta-tomcat-connectors-jk-1.2.6-src/jk/native
  • ./buildconf.sh
  • ./configure --with-apxs=/usr/locacl/apache2/bin/apxs
  • make
  • cp apache-2.0/mod_jk.so /usr/local/apache2/modules


Configure Apache for mod_jk

Put these lines in /usr/locacl/apache2/conf/http.conf just before NameVirtualHost

<IfModule !mod_jk.c>

LoadModule jk_module modules/mod_jk.so

</IfModule>