Translate

Archives

Installing Sybase ASE 15.5 on Fedora 13

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


I used yum to install the above packages. Some other packages (libXau, libxcb, libX11, libXext and libXi were automatically installed by Yum to resolve dependencies. Interesting to note that some of 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 when you try to run the Sybase ASE installer (which is named setup.bin).

[sybase]$ ./setup.bin 
Preparing 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 you have sufficient capacity and download the Sybase ASE tarball to it. The tarball that I downloaded from Sybase was ase155_linuxx86-64.tgz. This is the current ASE Developers Edition for 64-bit GNU/Linux. If you are on a 32-bit platform, download the 32-bit version instead. If necessary change ownership and permissions so that sybase is the owner of this directory and all its contents 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 to the temporary install directory and untar the tarball that you downloaded. Interestingly, If you look at the resultant directory structure and files you will see that most of the Sybase tools are Java-based and Sybase ASE includes it’s own version of the JRE (Java Runtime Environment) and many other common Java libraries.

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

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


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

# xhost si:localuser:sybase


The xhost access control utility is used to add and delete host names or user names to the list of entities allowed to make connections to the X server. The above command adds a Server Interpreted entry of type localuser with a value of sybase. See the xhost and XSecurity man pages if 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

sybase installer

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

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

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


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

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

[sybase]$ showserver
F S UID        PID  PPID  C PRI  NI ADDR SZ WCHAN  STIME TTY          TIME CMD
0 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. Neither does 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 use the isql utility to check what version of the Adaptive Server is running. My server was called ULTRA. Your server will be called something else so anywhere you see ULTRA used on the command line replace it with the actual name of your server.

[sybase@ultra ASE-15_0]$ isql -Usa  -P -SULTRA
1> select @@version
2> 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 is because the initial value for the sa password is set to NULL.

To set the password for the system administrator:

[sybase]$ isql -Usa -P -Sserver_name
1> sp_password null, NEWPASSWORD 
2> go
1> quit
[sybase]$


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

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

Here is a screenshot of Sybase Central:

sybase central

Adaptive Server uses logical devices to store physical data. Before you go another further, it is a good idea to create a new logical device so you do not fill up or otherwise damage the master device which contains the system tables and other critical data The term device does not necessarily refer to a distinct physical device such a disk; it can refer to a disk partition or an individual file. A logical device must be prepared and made known to Adaptive Server before it can 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 -SULTRA
1> disk init name='test', physname='/var/lib/sybase/test.dat', size='64m'
2> go
00: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> go
00: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> go
CREATE 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
[sysbase]$


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

The XP Server is automatically installed when an Adaptive Server is installed. However, it does not start up when the Adaptive Server is started; instead the Adaptive Server starts the XP Server the 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.” messages when you try to use it. When xp_cmdshell context is 0, the permissions of the operating system account under which Adaptive Server (in my case, sybase) is running are the permissions used to execute an operating system command from xp_cmdshell.

[sybase]$ isql -Usa -PXXXXX -SULTRA
1> use  sybsystemprocs
2> go 
1> sp_configure "xp_cmdshell context", 0
2> 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 date
2> go
 xp_cmdshell                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      
 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
 Sat Jul  3 23:04:07 EDT 2010
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
(1 row affected)
(return status = 0)
1> quit
[sybase]$


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 web services consists of two components, a Web Services Producer and a Web Services Consumer. Both components run independently of the Adaptive Server. The Web Services Producer component enables client applications to access SQL and stored procedures in Adaptive Server using SOAP. The Web Services Consumer component enables Adaptive Server to access the Web services of other applications. You can start the Web Services using the runconsumer or runproducer 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:

sybase web services

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

If you want to automate the starting and stopping of your Sybase installation, here is an init script which 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

# Source function library
if [[ -r /etc/rc.d/init.d/functions ]]; then
   . /etc/rc.d/init.d/functions
else
   exit 1
fi

# Source sybase configuration
if [[ -r /etc/sybase/sybase.conf ]]; then
   . /etc/sybase/sybase.conf
else
   exit 1
fi

# Source sybase variables
if [[ -r ${SYBASE_HOME}/SYBASE.sh ]]; then
   . ${SYBASE_HOME}/SYBASE.sh
else
   exit 1
fi

# Find the name of the script
BASENAME=$(basename $0)

# For SELinux we need to use 'runuser' not 'su'
if [[ -x /sbin/runuser ]]; then
    SU=/sbin/runuser
else
    SU=/bin/su
fi

RETVAL=0

start() {
    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 ..."
        fi
        ;;
    restart)
        stop
        start
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart}"
        RETVAL=3

esac

exit $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.conf
SYBASE_HOME="/opt/sybase"
SYBASE_SERVER="ULTRA"
# 


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

PASSWORD
shutdown
go
shutdown SYB_BACKUP
go
quit


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 start
Starting sybase service:                                   [  OK  ]
# service sybase status
sybase is running ...
# service sybase stop
Stopping sybase service:                                   [  OK  ]
# service sybase status
sybase is stopped ...


If you are an experienced system administrator, you should not need any instructions on how to integrate this script into the correct run levels so that the Adaptive Server is started and stopped automatically when the system is booted up and shutdown. If you do need help, there are plenty of guides on how to do so available in many languages on the Internet. Note that this script does not handle any Web Services. If you are going to use the Web Services, you probably should modify the 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 an initial installation but I will briefly describe them for completeness. The Backup Server is a utility that handles all dumps and loads for the Adaptive Server. It is started automatically when the Adaptive Server is started but must be separately shutdown. The commands to do this are included in the stop.in file described above. The Monitor Server collects Adaptive Server performance data in real time and makes the data available to the other Sybase ASE tools which store 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 Fedora 13. Good luck with your particular installation. Please let me know if I have missed any of the important steps and I will update this post.

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

5 comments to Installing Sybase ASE 15.5 on Fedora 13

  • Pohlman Ball

    Nice post.

    Thanks for the effort you took to expand upon this topic so thoroughly. I look forward to future post.

    – Pohlman

  • Cristian Patitoiu

    Thank you very much for this excellent post.
    I sincerely appreciate your effort for publishing it. It saved me a lot of time and headaches.

    All the best,
    Cristian.

  • Ron Chennells

    Thanks
    Great post

    Works OK on Oracle Enterprise Linux 5.5 64bit

    [sybase@nas1 ~]$ . ./SYBASE.sh
    [sybase@nas1 ~]$ showserver
    F S UID PID PPID C PRI NI ADDR SZ WCHAN STIME TTY TIME CMD
    0 S sybase 16259 16258 0 85 0 – 52902 184467 22:00 pts/1 00:00:00 /opt/sybase/ASE-15_0/bin/monserver -SBEOWULF_1 -Usa -P -n5 -l/opt/sybase/ASE-15_0/install/BEOWULF_1_MS.log -L/opt/sybase/ASE-15_0/BEOWULF_1_MS.cfg -m/opt/sybase/ASE-15_0 -MBEOWULF_1_MS
    0 S sybase 16220 16219 0 78 0 – 6260 587567 22:00 pts/1 00:00:00 /opt/sybase/ASE-15_0/bin/backupserver -e/opt/sybase/ASE-15_0/install/BEOWULF_1_BS.log -N25 -C20 -M/opt/sybase/ASE-15_0/bin/sybmultbuf -SBEOWULF_1_BS
    0 S sybase 16183 16182 27 75 0 – 57602 stext 22:00 ? 00:00:23 /opt/sybase/ASE-15_0/bin/dataserver -sBEOWULF_1 -d/opt/sybase/data/master.dat -e/opt/sybase/ASE-15_0/install/BEOWULF_1.log -c/opt/sybase/ASE-15_0/BEOWULF_1.cfg -M/opt/sybase/ASE-15_0
    [sybase@nas1 ~]$ uname -a
    Linux nas1.localdomain 2.6.18-194.el5 #1 SMP Mon Mar 29 22:10:29 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
    [sybase@nas1 ~]$ which isql
    ~/OCS-15_0/bin/isql
    [sybase@nas1 ~]$ isql -Usa -P -SBEOWULF_1
    1> select @@version
    2> go

    ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
    Adaptive Server Enterprise/15.5/EBF 18164 SMP ESD#2/P/x86_64/Enterprise Linux/a
    sear155/2514/64-bit/FBO/Wed Aug 25 11:17:26 2010

    (1 row affected)
    1>

  • Enrique Sanchez

    If not works with: isql -Usa -P -SNAME_SERVER

    before inputs in the console: unset LANG

    by example:
    [sybase@kikesanz ~]$ unset LANG
    [sybase@kikesanz ~]$ isql -Usa -P -SKIKESANZ

    is a strong headache, jojo

  • Enrique Sanchez

    If Sybase Central not connect and show this error:
    Connection failed.
    Attempted to connect using:
    HOSTNAME=kikesanz;SERVERNAME=kike;USER=sa;JCONNECT_VERSION=0;PASSWORD=***;=kikesanz;=5000
    JZ006: Caught IOException: java.net.ConnectException: Connection refused

    Por si Sybase Central no conecta, dejo algunos pasos para que se encarguen de otros errores, y les comparto lo mio:

    para que conecte necesitan cambiar el archivo interfaces que se encuentra por defecto en:
    /opt/sybase/interfaces

    el mio estaba asi:

    kike
    master tcp ether kikesanz 5000
    query tcp ether kikesanz 5000

    kikebs
    master tcp ether kikesanz 5001
    query tcp ether kikesanz 5001

    Aclaro que mi ip es 192.168.1.64
    lo deben poner en:

    kike
    master tcp ether 192.168.1.X 5000
    query tcp ether 192.168.1.64 5000

    kikebs
    master tcp ether 192.168.1.64 5001
    query tcp ether 192.168.1.64 5001

    espero que no les de lata, porque a mi si que me dio un buen dolor de cabeza, y la verdad es lo unico que le hace falta a este muy buen tutorial. Saludos a todos.
    Sorry, but my englisn is bad, and believe that i was very graphic with this.