10
Installing Sybase ASE 15.5 on Fedora 13 Installing Sybase ASE 15.5 on Fedora 13 Finnbarr P. Murphy ([email protected]) Recently I wanted to use Sybase ASE (Adaptive Server Enterprise) on GNU/Linux to test some DDL (Data Definition Language) scripts I had written. I decided to put Sybase ASE on a system that is running 64-bit Fedora 13. In this post I will walk you through what you need to know in order to successfully install the product and get it operational on both 32-bit and 64-bit Fedora 13. Sybase, like Oracle and other DBMSs, requires a separate user. Therefore create a new user named sybase whose home directory is /opt/sybase and who is a member of the default users group, i.e. sybase has no private group. I recommend that you put Sybase ASE at /opt/sybase as that is typically where such applications reside and that is the directory I use in this post. # useradd -d /opt/sybase -c "Sybase ASE account" -g users -m -- sybase Before you start the actual install you need to check the current maximum size of a shared memory segment (part of System V IPC, see /usr/include/linux/shm.h for defaults) and increase it, if necessary, to 268435456 (256Mb). To view current value: # cat /proc/sys/kernel/shmmax To set it to a new value for this running session (takes effect immediately): # echo 268435456 > /proc/sys/kernel/shmmax To set it to a new value permanently (so it survives reboots), edit /etc/sysctl.conf: .... kernel.shmmax = 268435456 .... You also need to ensure that the following packages are installed on your system: compat-libstdc++-33-3.2.3-68 libaio libaio-devel If you are on 64-bit Fedora 13, you need to install some 32-bit libraries on your system before starting the installation. This is because the Sybase ASE installed which is called InstallAnywhere (setup.bin) is partially a Java application with JNI (native interface) dependencies on 32-bit system libraries. Since my system is 64-bit, I had to install the following 32-bit packages: glibc-2.12-2.i686 libXext-1.1-2.fc13.i686 libXtst-1.0.99.2-3.fc12.i686 For personnal use only 03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 1/10

Installing Sybase ASE 15.5 on Fedora 13

Embed Size (px)

DESCRIPTION

Installing Sybase ASE 15.5 on Fedora 13Installing Sybase ASE 15.5 on Fedora 13Finnbarr P. Murphy([email protected]) Recently I wanted to use Sybase ASE (Adaptive Server Enterprise) on GNU/Linux to test some DDL (Data Definition Language) scripts I had written. I decided to put Sybase ASE on a system that is running 64-bit Fedora 13. In this post I will walk you through what you need to know in order to successfully install the product and get it operational on both 32-bit and 64-bit Fedora 13

Citation preview

Page 1: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 onFedora 13

Finnbarr P. Murphy([email protected])

Recently I wanted to use Sybase ASE (Adaptive Server Enterprise) on GNU/Linux to test someDDL (Data Definition Language) scripts I had written. I decided to put Sybase ASE on a systemthat is running 64-bit Fedora 13. In this post I will walk you through what you need to know inorder to successfully install the product and get it operational on both 32-bit and 64-bit Fedora 13.

Sybase, like Oracle and other DBMSs, requires a separate user. Therefore create a new usernamed sybase whose home directory is /opt/sybase and who is a member of the default usersgroup, i.e. sybase has no private group. I recommend that you put Sybase ASE at /opt/sybase asthat is typically where such applications reside and that is the directory I use in this post.

# useradd -d /opt/sybase -c "Sybase ASE account" -g users -m -- sybase

Before you start the actual install you need to check the current maximum size of a sharedmemory segment (part of System V IPC, see /usr/include/linux/shm.h for defaults) and increase it,if necessary, to 268435456 (256Mb).

To view current value:# cat /proc/sys/kernel/shmmax

To set it to a new value for this running session (takes effect immediately):# echo 268435456 > /proc/sys/kernel/shmmax

To set it to a new value permanently (so it survives reboots), edit /etc/sysctl.conf:....kernel.shmmax = 268435456....

You also need to ensure that the following packages are installed on your system:

compat-libstdc++-33-3.2.3-68libaiolibaio-devel

If you are on 64-bit Fedora 13, you need to install some 32-bit libraries on your system beforestarting the installation. This is because the Sybase ASE installed which is called InstallAnywhere(setup.bin) is partially a Java application with JNI (native interface) dependencies on 32-bit systemlibraries. Since my system is 64-bit, I had to install the following 32-bit packages:

glibc-2.12-2.i686libXext-1.1-2.fc13.i686libXtst-1.0.99.2-3.fc12.i686

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 1/10

Page 2: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

I used yum to install the above packages. Some other packages (libXau, libxcb, libX11, libXext andlibXi were automatically installed by Yum to resolve dependencies. Interesting to note that someof the packages are marked fc12; guess they were never rebuilt for Fedora 13.

If you do not install the 32-bit libraries listed above, you will get the following error message whenyou try to run the Sybase ASE installer (which is named setup.bin).

[sybase]$ ./setup.binPreparing to install...Extracting the JRE from the installer archive...Unpacking the JRE...Extracting the installation resources from the installer archive...Configuring the installer for this system's environment...strings: '/lib/libc.so.6': No such file[sybase]$

The /lib/libc.so.6 is the giveaway. The path indicates that a 32-bit library is missing.

Now that the preliminaries are out of the way, create a temporary install directory anywhere youhave sufficient capacity and download the Sybase ASE tarball to it. The tarball that I downloadedfrom Sybase was ase155_linuxx86-64.tgz. This is the current ASE Developers Edition for 64-bitGNU/Linux. If you are on a 32-bit platform, download the 32-bit version instead. If necessarychange ownership and permissions so that sybase is the owner of this directory and all itscontents and become the user sybase by whatever means suits you.

Unless otherwise indicated, you should be logged in as sybase from here on out. As sybase, cd tothe temporary install directory and untar the tarball that you downloaded. Interestingly, If youlook at the resultant directory structure and files you will see that most of the Sybase tools areJava-based and Sybase ASE includes it’s own version of the JRE (Java Runtime Environment) andmany other common Java libraries.

The Sybase ASE installer can run in either console or graphics mode. Graphics mode is mucheasier to use in my opinion but if you are on a terminal or remotely connected you may prefer touse the console mode. Note that if you have not installed 32-bit X libraries listed above, you canonly use the console mode. If you have these libraries installed and the installer still informs youthat it cannot use the graphics mode via a message similar to this:

Graphical installers are not supported by the VM. The console mode willbe used instead...

then you need to modify your X Server settings. The following command should fix the issue foryou:

# xhost si:localuser:sybase

The xhost access control utility is used to add and delete host names or user names to the list ofentities allowed to make connections to the X server. The above command adds a ServerInterpreted entry of type localuser with a value of sybase. See the xhost and XSecurity man pagesif your are unsure of the syntax.

If all goes well, here is what you should see when you invoke the installer by entering ./setup.bin

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 2/10

Page 3: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

I suggest you select the defaults for all of the options presented to you. Ensure that theinstallation is to the /opt/sybase directory. The whole installation should take less than 10 minutesif you are on a reasonably fast system.

Assuming that the install is successful, you should modify the .bashrc for the user sybase so that italways sources the SYBASE.sh script which is now in the /opt/sybase directory. Add the followinglines to the existing .bashrc script. This script sets up all the environmental variables and PATHsneeded to administrate the Sybase ASE installation.

export LD_POINTER_GUARD=0export SYBASE=/opt/sybase. ./SYBASE.sh

Otherwise you will have to manually source SYBASE.sh every time you log in. If you are usingksh93 modify .kshrc to include this file. There also is a SYBASE.csh script for csh and tcshholdouts.

To determine whether the servers you installed are running, use the showserver shell script.

[sybase]$ showserverF S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD0 S sybase 7573 7572 34 80 0 - 91438 poll_s 18:14 ? 00:00:03 /opt/sybase/ASE-15_0/bin/dataserver -d/opt/sybase/data/master.dat -e/opt/sybase/ASE-15_0/install/ULTRA.log -c/opt/sybase/ASE-15_0/ULTRA.cfg -M/opt/sybase/ASE-15_0 -sULTRA[sybase]$

Unlike Oracle, the Adaptive Server runs as a single process (dataserver) within Fedora. Neitherdoes it use any operating system threads as it has it’s own threading model.

The next step is to check whether you can connect to the Adaptive Server. A simple test is to usethe isql utility to check what version of the Adaptive Server is running. My server was calledULTRA. Your server will be called something else so anywhere you see ULTRA used on the

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 3/10

Page 4: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

command line replace it with the actual name of your server.

[sybase@ultra ASE-15_0]$ isql -Usa -P -SULTRA1> select @@version2> go-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Adaptive Server Enterprise/15.5/EBF 17340 SMP/P/x86_64/Enterprise Linux/ase155/2391/64-bit/FBO/Mon Nov 9 18:44:45 2009

(1 row affected)1> quit[sybase]$

If you were unable to connect, use netstat -na to check the Adaptive Server port (default is 5000)is in the LISTENING state. If you still cannot connect, check your IPTables and SELinux settings.

Note that no password for the Sybase system administrator (username sa) was required. This isbecause the initial value for the sa password is set to NULL.

To set the password for the system administrator:

[sybase]$ isql -Usa -P -Sserver_name1> sp_password null, NEWPASSWORD2> go1> quit[sybase]$

where null is the default password and “NEWPASSWORD” is the password that you wish to assignto the sa account.

Sybase provides a modular (plugin) graphical user interface called Sybase Central which you canuse to perform various administrative tasks. To invoke it, enter aseplugin at the shell prompt. Ifyou get an error message about “No protocol specified” as is likely, you need to grant access tothe X Server by means of the xhost command described earlier in this post.

Here is a screenshot of Sybase Central:For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 4/10

Page 5: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

Adaptive Server uses logical devices to store physical data. Before you go another further, it is agood idea to create a new logical device so you do not fill up or otherwise damage the masterdevice which contains the system tables and other critical data The term device does notnecessarily refer to a distinct physical device such a disk; it can refer to a disk partition or anindividual file. A logical device must be prepared and made known to Adaptive Server before itcan be used. This process is called initialization.

Here I create two 64Mb file-based devices in /var/lib/sybase – one for the Adaptive Server (test.dat)and one for the Backup Server (test-bs.dat):

[sybase]$ isql -Usa -PXXXXXX -SULTRA1> disk init name='test', physname='/var/lib/sybase/test.dat', size='64m'2> go00:00:00000:00023:2010/07/02 12:59:56.44 kernel Initializing virtual device 5, '/var/lib/sybase/test.dat' with dsync 'off'.00:00:00000:00023:2010/07/02 12:59:56.44 kernel Virtual device 5 started using asynchronous (with DIRECTIO) i/o.00:00:00000:00023:2010/07/02 12:59:56.44 kernel Initializing device /var/lib/sybase/test.dat from offset 0 with zeros.00:00:00000:00023:2010/07/02 12:59:59.27 kernel Finished initialization.1> disk init name='testlog', physname='/var/lib/sybase/test-bs.dat', size='64m'2> go00:00:00000:00023:2010/07/02 13:01:04.34 kernel Initializing virtual device 6, '/var/lib/sybase/test-bs.dat' with dsync 'off'.00:00:00000:00023:2010/07/02 13:01:04.34 kernel Virtual device 6 started using asynchronous (with DIRECTIO) i/o.00:00:00000:00023:2010/07/02 13:01:04.34 kernel Initializing device /var/lib/sybase/test-bs.dat from offset 0 with zeros.00:00:00000:00023:2010/07/02 13:01:07.08 kernel Finished initialization.1> create database test on test='64m' log on test-bs='64m'2> goCREATE DATABASE: allocating 16384 logical pages (64.0 megabytes) on disk 'test' (16384 logical pages requested).CREATE DATABASE: allocating 16384 logical pages (64.0 megabytes) on disk 'test-bs' (16384 logical pages requested).Database 'test' is now online.1> quit

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 5/10

Page 6: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

[sysbase]$

Another component of Sybase ASE is called an XP Server. This server is used with ExtendedStored Procedures (ESP). For example, the system ESP xp_cmdshell enables you to issue anoperating system command from within Adaptive Server. XP Server and the Adaptive Server runon the same system and communicate via remote procedure calls (RPC) but are differentprocesses. The theory is that running ESPs in a separate process protects the Adaptive Serverfrom a failure due to faulty ESP code.

The XP Server is automatically installed when an Adaptive Server is installed. However, it doesnot start up when the Adaptive Server is started; instead the Adaptive Server starts the XP Serverthe first time an ESP is invoked and shuts down the XP Server as necessary when it exits.

If you want to use the xp_cmdshell ESP, you should probably just set xp_cmdshell context to 0,otherwise you will end up with “User access denied. Failed to change the user context.” messageswhen you try to use it. When xp_cmdshell context is 0, the permissions of the operating systemaccount under which Adaptive Server (in my case, sybase) is running are the permissions used toexecute an operating system command from xp_cmdshell.

[sybase]$ isql -Usa -PXXXXX -SULTRA1> use sybsystemprocs2> go1> sp_configure "xp_cmdshell context", 02> go Parameter Name Default Memory Used Config Value Run Value Unit Type -------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------------------------------- xp_cmdshell context 1 0 0 0 switch dynamic

(1 row affected)Configuration option changed. ASE need not be rebooted since the option is dynamic.Changing the value of 'xp_cmdshell context' does not increase the amount of memory Adaptive Server uses.(return status = 0)1>1> xp_cmdshell date2> go xp_cmdshell -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Sat Jul 3 23:04:07 EDT 2010

(1 row affected)(return status = 0)1> quit[sybase]$

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 6/10

Page 7: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

As you can see from the above, xp_cmdshell date returned the current date.

Sybase ASE supports web services and comes with its own Jetty-based webserver. The webservices consists of two components, a Web Services Producer and a Web Services Consumer.Both components run independently of the Adaptive Server. The Web Services Producercomponent enables client applications to access SQL and stored procedures in Adaptive Serverusing SOAP. The Web Services Consumer component enables Adaptive Server to access the Webservices of other applications. You can start the Web Services using the runconsumer orrunproducer scripts which are located in $SYBASE/WS-15_0/bin. Port 8181 is the default port.

Here is what you should see on that port if you invoke runproducer:

If you do not see a web page similar to this, then check your configuration to see if you specified adifferent port than 8181 for the Web Services..

If you want to automate the starting and stopping of your Sybase installation, here is an init scriptwhich can be added to /etc/init.d to handle these tasks.

#!/bin/bash## sybase This shell script takes care of starting and stopping Sybase ASE## chkconfig: - 86 16## config: /etc/sysbase/sybase.conf#### BEGIN INIT INFO# Provides: dataserver# Required-Start:# Required-Stop:# Should-Start:# Short-Description: start and stop Sybase ASE database# Description:### END INIT INFO

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 7/10

Page 8: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

# Source function libraryif [[ -r /etc/rc.d/init.d/functions ]]; then . /etc/rc.d/init.d/functionselse exit 1fi# Source sybase configurationif [[ -r /etc/sybase/sybase.conf ]]; then . /etc/sybase/sybase.confelse exit 1fi# Source sybase variablesif [[ -r ${SYBASE_HOME}/SYBASE.sh ]]; then . ${SYBASE_HOME}/SYBASE.shelse exit 1fi# Find the name of the scriptBASENAME=$(basename $0)# For SELinux we need to use 'runuser' not 'su'if [[ -x /sbin/runuser ]]; then SU=/sbin/runuserelse SU=/bin/sufiRETVAL=0start() { SYBASE_START=$"Starting ${BASENAME} service: " echo -n "$SYBASE_START" $SU -l sybase -c "startserver -f ${SYBASE}/${SYBASE_ASE}/install/RUN_${SYBASE_SERVER}" > /dev/null # ret=$? if [[ $? -eq 0 ]]; then success "$SYBASE_START" else failure "$SYBASE_START" RETVAL=1 fi echo}stop() { echo -n $"Stopping ${BASENAME} service: " $SU -l sybase -c "isql -S ${SYBASE_SERVER} -U sa < ${SYBASE}/stop.in" > /dev/null # ret=$? if [[ $? -eq 0 ]]; then echo_success else echo_failure RETVAL=1 fi echo}case $1 in start) start ;; stop) stop ;; status) CNT=$($SU -l sybase -c "showserver" | /usr/bin/wc -l | /usr/bin/cut -f1) RETVAL=$? if [[ $CNT -eq 1 ]]; then echo "$BASENAME is stopped ..." else echo "$BASENAME is running ..."

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 8/10

Page 9: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

fi ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|status|restart}" RETVAL=3esacexit $RETVAL

This script expects to find a configuration file for the Sybase ASE installation at/etc/sybase/sybase.conf. Here is the contents of my sybase.conf:

# cat /etc/sybase/sybase.confSYBASE_HOME="/opt/sybase"SYBASE_SERVER="ULTRA"#

The other file used by the Sybase init script is $SYBASE/stop.in. This file contains the isqlstatements required to shutdown the Adaptive Server and the Backup Server.

PASSWORDshutdowngoshutdown SYB_BACKUPgoquit

where “PASSWORD” is the sa password.

You can then use the service command to start, stop and check the status of the database.

# service sybase startStarting sybase service: [ OK ]# service sybase statussybase is running ...# service sybase stopStopping sybase service: [ OK ]# service sybase statussybase is stopped ...

If you are an experienced system administrator, you should not need any instructions on how tointegrate this script into the correct run levels so that the Adaptive Server is started and stoppedautomatically when the system is booted up and shutdown. If you do need help, there are plenty ofguides on how to do so available in many languages on the Internet. Note that this script does nothandle any Web Services. If you are going to use the Web Services, you probably should modifythe script to also handle the starting or stopping of the Web Services.

Two other servers come with Sybase ASE. They are not important from the perspective of aninitial installation but I will briefly describe them for completeness. The Backup Server is a utilitythat handles all dumps and loads for the Adaptive Server. It is started automatically when theAdaptive Server is started but must be separately shutdown. The commands to do this areincluded in the stop.in file described above. The Monitor Server collects Adaptive Server

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 9/10

Page 10: Installing Sybase ASE 15.5 on Fedora 13

Installing Sybase ASE 15.5 on Fedora 13

performance data in real time and makes the data available to the other Sybase ASE tools whichstore the data, analyze it and produce reports.

Well, this is all that you should need to know to get Sybase ASE installed and working on Fedora13. Good luck with your particular installation. Please let me know if I have missed any of theimportant steps and I will update this post.

P.S. Sybase generously makes many of their products freely available to developers fornon-commercial use on GNU/Linux. Go here for more information and to download a developeredition of one or more of their products.

For p

erson

nal u

se on

ly

03-02-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 10/10