Installing OAR (almost) without pain
====================================

There are currently 3 methods to install OAR.

* with debian packages
* with rpm packages
* with the sources

The first thing you have to know is about the OAR architecture.

A common OAR installation is composed of: 

* the OAR server
* the DataBase server
* the job submission frontale
* several machines that are computing nodes


To ease the first installation, you might consider using the same machine for 
the OAR server, the DataBase, the frontale and to create some virtual resources
too on the machine. This might be done by using 127.0.*.* IP addresses for
your resources.

Otherwise, you will have to copy the oar user keys on each machine to allow 
passwordless connections between them for the user oar.


I) Installation
---------------


Installation from debian packages
_________________________________

If you want to install oar from the debian packages, you will have to install the 
oar-server package on the OAR server, the oar-user package on the submission frontale
and the oar-node package on the computing nodes.

* add to your apt.conf file the line given in http://oar.imag.fr/downloads.html depending on which release you want to install.
* install the oar-* packages on the different machines like explained above.
* install postgresql or mysql-server depending which database you want to use.
* add::
  
    environment="OAR_KEY=1"
 
 at the beginning of the public key in the 
 **~oar/.ssh/authorized_keys** file.


Installation from rpm packages
______________________________

To complete...



Installation from the sources
_____________________________

Prerequisites: Install the libs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

First of all you have to install the following packages:

* Perl
* Perl-base
* openssh (server and client) version >= 3.9
* Perl-Mysql
* Perl-DBI
* MySQL
* libmysql
* perl-suid

You also have to install a >= 2.6 kernel in order to use cpuset feature.

1°) Pave the way for install
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* add a user named "oar" in the group "oar"
* create a set of ssh keys for the user "oar" with ssh-keygen 
  (for instance 'id_dsa.pub' and 'id_dsa')
* copy these keys in the ".ssh" folder of the user "oar"
* append the contents of 'id_dsa.pub' to the file **~oar/.ssh/authorized_keys**
* in **~/.ssh/config** (create the file if it doesn't exists) add the lines::

    Host *
        ForwardX11 no
        StrictHostKeyChecking no
        PasswordAuthentication no
        AddressFamily inet

* add in your ssh server config file::

    AcceptEnv OAR_CPUSET OAR_JOB_USER
    PermitUserEnvironment yes
    UseLogin no
    AllowUsers oar

* add::
  
    environment="OAR_KEY=1"
 
 at the beginning of the public key in the 
 **~oar/.ssh/authorized_keys** file.
  
* add in your **~oar/.bashrc** file::

    export PATH=/usr/local/oar/oardodo:$PATH
    
2°) Install the OAR modules
~~~~~~~~~~~~~~~~~~~~~~~~~~~

Just go into the OAR source directory and as root type::

  make server-install user-install node-install


3°) Launch the OAR server
~~~~~~~~~~~~~~~~~~~~~~~~~

Finally, you will have to launch as oar the **Almighty** daemon (the oar server).



II) Initiate the database
-------------------------

As root run oar_mysql_db_init or oar_psql_db_init depending your DataBase type.


III) Configuration file
-----------------------

This part is optionnal for now. You can come back to it later.

To configure your oar server, edit its config file
**/etc/oar/oar.conf**. Take a look at the different sections and customize it if you want to.


IV) Cpusets
-----------

This part is optionnal too right now if you're installing OAR for the first time.
It is easier to begin using OAR without this feature.
Once everything's ok and your jobs are running on your resources, you can activate 
this feature.

The cpuset feature will allow OAR to restrict the use of one (or a group) of cpu
for a job. Each computing resource has a **cpuset** field that will refer to
the cpu id that will run the job for this resource.

In order to use this feature, you have to uncomment the line with the 
**JOB_RESOURCE_MANAGER_PROPERTY_DB_FIELD** field in your oar.conf file.
Then, for each computing resource in your database, set the cpuset field to the 
cpu id you want your resource to be restricted on.



V) Adding resources to the system
---------------------------------

To add resources to your system, you can use (as root) the command oarnodesetting.
For a complete comprehension of what does this command, type man oarnodesetting.

For now, the two options you will need will be **-a** (means add a resource) and 
**-h** (defines the resource hostname or ip adress).

For example, to add a computing resource locally to test OAR installation type::

	oarnodesetting -a -h 127.0.10.1

This will add a resource with 127.0.10.1 as host IP address.


You also can modify resources properties with **-p** option, for example::

	oarnodesetting -r 1 -p "deploy=YES"

will allow the resource #1 to accept jobs of the type deploy.
	