Posts Tagged configure

PORTING KANNEL TO HP UX

(Tested with version 11.11)

Before we begin, it would be useful to have the backspace key on hand so do:
#stty erase [BACKSPACE KEY]
or just install bash.

1. Before compiling kannel, we first need to put the HP UX application layer on steroids. So, download libxml2, gcc-4.1.1, libiconv, gettext, bison, flex etc and all the related dependencies from the following link:
http://hpux.connect.org.uk/

Note: When installing hp depot files, ensure you type in the whole path to the depot, or else it will complain about not being able to see the package. For example to install gcc, assuming the depot file was in /opt, you would type this:

#cd opt
#gunzip gcc-4.1.1-hppa-11.11.depot.gz
#swinstall -s /opt/gcc-4.1.1-hppa-11.11.depot gcc

Do an swinstall for all the other related packages. You can check for the related dependencies by referring to the hpux.connect.org.uk porting and archiving center site listed dependencies for each package.

2. Inside your /etc/profile file, add the following lines (SHLIB_PATH is used in 32-bit machines while LD_LIBRARY_PATH is used in 64-bit HP machines; just put both in to be sure)


export LD_LIBRARY_PATH=/usr/local/lib:/lib:/usr/lib:/opt/gnome/lib/
export SHLIB_PATH=/usr/local/lib:/lib:/usr/lib:/opt/gnome/lib/

Now do:
#env

and ensure the variables above are set. If not, you can run them manually for now. However, since you have put these variables inside the /etc/profile file, the next time you login they will be automatically set in the environment.

3. Once you are through, installing gcc and all the related dependencies, download kannel and follow the steps below (The version we used was: gateway-1.4.1):
(Please ensure that inside the configure file, the CC variable refered to is gcc and not the HP UX cc, or else your configure will fail!)

(We are configuring kannel with minimal options in this case. You may also wish to add database support eg for MySQL)

#./configure --with-malloc=native --enable-sdb

4. Configure will complete successfully. However, before running the gmake (Please do not run make as this will use HP make and your compilation of kannel will fail! Please ensure you run gmake not make!), edit the files
gw/smsc/smsc_smpp.c
gw/smsc/smsc_soap.c

If you are on a 32-bit machine, replace all occurences of the strtoll method in kannel with strtoimax
If you are on a 64-bit machine, replace all occurences of the strtoll method in kannel with strtol

Do this so gmake will succeed in compiling kannel. This is because HP UX does not have any definitions for strtoll function.

5. Run gmake

#gmake

6. Once you have successfully run gmake, run a gmake install. I always like installing kannel in /usr/local/sbin (actually that’s the default kannel install directory!) so I specify my bindir like this:

#gmake --bindir=/usr/local/sbin

When starting kannel, it will complain about not being able to find the shared library libiconv in /usr/local/lib, so add the following symbolic link:
#ln -s /opt/gnome/lib/libiconv.sl.2 /usr/local/lib/libiconv.sl.2

7. Next put the kannel init.d script below in the /sbin/init.d directory.

#!/sbin/sh
#
# NOTE: This script is not configurable! Any changes made to this
# scipt will be overwritten when you upgrade to the next
# release of HP-UX.
#
# WARNING: Changing this script in any way may lead to a system that
# is unbootable. Do not modify this script.
#

#
# Start kannel
#

PATH=/sbin:/usr/sbin:/usr/bin
export PATH

KANNEL_CONFIG=/usr/kannel/kannel.conf
KANNEL_BASE=/usr/local/sbin

rval=0
set_return() {
x=$?
if [ $x -ne 0 ]; then
echo "ERROR CODE $x"
rval=1
fi
}

case $1 in
start_msg)
echo "Start kannel daemon"
;;

stop_msg)
echo "Stop kannel daemon"
;;

'start')
if [ -f /etc/rc.config.d/kannel ] ; then
. /etc/rc.config.d/kannel
else
echo "ERROR: /etc/rc.config.d/kannel defaults file MISSING"
fi

${KANNEL_BASE}/bearerbox $KANNEL_CONFIG 2>/dev/null 1>/dev/null &
${KANNEL_BASE}/smsbox $KANNEL_CONFIG 2>/dev/null 1>/dev/null &

set_return
;;

'stop')
#
# Determine PID of kannel process(es) to stop
#
smsboxpid=`ps -ef | awk '/smsbox/ && !/awk/ {print $2}'`
kill -9 $smsboxpid
bearerboxpid=`ps -ef | awk '/bearerbox/ && !/awk/ {print $2}'`
kill -9 $bearerboxpid
;;

*)
echo "usage: $0 {start|stop}"
;;
esac

exit $rval

8. Now follow these steps:
#chmod 755 /sbin/init.d/kannel

Link it to the rcX.d directories ie:
#ln -s /sbin/init.d/kannel /sbin/rc3.d/S500kannel
#ln -s /sbin/init.d/kannel /sbin/rc2.d/K500kannel

Create the /etc/rc.config.d/kannel file:
#echo START_INN=1 >/etc/rc.config.d/kannel

10. Now, configure the KANNEL_BASE and KANNEL_CONFIG variables in the init.d file as suitable to your system. Then;

To start kannel:
#/sbin/init.d/kannel start
To stop kannel,
#/sbin/init.d/kannel stop

Kannel successfully ported to HP UX.

Comments (9)

Oracle on Linux

I have so far been lucky in not having to get too deep into Oracle since my dealings with Oracle mostly involved running other people’s scripts. But my luck finally run out and here’s a short tutorial based on my experiences…

ORACLE INSTALLATION SUMMARY

1. Create oracle user
#useradd oracle (more options needed if using ldap)

2. Groups: dba, oinstall

#groupadd dba
#groupadd oinstall
#usermod -g oinstall -G dba oracle
#passwd oracle (more options needed if using ldap)

In my case I installed oracle on the oracle home directory /opt/oracle, so change oracle directory ownership:
#chown oracle.dba /opt/oracle
#chmod 755 /opt/oracle

Don’t forget to add user nobody (ie ‘useradd nobody’), but is normally there by default
#su - oracle
#xhost +

oracle@yourmachine>cd databases
oracle@yourmachine>./runInstaller

3. Start and Stop oracle:
oracle@yourmachine>$ORACLE_HOME/bin/dbstart
oracle@yourmachine>$ORACLE_HOME/bin/dbshut

Start and Stop listener:
oracle@yourmachine>$ORACLE_HOME/bin/lsnrctl start
oracle@yourmachine>$ORACLE_HOME/bin/lsnrctl stop

4. Connect to sql database
#sqlplus /nolog
>connect / as sysdba (connect ben/passwd as sysdba)
>startup [nomount]

Or go directly…
#sqlplus ben/passwd@OurTest

5. For Suse Linux;
>Edit /etc/oratab appropriately.
>Edit /etc/profile.d/oracle.sh appropriately especially ensure the $ORACLE_SID is correct
>Edit /etc/init.d/oracle appropriately
>Edit the $ORACLE_HOME_LISTNER variable in $ORACLE_HOME/bin/dbstart file.
Set it to the value of your $ORACLE_HOME directory
>Edit /etc/sysconfig/oracle appropriately

6. Edit
>network/admin/[tnsnames.ora|listener.ora|sqlnet.ora]
and
>db_1/dbs/init.ora
(Under the References below, go to the cuddletech website for a tutorial on how to do so)

7. Oracle Database Management URLs:
> http://localhost:5560/isqlplus (Load and execute scripts)
> http://localhost:5560/isqlplus/dba
> http://localhost:1158/em (Start/Stop oracle instance. Instance start/stop interface)

8.Check version of oracle:
>select banner from v$version;

9.Yasql examples:

#yasql -d 1 -s loyalty sys/passwd@loyalty as sysdba
#yasql -d 1 -s loyalty sys/passwd@loyalty as sysdba @/home/sysadmin/ourtest.sql

10. All databases are created in:/opt/oracle/oradata,
where /opt/oracle was the oracle home directory I chose in my case.
Yours could be different.

11. You have to run dbca(oracle tool to help you create your database) and netca(oracle tool to help you configure your oracle tns and listeners) as root or else it will fail to run.

12. Oracle strace to trace what is happening:
#strace sqlplus sys/passwd@loyalty

13. Test to see if tnsping is working properly for a given database
#tnsping [databasename]

14. You may add the following ORACLE variables to you bash profile eg /etc/profile:

export ORACLE_HOME=/opt/oracle/product/10.2/db_1
export ORACLE_BASE=/opt/oracle
export ORACLE_SID=OurTest
#export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$PATH:$ORACLE_HOME/bin

15. Perform an ldconfig for oracle libs:
#echo $ORACLE_HOME >> /etc/ld.so.conf
#ldconfig

CREATE A NEW DATABASE
1. Copy sample init.ora and only change SID (System Identification).
$cp init.ora initOurTest.ora, where OurTest=SID

Change DB_NAME to the DB_NAME you wish to use.
You might possibly need to change your shared_pool_size value.

2.
#sqlplus /nolog
>connect sys/passwd as sysdba
>CREATE SPFILE='/opt/oracle/product/10.2/db_1/dbs/spfileOurTest.ora'
FROM PFILE='/opt/oracle/product/10.2/db_1/dbs/initOurTest.ora';

Make sure initOurTest.ora is owned by oracle (ie chown oracle.users initOurTest.ora)

The SPFILE is a binary used directly by Oracle that stores even temporary changes you may have made to your database (ie ALTER sql statements). That way, even supposedly transient changes can be saved and used the next time Oracle is started so you as the DBA don’t always have to remember what “alter”rations/optimisations you have done and copy it to PFILE. If you wish to revert to the old PFILE, then create SPFILE from PFILE and remount your database with your old SPFILE. You can only edit the PFILE.

3. To see the SPFILE currently in use by Oracle instance:
>SHOW PARAMETERS SPFILE
View the location of your SPFILE
>select name,value from v$parameter where name='spfile';

4. Startup new instance with your own custom spfile:
>SHUTDOWN IMMEDIATE
>STARTUP NOMOUNT \
PFILE='/opt/oracle/product/10.2/db_1/dbs/initOurTest.ora'

(STARTUP NOMOUNT will use the default PFILE or SPFILE)

Examples:

——————————————————–

create database mydb1 controlfile reuse
Logfile
Group 1 ('/mydatabases/mydb1/log01a.log',
'/mydatabase02/mydb1/log01b.log') size 50M,
Group 2 ('/mydatabases/mydb1/log02a.log',
'/mydatabase02/mydb1/log02b.log') size 50M,
Group 3 ('/mydatabases/mydb1/log03a.log',
'/mydatabase02/mydb1/log03b.log') size 50M,
Group 4 ('/mydatabases/mydb1/log04a.log',
'/mydatabase02/mydb1/log04b.log') size 50M
Datafile '/mydatabases/mydb1/mydb1_system.dbf' 250M
AUTOEXTEND ON MAXSIZE 500M
Undo tablespace mydb1_undo1
Datafile '/mydatabases/mydb1/mydb1_undo1.dbf' 50M
Default temporary tablespace mydb1temp tempfile
'/mydatabases/mydb1/mydb1temp1.dbf' size 75M
Extent management local
Character set US7ASCII
MAXLOGFILES 10
MAXLOGMEMBERS 10
MAXLOGHISTORY 1
MAXDATAFILES 500;

———————————————————
——————————————————–

CREATE DATABASE OurTest
USER SYS IDENTIFIED BY passwd
USER SYSTEM IDENTIFIED BY passwd
LOGFILE GROUP 1 ('/opt/oracle/oradata/OurTest/redo01.log') SIZE 10M,
GROUP 2 ('/opt/oracle/oradata/OurTest/redo02.log') SIZE 10M,
GROUP 3 ('/opt/oracle/oradata/OurTest/redo03.log') SIZE 10M
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
MAXINSTANCES 1
CHARACTER SET US7ASCII
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/opt/oracle/oradata/OurTest/system01.dbf' SIZE 32M REUSE
EXTENT MANAGEMENT LOCAL
SYSAUX DATAFILE '/opt/oracle/oradata/OurTest/sysaux01.dbf' SIZE 32M REUSE
DEFAULT TABLESPACE tbs_1
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/opt/oracle/oradata/OurTest/temp01.dbf' SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/opt/oracle/oradata/OurTest/undotbs01.dbf'
SIZE 20M REUSE AUTOEXTEND ON MAXSIZE 500M;

——————————————————–

——————————————————-

INSTALL PHP OCI8 EXTENSION

1. Download Oracle Instant Client from here:
(http://www.oracle.com/technology/tech/oci/instantclient/index.html)
if you do not have oracle installed on the machine. If you have Oracle already installed, skip this step.

#mkdir -p /opt/oracle/instantclient
#cd /opt/oracle/instantclient
#unzip instantclient-basic-linux32-10.2.0.1-20050713.zip
#unzip instantclient-sdk-linux32-10.2.0.1-20050713.zip
#echo /opt/oracle/instantclient >> /etc/ld.so.conf
#ldconfig
#ln -s libclntsh.so.10.1 libclntsh.so
#ln -s libocci.so.10.1 libocci.so

2. Download php oci8 module from here:
http://pecl.php.net/package/oci8,
or use:
#pear5 download oci8
3. untar, get in and

4.

#phpize
#./configure --with-oci8=shared,instantclient, \
/opt/oracle/instantclient/instantclient_10_2
(to use instant client)
or
./configure --with-oci8=$ORACLE_HOME
(To use oracle home if you have installed Oracle locally)

Debian installation URL:
http://samgerstenzang.com/blog/archives/2006/09/howto-installing-oracle-xe-on-ubuntu-with-php

USE ZENDCORE ALREADY PRECOMPILED OCI8 MODULE
1. Download zendcore:
http://www.zend.com/products/zend_core/zend_core_for_oracle

2. Use Zendcore as it is or alternatively after installation copy it's own oci8.so module into your own distros php extensions directory which in my ase was /usr/lib/php5/extensions:

#cd /usr/local/Zend/Core/lib/php/20050922/
#cp oci8.so /usr/lib/php5/extensions

TOP ORACLE TOOLS FOR LINUX:
After many hours of testing all the tools out there, the following tools got the best revs in my opinion:

1. yaSQL
(Download DBD::Oracle module from http://search.cpan.org/dist/DBD-Oracle/ to use)
2. tORA
3. SuperQuaiL
4. m2o
(mysql sql script to oracle script converter)
5. OracleEditor.php

REFERENCES
1. http://www.cuddletech.com/articles/oracle/node34.html (*****)
2. http://www.oracleadvice.com/Tips/isqlplus.htm
3. http://www.oracle.com/technology/pub/articles/smiley_10gdb_install.html
4. http://www.stanford.edu/dept/itss/docs/oracle/10g/server.101/b12170/ch2.htm
5. http://www.oracleopensource.com/archives/2005/06/index.html
6. http://saturn.uab.es/win.920/a95491/create.htm (Create Oracle database)
7. http://www.idevelopment.info/data/Oracle/DBA_tips/Database_Administration/DBA_37.shtml
8. http://www.examcram2.com/articles/article.asp?p=350920&seqNum=5&rl=1
9. http://orafaq.com/node/6
10. http://www.dbmotive.com/oracle_error_codes.php (Error codes debugging)
11. http://www.stanford.edu/dept/itss/docs/oracle/10g/java.101/b10979/basic.htm (Authentication)
12. http://www.oreillynet.com/oracle/os_dir/commandline.csp
13. http://orafaq.com/faqplus.htm
14. http://www.oracle.com/technology/pub/notes/technote_php_instant.html (php-oracle)
15. http://ubuntuforums.org/showthread.php?t=92528 (php-oracle)
16. http://www.dynamicwebpages.de/tutorial/27/
17. http://creole.phpdb.org/trac/browser/trunk/classes/creole/drivers/oracle?rev=1
18. http://www.psoug.org/reference/system_privs.html (general sql statements)
19. http://www.puschitz.com/InstallingOracle9i.shtml

Comments (5)