\documentclass{howto}
\usepackage{hyperref}

\title{Installing ROVM}
\author{Weongyo Jeong}
\authoraddress{
  \strong{Autralia Melbourne}\\
  email : \email{weongyo@gmail.org}
}
\date{2006.3.20}

\begin{document}
\maketitle

\begin{abstract}
  \noindent
  This document describes how to install ROVM packages which consists
  of ROVM Server, ROVM Client, ROVM Interface, ROVM Compiler, ROVM
  Library. ROVM is short for Remote Object Virtual Machine.
\end{abstract}

\tableofcontents

\section{Homepage}
\label{sec:homepage}

ROVM project is a part of `envlang' project.  Currently, The homepage
of ROVM located at KLDP.net (http://kldp.net).  The address of
homepage is like below.
\begin{itemize}
\item[] \url{http://envlang.kldp.net}
\end{itemize}
Thanks KLDP\footnote{\url{http://kldp.org}} for supplying the space to us.

\section{Before installation}
\label{sec:beforeinstall}

\subsection{The condition of usage}
\label{sec:usagecond}

If you use ROVM on your system, It means that you agree the conditions
like below.

\begin{itemize}
\item As ROVM Server is server application, Always ROVM Server open a
  network port for listening.  If there are some vulnerabilities on
  ROVM Server, a cracker can execute arbitrary commands on your system as
  a privilege which ROVM Server runs as.  We don't take the
  responsibility for these accidents which be damaged caused by these
  penetration. 
\item We don't take the responsibility for other misuses of
  ROVM-related application.
\end{itemize}

\subsection{Official supported environment}
\label{sec:supportarch}

At now, ROVM packages consist of 5 packages.  The description of these
packages are like below.

\begin{itemize}
\item ROVM Server \\
  It's a server application that it runs all of ROVM programs.
\item ROVM Library \\
  It's a library which consist of core classes.  It's ok whether you
  install this package or not.  But you can only use some few functions.
\item ROVM Client \\
  It's a application to communicate with/debug/test ROVM Server.
\item ROVM Interface \\
  You can just think ROVM Interface as C version of ROVM Client.
  It's not for debugging.
\item ROVM Compiler \\
  It's very simple application for ROVM Sever to make a binary file
  which follow the standard ``ENVLANG File Format''.
\end{itemize}

In cases of ROVM Server, ROVM Library and ROVM Interface, These
supports environment now like below.

\begin{itemize}
\item Linux (i386)
\end{itemize}

At other environments except upper cases, we don't guarantee.

In cases of ROVM Client and ROVM Compiler, It can be executed on any systems which
supports python because it made by python.  It tested some enviroment
like below.

\begin{itemize}
\item Windows 2003 (i386)
\end{itemize}

\section{ROVM Server Installation}

If you don't want to install ROVM Server, just skip this section.

ROVM Server always opens a network port (default port is 4390) for
listening.  If there are some vulnerabilities on ROVM Server, a
cracker can execute some arbitrary commands on your system as
a privilege which ROVM Server runs.  You need keep the latest version
of ROVM server if you want to avoid it.

\subsection{Installing OpenSSL}
\label{sec:opensslinst}

After ROVM Server v0.1.35a, All communications between ROVM Server and
ROVM Client use encrypted packets.  So you must install OpenSSL
before install ROVM Server.

You can download a latest version of OpenSSL at
\url{http://www.openssl.org}

\begin{verbatim}
$ tar xvvzf openssl-0.9.8a.tar.gz
$ cd openssl-0.9.8a
$ ./configure
$ make
$ make install
$
\end{verbatim}

At below, we assume that the path of OpenSSL is \texttt{/usr/local/ssl}.

\subsection{Download Server}
\label{sec:serverdownload}

We recommends keeping the latest version of ROVM Server to you.  You
can find the latest version at below site.

\begin{verbatim}
http://kldp.net/frs/?group_id=700
\end{verbatim}

Download ROVM Server file at temporary directory. 

\begin{verbatim}
$ mkdir tmp
$ cd tmp
$ wget http://kldp.net/frs/download.php/3160/rovm-latest.tar.bz2
$ tar xvvjf rovm-latest.tar.bz2
$ cd rovm
\end{verbatim}

\subsection{`configure' and `make'}
\label{sec:serverconfigure}

Now you need execute \texttt{./configure} command.  If you are ROVM
developer, we recommend adding CFLAGS to you for more easier
debugging.  You don't input any options, then default options would be
used.

\begin{verbatim}
$ CFLAGS='-g -O0' ./configure
\end{verbatim}

If you are not ROVM developer, just types like below.
\begin{verbatim}
$ ./configure
$
\end{verbatim}

If you installed OpenSSL at different directory, you should set
\texttt{--with-ssl} option.
\begin{verbatim}
$ ./configure --with-ssl=/usr/local/ssl2
\end{verbatim}

Let builds ROVM Server as typing `\texttt{make}'

\begin{verbatim}
$ make
\end{verbatim}

%\paragraph{Configuration of ROVM Server}

%At now, ROVM Server don't have a function to configure Server using
%the configuratio file.  So you need to modify Server source by your
%hand.

%The all configuration of ROVM Server can be set up at
%\texttt{init_rovm_config ()} function of \texttt{\$prefix/src/rovm.c} file.

%You can configure various server settings.
%\begin{itemize}
%\item CONF_PORT \\
%  The default listening port of ROVM Server.
%\item CONF_THREADS_PER_CHILD \\
%  The number of worker threads. When ROVM Server started, Server make
%  a listening thread and some worker threads.  This value used for how
%  many worker thread should be made.
%\item CONF_LOGLEVEL \\
%  The log level.  If ROVM Server faced some log messages, this value
%  determine how ROVM Server acts.  If you want to see some detailed
%  infomation of Logging, You need to see \texttt{\$prefix/src/log.h} file.
%\item CONF_CLASSROOT \\
%  The Class Root path.  If you can't understand the concept of ``Class
%  Root'', You can find many infomation at \ref{sec:serverclassroot} section.
%\end{itemize}

%\subsection{Configure ``Class Root''}
%\label{sec:serverclassroot}

%\emph{(If you don't configure ``Class Root'' correctly, you can't
%  execute `new', `newarray' and 'call' opcodes.  But there are no
%  problems to run Server.)}

%At this section, we will mention about ``Class Root''

%The concept of ``Class Root'' added when ROVM Server added `NEW'
%opcode.  If we explain the concept, we can explain like below.
%\begin{itemize}
%\item If you have some experiences about configuring Apache Web
%  Server, you can imagine \texttt{DocumentRoot} which be a part of
%  \texttt{httpd.conf} file.  In Apache, every documents are placed
%  under that directory.  In the same way, every classes used ROVM
%  Server are placed under ``Class Root'' directory.
%\item If you are familiar with Java, you can also imagine CLASSPATH
%  environment variable.  ``Class Root'' can only set one diectory
%  up, but CLASSPATH can configure various directories in their value, 
%\end{itemize}

%Let see how ``Class Root'' acts.

%We assume that the value of ``Class Root'' of ROVM Server is set as 
%``\texttt{/tmp/classroot}'' and a user send a command like below.
%\begin{verbatim}
%... new e://192.168.58.129:4390/ABCDEF
%\end{verbatim}

%If this case happens, ROVM Server should find the path of
%``\texttt{/ABCDEF}'' and ``Class Root'' value is used at this time.

%ROVM Server combine ``\texttt{/ABCDEF}'' value with ``Class
%Root'' value and try to find the result file path,
%``\texttt{/tmp/classroot/ABCDEF.e}'', on file system.  (The suffix
%value, ``.e'' is a extention of standard ROVM class file.)
%
\subsection{Installing ROVM Server}
\label{sec:serverinst}

We finished building ROVM Server.  If you succeed in building, you can
see \texttt{src/rovm} file.

\begin{verbatim}
$ ls -l src/rovm
-rwxr-xr-x  1 weongyo weongyo 1786531 2006-01-30 08:21 src/rovm
\end{verbatim}

If you install it on your system, just type like below

\begin{verbatim}
$ make install
$
\end{verbatim}

If you had been set the \texttt{prefix}, it will be installed
at the \texttt{prefix}, If you didn't, it will be installed at default
directory, `\texttt{/usr/local/rovm}'

If you want to use ROVM Library, we recommend that you configure your
``Class Root'' value correctly before you install ROVM Library.

\subsection{Configuring ROVM Server}
\label{sec:serverconf}

There is a ``Configuring ROVM Server'' document which describe how you
can set ROVM Server up.  See the document.

\subsection{Executing ROVM Server}
\label{sec:serverexec}

Let execute ROVM Server.  If you did not install ROVM Library yet.
Install it first.

When you run ROVM Server, it will ask the password of the
certificate.  If you use a default certificate which be delivered ROVM
Server package, your default password is ``rovmserver''.  (If you want
to use your own certificate, see the ``Configuring ROVM Server'' document.

\begin{verbatim}
$ cd /usr/local/rovm
$ bin/rovm
ROVM Server mod_ssl/0.1.35a (Pass Phrase Dialog)
Some of your private key files are encrypted for security reasons.
In order to read them you have to provide the pass phrases.

Server localhost:4390 (RSA)
Enter pass phrase:
\end{verbatim}

\textbf{!Warning!} Always ROVM Server open a network port for
listening, we recommend that you use a account which have very low
privilege like `\texttt{nobody}'

\section{ROVM Library Installation}
\label{sec:library}

\emph{(If you want to load the class or extension module on ROVM Server, You
  should install this package first.  If you don't want to do it, just
  skip it.)}

In this section, we mention how to install core library on ROVM
Server.

%Currently, the directory trees of ROVM Library are like below.

%\begin{itemize}
%\item \texttt{core} (directory)
%  \begin{itemize}
%  \item \texttt{array} (class) \\
%    A class to support array type.
%  \item \texttt{str} (class) \\
%    a class to support string type.  This clsss includes various
%    methods like str.tolower () or str.rstrip () or etc.
%  \end{itemize}
%\end{itemize}

You can download the latest version at our homepage.

\begin{verbatim}
$ cd /tmp
$ wget http://kldp.net/frs/download.php/3185/rovmlib-0.0.1a.tar.gz
$ tar xvvzf rovmlib-0.0.1a.tar.gz
$ cd rovmlib-0.0.1a
\end{verbatim}

To install ROVM Library, you should install ROVM Server first because
ROVM Library depends on some header files and libraries of ROVM
Server which be used to compile the extension module.

\begin{itemize}
\item \texttt{el.h} \\
  A extension module must include \texttt{el.h} file in their body because el.h
  file include every prototypes and structures which needs to make the
  extension module.
\item \texttt{libel.so} \\
  A shared library which have real-code functions.
\end{itemize}

When you execute \texttt{configure} command, you must pass the
location of ROVM Server using \texttt{--with-rovm} option.  If you
installed ROVM Server at \texttt{/usr/local/rovm}, input like below.

\begin{verbatim}
$ ./configure --prefix=/usr/local/rovm/classroot --with-rovm=/usr/local/rovm
\end{verbatim}

And \texttt{--prefix} value must same with ``Class Root'' value of
ROVM Server.  If it isn't same, some errors would be occured during
ROVM Server runs. 

Let compile and install library.

\begin{verbatim}
$ make
$ make install
\end{verbatim}

If you meet below warning messages during you install ROVM Library,
just skip it.

\begin{verbatim}
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/local/rovm/classroot/core

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
\end{verbatim}

\section{ROVM Client Installation}
\label{sec:client}

In this section, we mention how to install ROVM Client which be used
for communicating with ROVM Server.

\subsection{Requisites}
\label{sec:clientreq}

In case of ROVM Client, there are some requisites to work properly.
Below packages must be installed on your system.

\begin{itemize}
\item Upper version of Python 2.2
\end{itemize}

\subsection{Downloading Client}
\label{sec:clientdown}

You can download the latest version of ROVM Client at below site, in
the same way as ROVM Server.

\begin{verbatim}
http://kldp.net/frs/?group_id=700
\end{verbatim}

Download the file and extracts all files at temporary directory.

\begin{verbatim}
$ mkdir tmp
$ cd tmp
$ wget http://kldp.net/frs/download.php/3159/rovmclient-0.0.1a.zip
$ unzip rovmclient-0.0.1a.zip
$ cd rovmclient
\end{verbatim}

\subsection{Executing}
\label{sec:clientexec}

You must install the upper version of python 2.2 on your system
because ROVM Client's code is based on python.

\begin{verbatim}
$ python rovmclient.py
\end{verbatim}

If you can see `\texttt{>>>}' prompt on your screen, it may works well.

\section{ROVM Interface Installation}
\label{sec:rovminterface}

In this section, we mention how to install ROVM Interface on your
system which communicates with ROVM Server.

\subsection{Before installation}
\label{sec:rovminterfacebefore}

\emph{If you want to make a application which communicates with ROVM
  Server, you need to install it, But you don't want to do it, just
  skip this section.}

This package just supports few OSs.  There are no
guarantee working well on other system except below OS.

\begin{itemize}
\item ix86 (Linux)
\end{itemize}

\subsection{Installing OpenSSL}
\label{sec:opensslinst}

After ROVM Server v0.1.35a, All communications between ROVM Server and
ROVM Client use encrypted packets.  If you want to communicate ROVM
Server whose version is upper v0.1.35a, you must install OpenSSL
before install ROVM Interface.

You can download a latest version of OpenSSL at
\url{http://www.openssl.org}

\begin{verbatim}
$ tar xvvzf openssl-0.9.8a.tar.gz
$ cd openssl-0.9.8a
$ ./configure
$ make
$ make install
$
\end{verbatim}

At below, we assume that the path of OpenSSL is \texttt{/usr/local/ssl}.

\subsection{Downloading the package}
\label{sec:interfacedownload}

\begin{verbatim}
$ mkdir tmp
$ cd tmp
$ wget http://kldp.net/frs/download.php/3172/rovminterface-latest.tar.bz2
$ tar xvvjf rovminterface-latest.tar.bz2
$ cd rovminterface
\end{verbatim}

\subsection{Compile and Install}
\label{sec:interfacecompileinstall}

The process of installation is same with other package's installation.

\begin{verbatim}
$ ./configure --prefix=/home/weongyo/rovminterface
$ make
$ make install
\end{verbatim}

If you want to install ROVM Interface at another direcotry, you need to
set \texttt{--prefix} value because the default installation path is
\texttt{/usr/local}.

If you installed OpenSSL at different directory, you should set
\texttt{--with-ssl} option.

\section{ROVM Compiler Installation}
\label{sec:rovmcompiler}

In this section, we mention how to install ROVM Compiler which helps
us to make ``ENVLANG File Format''.  You don't need to install it,
just skip this section.

If you need some information about ``ENVLANG File Format'', you can
find documents at homepage.

\subsection{Before installation}
\label{sec:rovmcompilerbefore}

ROVM Compiler is very simple compiler and very dirty.  It just made
for file format testing.

So, we don't want to support it.

\subsection{Requisites}
\label{sec:compilerreq}

In case of ROVM Compiler, there are some requisites to work properly.
Below packages must be installed on your system.

\begin{itemize}
\item Upper version of Python 2.2
\end{itemize}

\subsection{Downloading Compiler}
\label{sec:compilerdown}

You can download the latest version of ROVM Compiler at our homepage.

\begin{verbatim}
http://kldp.net/frs/?group_id=700
\end{verbatim}

Download ROVM Compiler and extracts all file at temporary directory.

\begin{verbatim}
$ mkdir tmp
$ cd tmp
$ wget http://kldp.net/frs/download.php/3172/rovmcompiler-0.0.1a.tar.bz2
$ tar xvvjf rovmcompiler-0.0.1a.tar.bz2
$ cd rovmcompiler
\end{verbatim}

\subsection{Compile}
\label{sec:compilercompile}

You must install the upper version of python on your system because
ROVM Compiler is based on python.

Normally when you execute it, the following messages are printed.
\begin{verbatim}
$ python rovmcompiler.py
rovmcompiler.py: no input files.
\end{verbatim}

If you want to compile something, there are some examples at `tests'
directory.

\begin{verbatim}
.package test

.class ABCDEF
    .def __init__ (S)V
        nop
    .defend

    .def abc (SII)I
        iload 1
        iload 2
        iadd
        ireturn
    .defend
.classend
\end{verbatim}

If you want to compile it, run like below.

\begin{verbatim}
$ python rovmcompiler.py tests/1.rovms
\end{verbatim}

\end{document}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: t
%%% End: 
