How-To Sketch

Install FirebirdSQL 2.5.8 on AWS EC2 CentOS 7

Ann Lynnworth Jan 2019

article image
  1. Launch an EC2 instance from the AWS Marketplace -- look for "CentOS 7 (x86_64) - with Updates HVM" which is supported by CentOS, here. I used a t2.micro instance.
  2. Make sure the AWS EC2 firewall ("security group") allows you to SSH in but no one else.
  3. Display CPU information to confirm what you have launched:
     cat /proc/cpuinfo
  4. Check the kernel version to make sure it is high enough for use with the version of Firebird SQL that you want to use:
    uname -or

    reports:

    3.10.0-862.3.2.el7.x86_64 GNU/Linux
  5. Check the version of glibc because there is a minimum version required for running firebirdsql.
    ldd --version

    reports:

    ldd (GNU libc) 2.17
  6. Assuming you have launched a machine you are happy to keep using, be sure to change the password for your root account on Linux!
  7. Sanity check the name of the package you want to install by looking at all available options:
    yum list available | grep firebird
  8. Consider reading the documentation especially the Quick Start Guide.
  9. Install firebird-superserver
    sudo yum install firebird-superserver.x86_64
  10. Find out where your files are!
    cd /
    sudo find -name firebird
    ./run/firebird
    ./etc/logrotate.d/firebird
    ./etc/firebird
    ./var/lib/firebird
    ./var/log/firebird
    ./usr/lib64/firebird
  11. Make sure you know where your firebirdsql binary (executable) lives by searching for the file named fbserver:
    sudo find -name fbserver
  12. Once you know where it is, you can start it and move its process to the background with this line:
    sudo ./usr/sbin/fbserver &
  13. See whether firebird server is running.
    top -b -n1 | grep fb
  14. Immediately reset the Firebird SQL default password:
    ./usr/sbin/gsec -user sysdba -password masterkey
  15. Configure your aliases
    sudo vi /etc/firebird/aliases.conf
  16. Limit access to the listed aliases
    sudo vi /etc/firebird/firebird.conf
  17. Open port 3050 ( or whatever custom port you put in firebird.conf ) in the AWS Security Group (firewall)
  18. Use a client such as FlameRobin or IBObjects Utility to create a database using your alias syntax. If you are going to use an attached volume to store data, see AWS Instructions to format and mount the extra volume.
    sudo file -s /dev/xvdb
    sudo mkfs -t ext4 /dev/xvdb
    sudo mkdir /data
    sudo mount /dev/xvdb /data
    


How to give SSH access to a Firebird admin user

The scenario is that we want to have a non-root user account for someone who can login over SSH using Putty and then use command-line syntax to run wget and gbak commands.

For the sake of this example, the user name will be doris and the group name will be firebirdgroup . Note that the user named firebird was automatically created by the yum install process above.

  1. Create a CentOS user account
    sudo adduser doris
    sudo passwd doris     # define the password for the new user
    
  2. Create a CentOS group and put the right people into it.
    sudo groupadd firebirdgroup
    sudo usermod -a -G firebirdgroup doris
    sudo usermod -a -G firebirdgroup firebird
    sudo usermod -a -G firebirdgroup centos
    
  3. Create a separate private key file for Doris. Follow steps here to make PEM file
  4. Copy the .pem file to a Windows machine
  5. Convert the .pem file to .ppk format so it can be used with PuTTY on Windows. Follow steps under "Convert Your Private Key Using PuTTYgen" here on docs.aws
  6. Make arrangements to give the username 'doris', password and .ppk file to the actual human person, Doris!
  7. Reminder: you might need to grant Doris access through port 22 in the AWS firewall "security group" for the EC2 instance.
  8. Adjust permissions on the /data folder so that Doris will be able to create new files and execute bash scripts. (Thanks for the 775 Info)
    cd /
    ls -l ./data/*.fdb    # confirm that you see, or will see, fdb files here
    sudo chmod  775  ./data
    sudo chmod  -R 775  ./data
    
  9. Configure PuTTY and login with a separate session as Doris. ( Detailed instructions are under 'To connect to your instance using PuTTY' on docs.aws.amazon.com)
  10. Make sure that files can be written in the /data folder.
    cd /data
    vi test.txt
    # insert some text, then attempt to write the file
    rm test.txt  # delete it after proving that Doris could write it
    
  11. At this point, it should be possible for Doris to use wget to download a file using a time-limited HTTPS link to an .fbk file stored on an S3 bucket, and then to use gbak to restore that .fbk to a real Firebird .fdb database. If this sounds interesting, you could look up AWS S3 and CloudBerry Explorer, and yum install wget....


You can try controlling the firebird service using

systemctl start firebird-superserver

This syntax did not work for me at all. I had started with the instructions at mangolassi.it but had no luck. I did not have a /tmp/firebird directory at all. I could not get the service to respond to a start command. The error message was "unit not found" with no further clues that I could find. /var/log/syslog did not exist on my system.

These commands did not give errors:

sudo systemctl enable firebird-superserver
sudo systemctl start firebird-superserver

BUT checking top indicated that fbserver was NOT running, and firebird clients could NOT connect.

Article Keywords:

Company publishing this blog in 2022: HREF Tools Corp. based in Wilmington, Delaware USA Privacy