Setting up Firebird on Ubuntu Linux
This article describes the process of installing and running Firebird on Ubuntu Linux. It should also work without modification in the Debian GNU/Linux distribution (testing version named Wheezy and unstable version named Sid). Ubuntu is based on Debian core packages. Installing software with Ubuntu is very straightforward and Firebird is no exception. This guide is based on Ubuntu 12.04 LTS “ The Precise Pangolin ” but it can be used with a current supported stable release.
The version of Firebird packaged with Ubuntu “ Precise Pangolin ” is 2.5.1 and is included by default . For stable Ubuntu releases there is a Firebird stable ppa repository from where you can install the stable versions latest LTS and current stable .
With administrator privileges on the target machine, issue the following command:
$ sudo su # apt-get install firebird2.5-superclassic
Apt’s dependency tracking will automatically propose all the packages required for a complete installation with the following output:
Reading package lists. Done Building dependency tree Reading state information. Done The following extra packages will be installed: firebird2.5-classic-common firebird2.5-common firebird2.5-common-doc firebird2.5-server-common libfbclient2 libfbembed2.5 libib-util Suggested packages: firebird2.5-doc The following NEW packages will be installed: firebird2.5-classic-common firebird2.5-common firebird2.5-common-doc firebird2.5-server-common firebird2.5-superclassic libfbclient2 libfbembed2.5 libib-util 0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded. Need to get 3,370 kB of archives. After this operation, 14.9 MB of additional disk space will be used. Do you want to continue [Y/n]? Y
The packages will then download and install on the target machine. A new user “ firebird ” will be created to run the server, but the server will not yet be started by default:
Selecting previously unselected package firebird2.5-common-doc. Unpacking firebird2.5-common-doc (from . /firebird2.5-common-doc_2.5.2~svn+54698.ds4-1_all.deb) . Selecting previously unselected package firebird2.5-common. Unpacking firebird2.5-common (from . /firebird2.5-common_2.5.2~svn+54698.ds4-1_all.deb) . Selecting previously unselected package libfbclient2:amd64. Unpacking libfbclient2:amd64 (from . /libfbclient2_2.5.2~svn+54698.ds4-1_amd64.deb) . Selecting previously unselected package firebird2.5-server-common. Unpacking firebird2.5-server-common (from . /firebird2.5-server-common_2.5.2~svn+54698.ds4-1_amd64.deb) . Selecting previously unselected package libfbembed2.5. Unpacking libfbembed2.5 (from . /libfbembed2.5_2.5.2~svn+54698.ds4-1_amd64.deb) . Selecting previously unselected package libib-util:amd64. Unpacking libib-util:amd64 (from . /libib-util_2.5.2~svn+54698.ds4-1_amd64.deb) . Selecting previously unselected package firebird2.5-classic-common. Unpacking firebird2.5-classic-common (from . /firebird2.5-classic-common_2.5.2~svn+54698.ds4-1_amd64.deb) . Selecting previously unselected package firebird2.5-superclassic. Unpacking firebird2.5-superclassic (from . /firebird2.5-superclassic_2.5.2~svn+54698.ds4-1_amd64.deb) . Setting up firebird2.5-common-doc (2.5.2~svn+54698.ds4-1) . Setting up firebird2.5-common (2.5.2~svn+54698.ds4-1) . Setting up libfbclient2:amd64 (2.5.2~svn+54698.ds4-1) . Setting up firebird2.5-server-common (2.5.2~svn+54698.ds4-1) . Setting up libfbembed2.5 (2.5.2~svn+54698.ds4-1) . Setting up libib-util:amd64 (2.5.2~svn+54698.ds4-1) . Setting up firebird2.5-classic-common (2.5.2~svn+54698.ds4-1) . Setting up firebird2.5-superclassic (2.5.2~svn+54698.ds4-1) . Created default security2.fdb * Firebird 2.5 superclassic server not running * Not starting Firebird 2.5 superclassic server * Use `dpkg-reconfigure firebird2.5-superclassic' to enable
If you want Firebird to start automatically, run dpkg-reconfigure on the package and click the Yes button. Then you will be asked again for the SYSDBA password:
# dpkg-reconfigure firebird2.5-superclassic
If all goes well, Firebird Superserver will be started:
* Firebird 2.5 superclassic server not running * Starting Firebird 2.5 superclassic server. [ OK ] * Firebird 2.5 superclassic server already running
If you’re a seasoned Unix person but new to Ubuntu, you might be wondering where all the Firebird files are residing in the directory hierarchy. To see where all the files were installed by Apt, simply do:
# dpkg -L firebird2.5-classic-common /. /usr /usr/share /usr/share/doc /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/firebird2.5-classic-common /usr/lib /usr/lib/firebird /usr/lib/firebird/2.5 /usr/lib/firebird/2.5/UDF /usr/lib/firebird/2.5/UDF/fbudf.so /usr/lib/firebird/2.5/UDF/ib_udf.so /usr/sbin /usr/sbin/fb_lock_print /usr/bin /usr/bin/fbsvcmgr /usr/bin/gsec /usr/bin/gpre /usr/bin/gbak /usr/bin/gdef /usr/bin/fbstat /usr/bin/fbtracemgr /usr/bin/nbackup /usr/bin/isql-fb /usr/bin/qli /usr/bin/gfix /usr/share/doc/firebird2.5-classic-common
As mentioned, a new user “ firebird ” is created on the target machine.
Now you can switch to the firebird user with the su command if required.
Install the examples and dev files:
# apt-get install firebird2.5-examples firebird2.5-dev
The example databases will wind up in the directory tree /usr/share/doc/firebird2.5-examples/examples/empbuild/ .
Now you can test your Firebird installation by connecting to an example database. Decompress the employee.fdb example database:
# cd /usr/share/doc/firebird2.5-examples/examples/empbuild/ # gunzip employee.fdb.gz # sudo chown firebird.firebird employee.fdb # mv employee.fdb /var/lib/firebird/2.5/data/
Fire up the interactive shell and at the SQL> prompt connect to the employee database using the connect statement:
isql-fb SQL> connect "localhost:/var/lib/firebird/2.5/data/employee.fdb" user 'SYSDBA' password 'SYSDBApassword
';
(replacing SYSDBApassword with the correct password for SYSDBA !)
When you manage to successfully connect to the database you will see the message:
Database: "localhost:/var/lib/firebird/2.5/data/employee.fdb", User: SYSDBA SQL>
Now, from the SQL> prompt, feel free to browse around the employee database. For instance, you can list the tables and check the server version:
SQL> show tables; COUNTRY CUSTOMER DEPARTMENT EMPLOYEE EMPLOYEE_PROJECT JOB PROJECT PROJ_DEPT_BUDGET SALARY_HISTORY SALES SQL> show version; SQL Version: LI-V2.5.2.26508 Firebird 2.5 Server version: Firebird/linux AMD64 (access method), version "LI-V2.5.2.26508 Firebird 2.5" Firebird/linux AMD64 (remote server), version "LI-V2.5.2.26508 Firebird 2.5/tcp (Lorkstation64)/P12" Firebird/linux AMD64 (remote interface), version "LI-V2.5.2.26508 Firebird 2.5/tcp (Lorkstation64)/P12" on disk structure version 11.2 SQL> quit;
If you want a GUI admin tool, you might check FlameRobin, which is included in the Ubuntu repository. It can be installed with a simple:
# apt-get install flamerobin
If you get an error message like “ Statement failed, SQLCODE = -551 no permission for read-write access to database /var/lib/firebird/2.5/data/employee.fdb ”, then the server process doesn’t have read or write access to the database file. Change the ownership of the database to the user firebird with:
# cd /var/lib/firebird/2.5/data/ # chown firebird:firebird employee.fdb
If you’ve made it this far, your Firebird installation on Ubuntu has been a success. Have a nice day!