Linux platforms

<< Installing on POSIX platforms | Firebird 2 Migration & Installation | MAC OSX >>

Linux platforms

(Originally by Mark O'Donohue, revised for 2.0)

READ THIS FIRST

  • You will need to be root user to install Firebird.
  • Do not try to use rpm --update to bring any existing Firebird package installation up to date. The Firebird packages do not support it.
  • If you are installing Superserver on a Linux that supports the new POSIX threading library (NPTL) then choose the NPTL build of Firebird. Most distros with the 2.6 kernel are built with NPTL enabled; some with later 2.4 kernels also enabled it, but it may be wise to prepare to revert to the regular build and set up to export the LD_ASSUME_KERNEL=2.2.5 variable if the 2.4 implementation of the NPTL causes problems. Details for doing this follow below.
  • 64-bit builds are available for both Classic and Superserver. These should be installed only on a 64-bit Linux system. NPTL support is native on 64-bit Linux.

libstdc++.so.5

Installation on Linuxen requires a glibc package installed that is equal to or greater than glibc-2.2.5. However, to enable support for some older distros, the generic binaries are built in a compiler environment that will ensure compatibility with the v.2.2.5 kernel. For this reason, the runtime library libstdc++.so.5 must be present in your system before you attempt to install Firebird.

There are various ways to achieve it, as follows:

  • by installing a compat-glibc package (RedHat, CentOs, OpenSuse, Debian) or a libstdc++5 package (Mandriva).
  • by using a Firebird rpm (or other, appropriate package type) provided by your distro instead of the generic one provided by the Firebird Project.
  • by compiling Firebird yourself, on the same system that you are going to run it on!

Setting Linux to use the old threading model

If the NPTL causes problems for Superserver and locally compiled programs, including utilities such as gbak throwing a Broken Pipe error, you can try to solve the problem by forcing Linux to use the old threading model.

To fix.-

1. In /etc/init.d/firebird

 LD_ASSUME_KERNEL=2.2.5
 export LD_ASSUME_KERNEL

That takes care of the server instance.

2. You need to have the LD_ASSUME_KERNEL environment variable set up within the local environment as well, so add the following to /etc/profile, to ensure every user picks it up for the command-line utilities.

after

   HISTSIZE=1000

add

   LD_ASSUME_KERNEL=2.2.5

On the following line, export it (this is all in one line):

 export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUT_RC LD_ASSUME_KERNEL

Installing on Linux

The following instructions describe the Classic installation. For installation of Superserver the CS in the package name is replaced by SS. For example, the package FirebirdCS-2.1.n-nnnnn.i686.rpm is replaced by FirebirdSS-2.1.n-nnnnn.i686.rpm.

Note: For those who, in the past, have had trouble installing Firebird on Slackware, the good news is that the installers in this version do include Slackware support.

Log in as root, or open a root shell. In the example filenames, replace nnnnn with the build number of the kit you actually have.

RPM installer

For the RPM installer, type:

 $rpm -ivh FirebirdCS-2.1.n-nnnnn.i686.rpm

Installing the tarball

To install the tarball, place the .tar.gz file and type:

 $tar -xzf FirebirdCS-2.1.n-nnnnn.tar.gz
 $cd FirebirdCS-2.1.n-nnnnn.i686
 $./install.sh

What the Linux install scripts will do

The Linux install scripts will

  1. Attempt to stop any currently running server.
  2. Add the user firebird and the group firebird if they do not already exist.
  3. Install the software into the directory /opt/firebird and create links for libraries in /usr/lib and header files in /usr/include.
  4. Automatically add gds_db for port 3050 to /etc/services if the entry does not already exist.
  5. Automatically add localhost.localdomain and HOSTNAME to /etc/gds_hosts.equiv.
  6. a. Superserver only installs a /etc/rc.d/init.d/firebird server start script.
b. Classic server installs a /etc/xinetd.d/firebird start script or, for older inetd systems, adds an entry to the /etc/inetd file.
  1. Specific to SuSE, a new rcfirebird link is created in /usr/bin for the init.d script and an /etc/rc.config Firebird entry is created.
  2. Starts the server/service. Firebird should start automatically in runlevel 2, 3 or 5.
  3. Generates and sets a new random SYSDBA password and stores it in the file /opt/firebird/SYSDBA.password.
  4. Adds an entry to aliases.conf for the sample database, employee.fdb.

Testing your Linux installation

Step 1 - Accessing a database

In a shell:

 /opt/firebird/bin
 $./isql -user sysdba -password <password>1 

 SQL>connect localhost:employee.fdb /* this is an aliased path */

 SQL>select * from sales;
 SQL>select rdb$relation_name from rdb$relations;
 SQL>help;

 SQL>quit;

Note: 1 A password has been generated for you on installation. It can be obtained from the /opt/firebird/SYSDBA.password file, located in the Firebird root directory.

Step 2 - Creating a database

The Firebird server runs by default as the user firebird. While this has always been the recommended configuration, the previous default was for the server to run as root user. When running as root user, the server had quite wide-ranging ability to read, create and delete database files anywhere on the POSIX file system.

For security reasons, the service should have a more limited ability to read/delete and create files.

While the new configuration is better from a security perspective, it requires some special considerations to be taken into account for creating new databases:

  1. the user firebird has to have write permission to the directory in which you want to create the database.
  2. the recommended value of the DatabaseAccess attribute in the /opt/firebird/firebird.conf file should be set to None, to permit access only through entries in the aliases.conf file.
  3. use entries in aliases.conf to abstract users from the physical locations of databases.

Procedures for creating a new database can vary with different configurations but the following configuration and steps are recommended:

1. If a directory that is owned by the user firebird does not exist, then change to root user and create the directory:

 $su - root
 $mkdir -p /var/firebird
 $chown firebird:firebird /var/firebird

Create a new physical database and set up an alias entry to point to it. As root or firebird user, run the following script:

 $cd /opt/firebird/bin
 $./createAliasDB.sh test.fdb /var/firebird/test.fdb

(Usage is: createAliasDB.sh <dbname> <pathtodb>)

3. As an alternative (for step 2) the steps in the createAliasDB.sh script can be performed manually by:

 $vi /opt/firebird/aliases.conf

and add the line at the end of the file:

 test.fdb /var/firebird/test.fdb

4. Then create the database:

 $/opt/firebird/bin/isql -u sysdba -p <password>
 SQL>create database 'localhost:test.fdb';
 SQL>quit;

5. If the DatabaseAccess value in /opt/firebird/firebird.conf is set to Full or a restricted path value (for example: DatabaseAccess=/var/firebird) another alternative to step 2 is to create the physical database file directly, using the absolute path with the filename:

 $/opt/firebird/bin/isql -u sysdba -p <password>
 SQL>create database '/var/firebird/test.fdb';
 SQL>quit;

If you use this configuration, the database file can also be directly accessed without an entry in the aliases file:

 $/opt/firebird/bin/isql -u sysdba -p <password>
 SQL>connect '/var/firebird/test.fdb';
 SQL>quit;

See also:
CreateAliasDB

Utility scripts

In addition to the standard install files the following scripts are provided in the /bin directory of this release:

changeDBAPassword.sh

Change the Firebird SYSDBA user password. For Superserver, this script will change the init script /etc/rc.d/init.d/firebird to use the new password as well.

See also:
ChangeDBAPassword.sh

createAliasDB.sh

Usage: createAliasDB.sh <dbname> <dbpath> This script creates a new physical database and adds an entry in the aliases.conf file.

See also:
CreateAliasDB

fb_config

A script that can be used in makefiles to generate the required include paths and lib include directives for the installed version of Firebird. fb_config -help will give a complete list of options.

See also:
fb_config

changeGdsLibraryCompatibleLink.sh

Classic only - Change the client library link for libgds.so between the multithreaded libfbclient.so and the single threaded libfbembed.so library that allows an embedded direct open of the database file. For compatibility with previous installs, libgds.so by default points to libfbembed.so.

See also:
ChangeGDSLibraryCompatibleLink

Linux server tips

Embedded or direct access to database files

The Classic install offers an embedded mode of access that allows programs to open database files directly. To operate in this mode, a database-enabled user requires privileged access to some of the Firebird configuration and status files.

Now that it is the firebird user (not root) that is the default user to run the software, you need to know how to get a user into the firebird group to enable direct access to databases. It is documented in the readme notes, but the following steps should get you where you need to be.

To add a user (e.g. skywalker) to the firebird group, the root user needs to do:

 $ usermod -G firebird skywalker

Next time skywalker logs on, he can start working with Firebird databases.

To list the groups that a user belongs to, type the following at the command line:

 $ groups

OpenSuse 11.1 Idiosyncrasy: On OpenSuse 11.1 it appears the upper case -A switch (not lower case -a) is used to append a group to the groups list that the user belongs to.
We're not attempting to give you a tutorial on Linux shell syntax here. Always consult the documentation for your own OS platform and version to check the latest idioms of its syntax.

Uninstalling on Linux

If you need to uninstall, do it as root user. The following examples use Classic server but the same holds true for Superserver by replacing the CS with SS.

Uninstalling an RPM package

For rpm packages:

 $rpm -e FirebirdCS-2.1.n

Uninstalling a tarball installation

for the .tar.gz install:

 $/opt/firebird/bin/uninstall.sh

See also:
Download and install Firebird: POSIX platforms
Installing IBExpert under Linux
Firebird Superserver manager: Linux systems?
Tracking down crashes on Linux
Choosing a file system on Linux for Firebird

back to top of page
<< Installing on POSIX platforms | Firebird 2 Migration & Installation | MAC OSX >>