The reason this document came into being is that I could not locate all the
information I needed to make InterBase run as a service on SuSE Linux. After
finding some information and applying trial-and-error methods, I had success.
I've decided to document
the process to help anyone else who might be trying to do the same thing.
Please note that I have confirmed that this works only on SuSE Linux v. 7.2.
It should work on other variants of Unix and Linux, but you will have to test
it on your system to be sure.
First, obtain the InterBase distribution package for Linux: InterbaseSS_LI-V6.0-1.i386.rpm.
Log in to your system as root and install the package using rpm:
#rpm -U InterbaseSS_LI-V6.0-1.i386.rpm
This should force an install and update of any existing package. The package should be installed under
/opt/interbase. It's best to double-check to ensure that this step worked and
that all the files and directories have been installed.
Create a group interbase and a user interbase. Be sure to include a password for system security.
The home directory should be
/usr/interbase. Make the user a member of group interbase.
Now make a bin directory for InterBase and create a link to ibmgr in that directory:
#cd /usr/interbase
#mkdir bin
#cd bin
#ln -s /opt/interbase/bin/ibmgr
Add the path to the InterBase binaries to the user interbase's path. Since I'm using SuSE Linux,
we add this to /usr/interbase/.bashrc. You could add it to /usr/interbase/.profile if you are
using some other version of Linux. Add the following lines to the file:
PATH=$PATH:/opt/interbase/bin
export PATH
Now create the following file in /etc:
gds_hosts.equiv
/********************* file contents ****************************/
# This file will allow InterBase to connect to the localhost
localhost
+
/********************* end of contents **************************/
Check to make sure the port for InterBase has been added to /etc/services:
#grep 3050 /etc/services.
You should get a line like the following:
gds_db 3050/tcp # InterBase Database Remote Protocol
If you don't, add it to /etc/services.
Create the following file in /etc/rc.d:
ibserver
(Note: This is the sample file that is included in the InterBase
Operations Guide. However, I could not get it to work as it was,
so I modified it as shown. Once I did that, it worked.)
/********************* file contents ****************************/
#! /bin/sh
# ibserver script - Start/stop the InterBase daemon
# Set these environment variables if and only if they are not set.
: ${INTERBASE:=/usr/interbase}
: ${ISC_USER:=SYSDBA}
: ${ISC_PASSWORD:=masterkey}
# WARNING: in a real-world installation, you should not put the
# SYSDBA password in a publicly-readable file. To protect it:
# chmod 700 ibserver; chown root ibserver
#export INTERBASE
#export ISC_USER
#export ISC_PASSWORD
ibserver_start()
{
# This example assumes the InterBase server is
# being started as UNIX user 'interbase'.
# echo $INTERBASE'/bin/ibmgr -start -forever' | su interbase
su -c $INTERBASE'/bin/ibmgr -start -forever' interbase
}
ibserver_stop()
{
# No need to su, since $ISC_USER and $ISC_PASSWORD validate us.
$INTERBASE/bin/ibmgr -shut -password $ISC_PASSWORD
}
case $1 in
'start' )
echo -e 'InterBase Server starting... c'
ibserver_start ;;
'start_msg' )
echo -e 'InterBase Server starting... c' ;;
'stop' )
echo -e 'InterBase Server stopping... c'
ibserver_stop ;;
'stop_msg' ) echo -e 'InterBase Server stopping... c' ;;
*) echo 'Usage: $0 { start | stop }'; exit 1;;
esac
exit 0
/********************* end of contents **************************/
Make sure you set owner, group, and permissions for this file:
#chown ibserver root
#chgrp ibserver root,
#chmod 700 ibserver
Now only root can read, write, and execute ibserver.
Set up ibserver to start automatically when it gets to run level 3. The reason we put it here is so all the network
environment is in place. You will also need to make sure it stops when you leave
run level 3. This makes sure you shut down the database
properly on system shutdown:
#cd /etc/rc.d/rc3.d
Check to see where inetd starts. You need to link your start
to be after that. In my system, I put it after firewalls and so on:
#ln -s /etc/rc.d/ibserver S24ibserver
Check to see where inetd stops. You need to link your stop
to be before that. In my system, inetd was K04inetd, so:
#ln -s /etc/rc.d/ibserver K03ibserver
Now InterBase will run at startup. If you need to start or stop InterBase manually,
log in as root. To stop:
#ibserver stop
To start:
#ibserver start
You need to make databases accessible to the user interbase, or you will not be able to connect to them from the outside world.
In my case, I created a directory data under /opt/interbase, then:
#chgrp data interbase
This gives InterBase the access it needs to read and write files
here. Where you put your data is up to you -- just remember that InterBase has to have rw permissions to the directory it is in.
Good luck!