Saturday, January 8, 2011

Install Oracle instant client

FROM : http://shaanob.blogspot.com/2010/06/openbravo-erp-250-customized.html


Openbravo ERP 2.50 customized installation in Ubuntu






hi all, i ve already put up a post on Openbravo ERP installation using
the default repository method provided by Openbravo. But in some cases v
need, to custom install those open source technologies like tomcat,
ant, java etc to suit our needs. So i have presented a simple set of
steps required to sun Openbravo in UBUNTU. (disclaimer:even this
information is provided in openbravo wiki but in lot more elaborated
form...:))



Openbravo complete installation in UBUNTU 9.10



Environment:


A. postgres 8.4



B. java 6



C. tomcat 6



D. Apache ant (build tasks)



E. openbravo source (2.5MP9)







A. Postgres:


1. Installing postgres:



sudo apt-get install postgresql-8.4 postgresql-contrib-8.4



2. Setting username



sudo -u postgres psql



alter role postgres with password 'postgres';



\q







B. Java:


1. Run the following steps



sudo apt-get install sun-java6-jdk



sudo update-java-alternatives -s java-6-sun



echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun"' | sudo tee -a /etc/environment



source /etc/environment







C. Tomcat 6


1. sudo apt-get install tomcat6 tomcat6-admin



sudo rm /var/log/tomcat6/catalina.out (This may show some error. dont worry, its normal in some ubuntu machines)



sudo /etc/init.d/tomcat6 start







2. Check that Tomcat is running by opening http://localhost:8180 in a



web browser.







3.echo 'CATALINA_HOME="/usr/share/tomcat6"' | sudo tee -a /etc/environment



echo 'CATALINA_BASE="/var/lib/tomcat6"' | sudo tee -a /etc/environment







4. Edit the /etc/default/tomcat6 file, and set the following line:-



JAVA_OPTS="-Djava.awt.headless=true -Xms384M -Xmx512M -XX:MaxPermSize=256M"







5. source /etc/environment







6. Adding tools.jar to the library's classpath



cp $JAVA_HOME/lib/tools.jar /var/lib/tomcat6/lib/



cp $JAVA_HOME/lib/tools.jar /usr/share/tomcat6/lib/







7. In order to avoid Tomcat from auto-reloading itself, comment the WatchedResource line in conf/context.xml:











8. Configure a username and password for the Tomcat Manager, by
replacing the /etc/tomcat6/tomcat-users.xml file with these contents,
replacing password="admin" with your chosen password:





9. Starting with 2.50, the modularity feature required the tomcat user
to write in the main Openbravo ERP directory. So achieve this, edit the
/etc/init.d/tomcat6 file, search for umask 022 and replace it with umask
002. Then restart Tomcat. 



10. Username and password :

          
Go to conf folder in tomcat diractory and change the tomcat-users.xml
file. there the template will be there. use that and create a role
admin,admin with manager and admin role. 

        i.e copy this :)

         

        

        

        

         






D. Apache Ant:



sudo apt-get install ant ant-optional



echo 'ANT_HOME="/usr/share/ant"' | sudo tee -a /etc/environment



echo 'ANT_OPTS="-Xmx1024M"' | sudo tee -a /etc/environment



echo 'ANT_OPTS="-Xmx1024M -XX:MaxPermSize=128M"' | sudo tee -a /etc/environment (for 64bit operating systems)



source /etc/environment



Note: # To make the variables available system wide, restart the user session. 







E. Openbravo (2.50)
             The latest version of the Openbravo  source file can be obtained from the following link,

          http://sourceforge.net/projects/openbravo/files/

  

         after obtaining the source folder go the config folder
and create the following files. The templates will be already provided.
just copy paste them and remove the .template suffix from them. The
files are

         
1. log4j.properties (eg. the file would be log4j.properties.template.
copy-paste and then rename it as log4j.properties)

          2. Openbravo.properties

          3. Format.xml 

          4. .classpath (this will be in the source folder itself) 





          now in the Openbravo.properties you have the modify the following things.

         1. give the folder path in attach.path,source.path. 

         2. give context name (the name of the tomcat executable) in context field

         3. for postgres,

             bbid.sid=(name of the database,you can specify anyname)

             bbid.systemPassword=postgres (because v have set it up as postgres       before)

        4.  tomcat.manager.password=admin

        

              then give these three steps in the terminal after going into the folder

               ant install.source
               ant compile.complete
               and deploy.context

             

               Openbravo will be available in applications in manager link in tomcat now.

        









--------- Additional Operating system permissions for Tomcat ---------







1. Change the default file permissions for the user running the Ant
tasks, e.g. openbravo. Assuming you are using Bash as your shell, append
the following line to the /home/openbravo/.bashrc file:



umask 002



2. Add openbravo to the tomcat group:



gpasswd -a openbravo tomcat



3. Add tomcat to the openbravo group:



gpasswd -a tomcat openbravo







Compiling and Installing Tora (with Oracle) on Ubuntu 10.04




Step 1:

Install Oracle instant client



Get the packages from the Oracle site. I am using:

  • instantclient-basic-linux32-11.1.0.7.zip

  • instantclient-sqlplus-linux32-11.1.0.7.zip

  • instantclient-sdk-linux32-11.1.0.7.zip


Each compressed tarball needs to be extracted to the exact same location.
Uncompress and untar each file from the same location in order to achieve this result.
If placing into a system area such as /opt or /usr/local, make sure to have the correct permissions for writing to these filesystems and/or directories.

After
packages are untarred to there installation location a link needs to be
made inside the instantclient_11_1 directory. If you are using a
different version of the instant client simply adjust the link per the
version of libclntsh.so.

cd [your installation path]/instantclient_11_1
ln -s libclntsh.so.x.x libclntsh.so

Step 2: Set environment variables


It is necessary to set environment variables ORACLE_HOME, LD_LIBRARY_PATH and TNS_ADMIN inside $HOME/.profile in order to build correctly.

export ORACLE_HOME=[your installation path]/instantclient_11_1
export TNS_ADMIN=$ORACLE_HOME
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

Step 3: Get the tora source code


Find a build location in your filesystem, cd to there and then get the tora source deb package.

cd ~
mkdir -p sources/tora
cd sources/tora
apt-get source tora

Step 4: Check the build dependencies


Next install the build dependencies via apt. To do this, run the following command:

sudo apt-get build-dep tora

Probably you will get a very long list; let apt to download and install all of them.

Step 5: Build and install tora


Now the critical moment! We'll compile tora.
In your build path you’ll see a tora-2.1.1 directory. Change to this:

cd ~/source/tora/tora-2.1.1

and launch the configure script:
./configure
--prefix=/usr/ --with-oracle=$ORACLE_HOME
--with-instant-client=$ORACLE_HOME
--with-oracle-includes=$ORACLE_HOME/sdk/include
--with-oracle-libraries=$ORACLE_HOME --with-oci-version=11G

If you have some error check build dependencies (step 4). Finally:

make
sudo make install

You will find your executable in /usr/bin/tora go to menu System->Preferences->Main menu and create an item in Application->Programming menu.

Enjoy!






Sunday, May 2, 2010





Installing Python cx_Oracle module on Ubuntu 10.04




Step 1: Install Prerequisite Software


You will need to have the following packages installed to get Oracle Instant Client and cx_Oracle installed:

* build-essential
* unzip
* python-dev
* libaio-dev

so go in a terminal and type:


sudo apt-get install build-essential unzip python-dev libaio-dev



Step 2: Download and unzip Oracle's instantclient archives


These hints are based on using Oracle's instantclient_11_1.
It is necessary to download both instantclient-linux-basic and instantclient-sdk-linux from oracle.com in order to successfully compile.

Each compressed tarball needs to be extracted to the exact same location.
Uncompress and untar each file from the same location in order to achieve this
result.

After both packages are untarred to there installation location a link needs
to be made inside the instantclient_11_1 directory


cd $ORACLE_HOME
ln -s libclntsh.so.x.x libclntsh.so



Step 3: Set environment variables


It is necessary to set environment variables ORACLE_HOME and LD_LIBRARY_PATH inside $HOME/.profile in order for cx_Oracle to import properly after installation and in order to build correctly.

Example ($HOME/.profile):

export ORACLE_HOME=[your installation path]/instantclient_11_1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME

Hint:

If after modifying your $HOME/.profile the system cannot found $ORACLE_HOME add this variables in /etc/environment then log off and log in again to force the environment reload.


Step 4: Update ldconfig


Add the instantclient path ([your installation path]/instantclient_11_1) to ldconfig:
sudo gedit /etc/ld.so.conf.d/oracle.conf

then iussue an
ldconfig


Step 5: Download and build cx_Oracle


Download cx_Oracle at http://cx-oracle.sourceforge.net and unzip wherever you want, then...


cd [your cx_Oracle installation path]
python setup.py build
python setup.py install


Make a quick check:


luca@ubuntu:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
>>> print cx_Oracle.version
5.0.3




In case of troubles


If you get this message during the quick check step:


luca@ubuntu:~$ python
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cx_Oracle
Traceback (most recent call last):
File "", line 1, in
ImportError: libclntsh.so.11.1: cannot open shared object file: No such file or directory


You forgot to add the instantclient path in ldconfig; adding it will fix this problem.









Install of Tomcat on Ubuntu




Step One


Locating Java and Tomcat home(s):


luca@ubuntu:~$ find / -name java -type f 2> /dev/null
/usr/lib/jvm/java-6-sun-1.6.0.20/jre/bin/java

luca@ubuntu:~$ find / -name catalina.sh -type f 2> /dev/null
/usr/share/tomcat6/bin/catalina.sh



Step Two


Modify your /etc/environment file


luca@ubuntu:~$ sudo gedit /etc/environment



adding...



#.Setting JAVA_HOME
if [ -d /usr/lib/jvm/java-6-sun-1.6.0.20 ]; then
export JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20
export CLASSPATH=.:$JAVA_HOME/lib
fi

#.Setting CATALINA_HOME
if [ -d /usr/share/tomcat6 ]; then
export CATALINA_HOME=/usr/share/tomcat6
fi



Step Three


Log off then log in to force the reload of the file.

Make a simple check:



luca@ubuntu:~$ env | grep CATALINA_HOME
CATALINA_HOME=/usr/share/tomcat6

luca@ubuntu:~$ env | grep JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.20
CLASSPATH=.:$JAVA_HOME/lib




That's all! Enjoy!









How To Install Flash Player In Ubuntu 10.04 Lucid Lynx




Open a terminal and write:


sudo apt-get install flashplugin-nonfree flashplugin-installer


That's all









Install Sun's Java 6 JDK on Ubuntu 10.04




Sun's Java 6 JDK is now available through the partners repository.

To get it installed use the following steps...

  1. sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"

  2. sudo aptitude update

  3. sudo aptitude install sun-java6-jdk sun-java6-plugin











Eclipse plugin Subversion with JavaHl under Ubuntu




While installing the subversion plugin Subclipse in the Eclipse IDE I came across a problem.

Subclipse uses "JavaHL (JNI)" to interface with subversion by default.
This default setting generates an error when accessing the "Window->Preferences->Team->SVN" preferences:

Failed to load JavaHL Library.
These are the errors that were encountered:
no libsvnjavahl-1 in java.library.path
no svnjavahl-1 in java.library.path
no svnjavahl in java.library.path
.....


Now I'll FIX this problem for you! in just two moves ;)

Step One


Install JavaHL:

sudo apt-get install libsvn-java


Step Two


Modify eclipse.ini:


-showsplash
org.eclipse.platform
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Djava.library.path=/usr/lib/jni
-Xms40m
-Xmx512m
-XX:MaxPermSize=400m


Where -Djava.library.path=/usr/lib/jni does the magic.
The /usr/lib/jni ougth contain:

libsvnjavahl-1.so libsvnjavahl-1.so.0 libsvnjavahl-1.so.0.0.0


This works for me under Eclipse 3.5.2









Flushing Memcached servers




Assuming a memcached running on the local machine on the default port (11211):

echo "flush_all" | nc localhost 11211