Install FireBird Database on CentOS 8 - CentLinux

Latest

Tuesday, 12 May 2020

Install FireBird Database on CentOS 8

Install FireBird Database on CentOS 8

In this article, you will learn how to install FireBird database on CentOS 8 server. It is a complete step by step guide to install FireBird including resolution of each installation error.

 

This Article Provides:

 

What is FireBird Database? :

FireBird is an open source RDBMS (Relational Database Management System). FireBird is originally a fork of Borland's open source edition of Interbase in 2000, but since then FireBird code has been changed a lot.

Furthermore, you should be aware that Firebird 3 won't open databases that were created by older versions. So before taking down your existing setup, you should back up all your databases in order that you can restore them later under Firebird 3.

 

FireBird Database Features:

Some of the notable features of FireBird database are:

  • Full support for stored procedures and triggers
  • Referential integrity
  • Full ACID compliant transactions
  • Support for External Functions
  • Careful writes - fast recovery, no need for transaction logs
  • Incremental backups
  • Full cursor implementation in PSQL
  • Third-party tools, including GUI administrative tools and replication tools

 

Environment Specification:

We are using a KVM based CentOS 8 virtual machine with following specification.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.1
  • Hostname – firebird-02.centlinux.com
  • IP Address - 192.168.116.206 /24

 

Update CentOS 8 Software Packages:

Connect with firebird-02.centlinux.com as root user by using a ssh tool.

Update CentOS 8 software packages by using the dnf command.

[root@firebird-02 ~]# dnf update -y
...
Upgraded:
  coreutils-8.30-6.el8_1.1.x86_64
  coreutils-common-8.30-6.el8_1.1.x86_64
  firewalld-0.7.0-5.el8_1.1.noarch
  firewalld-filesystem-0.7.0-5.el8_1.1.noarch
  kernel-tools-4.18.0-147.8.1.el8_1.x86_64
  kernel-tools-libs-4.18.0-147.8.1.el8_1.x86_64
  kexec-tools-2.0.19-12.el8_1.2.x86_64
  libsss_autofs-2.2.0-19.el8_1.1.x86_64
  libsss_certmap-2.2.0-19.el8_1.1.x86_64
  libsss_idmap-2.2.0-19.el8_1.1.x86_64
  libsss_nss_idmap-2.2.0-19.el8_1.1.x86_64
  libsss_sudo-2.2.0-19.el8_1.1.x86_64
  nftables-1:0.9.0-14.el8_1.1.x86_64
  openssl-1:1.1.1c-2.el8_1.1.x86_64
  openssl-libs-1:1.1.1c-2.el8_1.1.x86_64
  python3-firewall-0.7.0-5.el8_1.1.noarch
  python3-perf-4.18.0-147.8.1.el8_1.x86_64
  python3-rpm-4.14.2-26.el8_1.x86_64
  rpm-4.14.2-26.el8_1.x86_64
  rpm-build-libs-4.14.2-26.el8_1.x86_64
  rpm-libs-4.14.2-26.el8_1.x86_64
  rpm-plugin-selinux-4.14.2-26.el8_1.x86_64
  rpm-plugin-systemd-inhibit-4.14.2-26.el8_1.x86_64
  sssd-client-2.2.0-19.el8_1.1.x86_64
  sssd-common-2.2.0-19.el8_1.1.x86_64
  sssd-kcm-2.2.0-19.el8_1.1.x86_64
  sssd-nfs-idmap-2.2.0-19.el8_1.1.x86_64
  systemd-239-18.el8_1.5.x86_64
  systemd-libs-239-18.el8_1.5.x86_64
  systemd-pam-239-18.el8_1.5.x86_64
  systemd-udev-239-18.el8_1.5.x86_64

Installed:
  kernel-4.18.0-147.8.1.el8_1.x86_64
  kernel-core-4.18.0-147.8.1.el8_1.x86_64
  kernel-modules-4.18.0-147.8.1.el8_1.x86_64

Removed:
  kernel-4.18.0-80.el8.x86_64              kernel-core-4.18.0-80.el8.x86_64
  kernel-modules-4.18.0-80.el8.x86_64

Complete!

 

Install LibTomMath Library on CentOS 8:

FireBird database requires LibTomMath library, a free open source portable number theoretic multiple-precision integer library.

LibTomMath package is not available in standard yum repositories. Therefore, we need to install the EPEL (Extra Packages for Enterprise Linux) first.

[root@firebird-02 ~]# dnf install epel-release -y
...
Installed:
  epel-release-8-8.el8.noarch

Complete!

Build cache for EPEL and other yum repositories.

[root@firebird-02 ~]# dnf makecache
CentOS-8 - AppStream                            4.0 kB/s | 4.3 kB     00:01
CentOS-8 - Base                                 3.3 kB/s | 3.9 kB     00:01
CentOS-8 - Extras                               1.7 kB/s | 1.5 kB     00:00
Extra Packages for Enterprise Linux Modular 8 - 4.1 kB/s | 6.6 kB     00:01
Extra Packages for Enterprise Linux 8 - x86_64  5.5 kB/s | 6.7 kB     00:01
Metadata cache created.

We can now install LibTomMath library from EPEL repository by using dnf command.

[root@firebird-02 ~]# dnf install -y libtommath
...
Installed:
  libtommath-1.1.0-1.el8.x86_64

Complete!

 

Install FireBird Database on CentOS 8:

FireBird 3.0.5 is the latest stable release that is available at the time of this writing. Downloads are available for various platforms in this page, so you can download FireBird for your respective operating system.

01-install-firebird-database-centos-8-download-page

Copy the link of the FireBird compressed tarball and download it by using wget command.

[root@firebird-02 ~]# wget https://github.com/FirebirdSQL/firebird/releases/download/R3_0_5/Firebird-3.0.5.33220-0.amd64.tar.gz
--2020-05-11 01:55:06--  https://github.com/FirebirdSQL/firebird/releases/download/R3_0_5/Firebird-3.0.5.33220-0.amd64.tar.gz
Resolving github.com (github.com)... 140.82.113.3
Connecting to github.com (github.com)|140.82.113.3|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://github-production-release-asset-2e65be.s3.amazonaws.com/54005538/16a06c80-331a-11ea-92da-1c925f600370?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200510%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200510T205508Z&X-Amz-Expires=300&X-Amz-Signature=2a96bb0157c8e155b02158bedc67321caa798088b10c76497fdf998eb65f5d8d&X-Amz-SignedHeaders=host&actor_id=0&repo_id=54005538&response-content-disposition=attachment%3B%20filename%3DFirebird-3.0.5.33220-0.amd64.tar.gz&response-content-type=application%2Foctet-stream [following]
--2020-05-11 01:55:07--  https://github-production-release-asset-2e65be.s3.amazonaws.com/54005538/16a06c80-331a-11ea-92da-1c925f600370?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20200510%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20200510T205508Z&X-Amz-Expires=300&X-Amz-Signature=2a96bb0157c8e155b02158bedc67321caa798088b10c76497fdf998eb65f5d8d&X-Amz-SignedHeaders=host&actor_id=0&repo_id=54005538&response-content-disposition=attachment%3B%20filename%3DFirebird-3.0.5.33220-0.amd64.tar.gz&response-content-type=application%2Foctet-stream
Resolving github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)... 52.217.18.156
Connecting to github-production-release-asset-2e65be.s3.amazonaws.com (github-production-release-asset-2e65be.s3.amazonaws.com)|52.217.18.156|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8561290 (8.2M) [application/octet-stream]
Saving to: âFirebird-3.0.5.33220-0.amd64.tar.gzâ

Firebird-3.0.5.3322 100%[===================>]   8.16M   663KB/s    in 18s

2020-05-11 01:55:27 (466 KB/s) - âFirebird-3.0.5.33220-0.amd64.tar.gzâ saved [8561290/8561290]

Extract FireBird tarball using tar command.

[root@firebird-02 ~]# tar xvf Firebird-3.0.5.33220-0.amd64.tar.gz
Firebird-3.0.5.33220-0.amd64/
Firebird-3.0.5.33220-0.amd64/install.sh
Firebird-3.0.5.33220-0.amd64/buildroot.tar.gz
Firebird-3.0.5.33220-0.amd64/manifest.txt

We can install FireBird database by using install.sh script. But during FireBird installation, we have encountered following errors.

/opt/firebird/bin/gsec: error while loading shared libraries: libtommath.so.0: cannot open shared object file: No such file or directory

and

/opt/firebird/bin/gsec: error while loading shared libraries: libncurses.so.5: cannot open shared object file: No such file or directory

The reason behind the above errors is that the FireBird is looking for older versions of these libraries, while in CentOS 8 the new versions of these libraries has been installed.

To overcome these issues, we simply create the softlinks to the new version of these shared libraries.

[root@firebird-02 ~]# ln -s /usr/lib64/libtommath.so.1.1.0 /usr/lib64/libtommath.so.0
[root@firebird-02 ~]# ln -s /usr/lib64/libncurses.so.6.1 /usr/lib64/libncurses.so.5

Now, go to FireBird setup directory and start installation.

[root@firebird-02 ~]# cd Firebird-3.0.5.33220-0.amd64/
[root@firebird-02 Firebird-3.0.5.33220-0.amd64]# ./install.sh

Firebird 3.0.5.33220-0.amd64 Installation

Press Enter to start installation or ^C to abort
Extracting install data
Updated /etc/services
Please enter new password for SYSDBA user: Str0ngPa55word
Install completed

Installer creates a systemd service for FireBird database.  The FireBird database engine is run in Superserver mode by default. However, you can customize it by using /etc/firebird/firebird.conf configuration file.  For more basic information about Firebird database, we recommend you to read The Firebird Book Second Edition: Volume 1: Firebird Fundamentals by Helen Borrie.

Check the status of the FireBird database service.

[root@firebird-02 Firebird-3.0.5.33220-0.amd64]# cd
[root@firebird-02 ~]# systemctl status firebird-superserver.service
â firebird-superserver.service - Firebird Database Server ( SuperServer )
   Loaded: loaded (/usr/lib/systemd/system/firebird-superserver.service; enabl>
   Active: active (running) since Mon 2020-05-11 02:07:57 PKT; 2min 21s ago
  Process: 27710 ExecStart=/opt/firebird/bin/fbguard -pidfile /var/run/firebir>
 Main PID: 27712 (firebird)
    Tasks: 4 (limit: 5916)
   Memory: 2.0M
   CGroup: /system.slice/firebird-superserver.service
           ââ27711 /opt/firebird/bin/fbguard -pidfile /var/run/firebird/firebi>
           ââ27712 /opt/firebird/bin/firebird

May 11 02:07:57 firebird-02.centlinux.com systemd[1]: Starting Firebird Databa>
May 11 02:07:57 firebird-02.centlinux.com systemd[1]: firebird-superserver.ser>
May 11 02:07:57 firebird-02.centlinux.com systemd[1]: firebird-superserver.ser>
May 11 02:07:57 firebird-02.centlinux.com systemd[1]: Started Firebird Databas>

Installer does not include the FireBird binaries directory in the PATH environmental variable. We need to do it by ourselves.

Edit .bash_profile of root user.

[root@firebird-02 ~]# vi ~/.bash_profile

Locate PATH variable and update it as follows.

PATH=$PATH:$HOME/bin:/opt/firebird/bin/

Save and exit.

We need to execute .bash_profile once, to update PATH environment variable for current session.

[root@firebird-02 ~]# source ~/.bash_profile

Check version of FireBird database.

[root@firebird-02 ~]# firebird -z
Firebird TCP/IP server version LI-V3.0.5.33220 Firebird 3.0

If you are planning to access your FireBird database server across the network, then you have to enable the FireBird default service port in Linux firewall.

[root@firebird-02 ~]# firewall-cmd --permanent --add-port=3050/tcp
success
[root@firebird-02 ~]# firewall-cmd --reload
success

FireBird database has been installed on CentOS 8 server.

 

FireBird Basic Commands:

Connect to sample FireBird database i.e. employee by using isql command as sysdba user.

[root@firebird-02 ~]# isql -u sysdba -p Str0ngPa55word employee
Database: employee, User: SYSDBA
SQL>

We can list database users by using following command.

SQL> show users;
Users in the database
  1 #SYSDBA

Currently, we have only one user in the database, that is why the command provided a single user list.

Check the version of iSQL and FireBird database.

SQL> show version;
ISQL Version: LI-V3.0.5.33220 Firebird 3.0
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-V3.0.5.33220 Firebird 3.0"
on disk structure version 12.0

List down the tables in the employee database.

SQL> show tables;
       COUNTRY                                CUSTOMER
       DEPARTMENT                             EMPLOYEE
       EMPLOYEE_PROJECT                       JOB
       PROJECT                                PROJ_DEPT_BUDGET
       SALARY_HISTORY                         SALES

Query data from COUNTRY table by using SELECT statement.

SQL> select * from country;

COUNTRY         CURRENCY
=============== ==========
USA             Dollar
England         Pound
Canada          CdnDlr
Switzerland     SFranc
Japan           Yen
Italy           Euro
France          Euro
Germany         Euro
Australia       ADollar
Hong Kong       HKDollar
Netherlands     Euro
Belgium         Euro
Austria         Euro
Fiji            FDollar
Russia          Ruble
Romania         RLeu

Our CentOS 8 based FireBird database has been working fine.

We have successfully installed FireBird database on CentOS 8 server. If you feel difficuly understanding the CentOS 8 commands provided in this article, we recommend you should attend RHEL 8/CentOS 8 Linux System Administration (RHCSA) Level I training at Udemy.

No comments:

Post a Comment