Install FirebirdSQL 2.5.8 on AWS EC2 CentOS 7

☑  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.

☑  Make sure the AWS EC2 firewall ("security group") allows you to SSH in but no one else.

☑  Display CPU information to confirm what you have launched:
cat /proc/cpuinfo 

☑  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

☑  Check the version of glibc because there is a minimum version required for running firebirdsql.

ldd --version

reports:


ldd (GNU libc) 2.17


☑  Assuming you have launched a machine you are happy to keep using, be sure to change the password for your root account on Linux!

☑  Sanity check the name of the package you want to install by looking at all available options:

yum list available | grep firebird

☑  Consider reading the documentation especially the Quick Start Guide.


☑  Install firebird-superserver

sudo yum install firebird-superserver.x86_64


☑  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


☑  Make sure you know where your firebirdsql binary (executable) lives by searching for the file named fbserver:

sudo find -name fbserver


Once you know where it is, you can start it and move its process to the background with this line:

sudo ./usr/sbin/fbserver &

☑  See whether firebird server is running.

top -b -n1 | grep fb


☑  Immediately reset the Firebird SQL default password :

 ./usr/sbin/gsec -user sysdba -password masterkey


☑  Configure your aliases

sudo vi /etc/firebird/aliases.conf

☑  Limit access to the listed aliases

sudo vi /etc/firebird/firebird.conf


☑  Open port 3050 ( or whatever custom port you put in firebird.conf ) in the AWS Security Group ( firewall )

☑  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.

☑  Create a CentOS user account
  
sudo adduser doris
sudo passwd doris     # define the password for the new user

☑  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


☑  Create a separate private key file for Doris. 

Follow steps here to make PEM file 


☑  Copy the .pem file to a Windows machine

☑  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

☑  Make arrangements to give the username 'doris', password and .ppk file to the actual human person, Doris!

☑  Reminder: you might need to grant Doris access through port 22 in the AWS firewall "security group" for the EC2 instance. 


☑  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


☑  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 )   

☑  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



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. 










Comments

Popular Posts