Saturday, January 8, 2011

Install Oracle instant client


FROM : http://lucasepe.blogspot.com/2010_05_01_archive.html






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