Firebird 2.5 Database Server on FreeBSD 11.2 - firebird

I install a Firebird database server (ver. 2.5) according to the instructions on https://www.howtoforge.com/the-perfect-database-server-firebird-2.5-and-freebsd-8.1 and I get this message "Please do not build firebird as 'root' because this may cause conflicts with SysV semaphores of running services".
Trying to compile as normal user failed because I do not have access to write in this directory.
After Firebird installation as root, when I try to create local database I got error:
# isql-fb
Use CONNECT or CREATE DATABASE to specify a database
SQL> CREATE DATABASE '/test/my.fdb';
Bus error (core dumped)
Can someone help me please?

The easiest way would be to install the package as root user, for example:
# pkg install firebird25-server
If you would like to use the ports try this:
# cd /usr/ports/databases/firebird25-server
# make install clean
In either case, the message you get will be something like this (you could ignore it to continue with the installation, just need to wait 5 seconds and then it will proceed):
> pkg install firebird25-server
Updating FreeBSD repository catalogue...
FreeBSD repository is up to date.
Updating poudriere repository catalogue...
poudriere repository is up to date.
All repositories are up to date.
Updating database digests format: 100%
The following 2 package(s) will be affected (of 0 checked):
New packages to be INSTALLED:
firebird25-server: 2.5.8_1 [FreeBSD]
firebird25-client: 2.5.8_1 [FreeBSD]
Number of packages to be installed: 2
The process will require 22 MiB more space.
5 MiB to be downloaded.
Proceed with this action? [y/N]: y
[1/2] Fetching firebird25-server-2.5.8_1.txz: 100% 2 MiB 2.4MB/s 00:01
[2/2] Fetching firebird25-client-2.5.8_1.txz: 100% 3 MiB 943.7kB/s 00:03
Checking integrity... done (0 conflicting)
[1/2] Installing firebird25-client-2.5.8_1...
[1/2] Extracting firebird25-client-2.5.8_1: 100%
[2/2] Installing firebird25-server-2.5.8_1...
===> Creating groups.
Creating group 'firebird' with gid '90'.
===> Creating users
Creating user 'firebird' with uid '90'.
###############################################################################
** IMPORTANT **
Keep in mind that if you build firebird server as 'root', this may cause
conflicts with SysV semaphores of running services.
If you want to cancel it, press ctrl-C now if you need check some things
before of build it.
###############################################################################
Here sleeps for 5 seconds and then continues:
[2/2] Extracting firebird25-server-2.5.8_1: 100%
Message from firebird25-server-2.5.8_1:
###############################################################################
Firebird was installed.
1) Support for Super Server has been added
2) Before start the server ensure that the following line exists in /etc/services:
gds_db 3050/tcp #InterBase Database Remote Protocol
3) If you use inetd (Classic Server) then add the following line to /etc/inetd.conf
gds_db stream tcp nowait firebird /usr/local/sbin/fb_inet_server fb_inet_server
And finally restart inetd.
4) If you want to use SuperClassic Server then you must add the following lines
to /etc/rc.conf file.
firebird_enable="YES"
firebird_mode="superclassic"
5) If you want to use Super Server then you must add the following lines to
/etc/rc.conf file.
firebird_enable="YES"
firebird_mode="superserver"
Note: Keep in mind that you only can add one of them but never both modes on
the same time
6) It is STRONGLY recommended that you change the SYSDBA
password with:
# gsec -user SYSDBA -pass masterkey
GSEC> modify SYSDBA -pw newpassword
GSEC> quit
before doing anything serious with Firebird.
7) See documentation in /usr/local/share/doc/firebird/ for more information.
8) Some firebird tools were renamed for avoid conflicts with some other ports
/usr/local/bin/isql -> /usr/local/bin/isql-fb
/usr/local/bin/gstat -> /usr/local/bin/fbstat
/usr/local/bin/gsplit -> /usr/local/bin/fbsplit
9) Enjoy it ;)
To start it just add to /etc/rc.conf as indicated in the message in point 4 or 5, for example:
firebird_enable="YES"
firebird_mode="superserver"
To compile it as non-root an easy way could be to change the owner of the port dir to your user, for example:
# chown -R foo:foo /usr/ports/databases/firebird25-server
Then as your user cd to the port and build by typing only make:
$ cd /usr/ports/databases/firebird25-server
$ make
Then switch back to root to install the port:
# make install

Here is a procedure I used to get around this issue in the past (based on FreeBSD 10.2). This is for firebird client, but should work similarly for server. This procedure assumes sudo is set up for the user performing the installation.
cd /usr/ports
sudo chown non-root-user-name distfiles (was root)
cd /usr/ports/databases
sudo chown non-root-user-name firebird25-client (was root)
cd /usr/ports/databases/firebird25-client
make -DPACKAGE_BUILDING (Note: No sudo is used here! This process can take a long time.)
(Note: You may be required to supply root password on this step)
make install clean (Note: You may be required to supply root password on this step)
cd /usr/ports
sudo chown root distfiles
cd /usr/ports/databases
sudo chown root firebird25-client
As for FreeBSD 11.x and Firebird...I was seeing the same "Bus error". I have concluded for now (perhaps incorrectly) that Firebird is not yet compatible with FreeBSD 11.x. If you revert to FreeBSD 10.x, you should not see this problem.

Related

Citus 10.2 not starting an instance of PostgreSQL

I'm using RHEL 8.4 and I followed the installation instruction at Set up a single-node Citus cluster on your own Linux machine from RPM packages..
Step 1 and 2 (Install PostgreSQL 14 and the Citus extension and Initialize the Cluster) went through without any issues.
But When I tried (Step 3: Start the database server)
pg_ctl -D citus -o "-p 9700" -l citus_logfile start
I got the following error in terminal
waiting for server to start.... stopped waiting
pg_ctl: could not start server
Examine the log output.
The log output
FATAL: could not access file "citus": No such file or directory
LOG: database system is shut down
I do have a directory 'citus' in postgres user's home directory with all required files in it along with postgresql.conf
Kindly help.
It appears you ran into one of 2 issues:
Possible issue #1:
You did not successfully install citus package and the citus.so file is missing.
Can you see the file /usr/pgsql-14/lib/citus.so that should be installed via the package citus102_14?
If that is not the case, you should figure out why the package is not installed.
Possible issue #2
You do not run pg_ctl command in the home directory of postgres user.
I was getting the same error. I am using the Postgres compiled from the source file. Thus, instead of
sudo apt-get -y install postgresql-14-citus-10.2
I compiled the source of the Citus from Github and specified the path to location of my Postgres while configuring as:
git clone https://github.com/citusdata/citus.git
cd citus
./configure --prefix=/usr/local/pgsql/
make
sudo make install
I do not get an error during pg_ctl start and I can load extension as CREATE EXTENSION citus;.

How to install Kong (https://konghq.com/) on Ubuntu 20.04?

I tried to install using the instructions available on https://docs.konghq.com/install/ubuntu/ and also using snap store but I get the same error. I don't know if it's relevant or not but I am using postgres-12.2 which comes pre-installed with Ubuntu-20.04. The directory structure in postgres-12.2 is different from the earlier ones.
error: cannot perform the following tasks:
- Run install hook of "kong" snap if present (run hook "install":
-----
The files belonging to this database system will be owned by user "snap_daemon".
This user must also own the server process.
The database cluster will be initialized with locale "C.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".
Data page checksums are disabled.
creating directory /var/snap/kong/172/postgresql/10/main ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default timezone ... Asia/Kolkata
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok
WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
Success. You can now start the database server using:
/snap/kong/172/usr/lib/postgresql/10/bin/pg_ctl -D /var/snap/kong/172/postgresql/10/main -l logfile start
createuser: could not connect to database postgres: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/snap/kong/common/sockets/.s.PGSQL.5432"?
-----)```
[1]: https://i.stack.imgur.com/2pzKn.png
Finally, it was done after a lot of research and endless tries. If you face the same issue, follow the following order(For Ubuntu 20.04 only):
Better not install using apt-get or snap(at least until a snap for Ubuntu 20.04 is available). Install using the .deb package available at https://docs.konghq.com/install/ubuntu/#packages. After downloading the package, navigate to the Downloads folder in the terminal and run the following commands to install:
sudo apt-get install openssl libpcre3 procps perl
sudo dpkg -i kong-2.0.4.*.deb
Don't know what the first command is installing but it is suggested to do so as per the official documentation of KONG.
In another terminal, create a new user and database in postgres for KONG connectivity.
sudo -i -u postgres
psql
CREATE USER kong;
CREATE DATABASE kong OWNER kong;
Back to the terminal where you were installing KONG. Try running the command:
sudo kong migrations bootstrap
If everything goes without a glitch, consider yourself lucky and go to step 5.
If there occurs an error at step 3 as:
Error: missing password, required for connect, there's more work to be done.
Run the command: kong check
This should list an error as [error] no file at: /etc/kong/kong.conf. Create a file named kong.conf in the directory /etc/kong and paste the contents available at https://github.com/Kong/kong/blob/master/kong.conf.default.
Thereafter, uncomment the lines which initialize the following variables: https://docs.konghq.com/2.0.x/configuration/#postgres-settings. If in step 2, you created user and database with different names, make sure to modify the credentials in the file kong.conf with your user(role) and database names.
[You may face trouble creating files and editing them at this step.]
Run the command
sudo kong start
to verify the correct configuration. Open your browser and navigate to http://localhost:8001. If some page opens, KONG is correctly configured on your device. Go back to the terminal and stop KONG using the command
sudo kong stop

How to install PostgreSQL on OSX Yosemite using MacPorts

I want to install PostgreSQL for a node project that I'm developing in OSX Yosemite. I use MacPorts and so tried the method described here: https://github.com/codeforamerica/ohana-api/wiki/Installing-PostgreSQL-with-MacPorts-on-OS-X
...but I get an error during step 2:
$ sudo gem install pg -- --with-pg-config=/opt/local/lib/postgresql93/bin/pg_config > ruby_error
ERROR: Error installing pg:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb --with-pg-config=/opt/local/lib/postgresql93/bin/pg_config
Using config values from /opt/local/lib/postgresql93/bin/pg_config
checking for libpq-fe.h... yes
checking for libpq/libpq-fs.h... yes
checking for pg_config_manual.h... yes
checking for PQconnectdb() in -lpq... no
checking for PQconnectdb() in -llibpq... no
checking for PQconnectdb() in -lms/libpq... no
Can't find the PostgreSQL client library (libpq)
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
...thinking that I may not need to install the pg gem since I want to work with Node and not Ruby, I moved on to the next steps. But there I run into an error during step 3.3:
$ sudo su postgres -c '/opt/local/lib/postgresql93/bin/initdb -D /opt/local/var/db/postgresql93/defaultdb'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.
...checking my /opt/local/lib/postgresql93/bin/ directory, I see both initdb and postgres. I see those lines saying Permission denied and am wondering what that's about.
Not sure how to progress. Thinking of using Postgres.app if it really is easier but not sure whether it would be better to install using MacPorts since I install most other things using MacPorts. Tips about any of my problems are appreciated!
The permissions/ownership on the directories between / and defaultdb likely need to be fixed. I think PostgreSQL can be sensitive to ownership of these, though it seems that in your case PostgreSQL simply doesn't have access to those. This is what I have for each directory.
$ ls -hlt /opt/local/var/db/
total 0
drwxr-xr-x 7 root admin 238B Jan 23 16:54 texmf
drwxr-xr-x 3 root admin 102B Dec 25 07:37 postgresql94
You could fix permissions by doing sudo chmod a+rx /opt/local/var/db/ as needed.
For the defaultdb directory itself, you should follow the instructions that you link to, which seem to have the same as I have:
sudo chown postgres:postgres /opt/local/var/db/postgresql93/defaultdb
Below are instructions adapted from my blog (though I recommend using PostgreSQL 9.4, which I now do). I've been running PostgreSQL using MacPorts since 9.1 without major problems.
1. Install PostgreSQL using MacPorts.
Of course, I assume you’ve got MacPorts up and running on your system.
sudo port install postgresql93 +perl +python27
sudo port install postgresql93-server
2. Set up PostgreSQL
I first need to initialize the database cluster and then get the server running. The following comes straight from the on-screen instructions supplied with the MacPorts port postgresql93-server.
sudo mkdir -p /opt/local/var/db/postgresql93/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql93/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql93/bin/initdb -D /opt/local/var/db/postgresql93/defaultdb'
Note that MacPorts creates a launch daemon. To load it now and to make sure it launches on system start, do:
sudo defaults write /Library/LaunchDaemons/org.macports.postgresql93-server.plist Disabled -bool false
sudo launchctl load /Library/LaunchDaemons/org.macports.postgresql93-server.plist
I then use psql for some set-up to get my database going.
sudo su - postgres
/opt/local/lib/postgresql93/bin/psql -U postgres -d template1
If you get to here, then you have PostgreSQL running on your system.
I had the same issue when attempting to run initdb, even when following the description by Ian Gow:
$ sudo su postgres -c '/opt/local/lib/postgresql94/bin/initdb -D /opt/local/var/db/postgresql94/defaultdb'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.
Turns out that user postgres cannot do anything if you try to make it run a command from within your own home directory, because in there postgres is not allowed to read its own location and hence cannot figure out any other paths, either. So the simple solution is to run cd / before any command that must be run as postgres (initdb, pg_ctl, etcetera). Afterwards, you can quickly jump back to your previous working directory using cd -.

A Guide for DeepDive Installation on Ubuntu 12.04

After having many problems installing the DeepDive project on Ubuntu, I decided to write out a detailed guide. These problems were based on the output from the test.sh file provided with the source - I can't speak to the functionality of the source just yet (just starting to learn).
Because I messed up a few configuration files, and this is still early in my Ubuntu experience, I decided to reinstall the OS (Precise 12.04) and redo everything from scratch. So, this guide is based off of a clean version of Ubuntu 12.04, after installing all relevant updates (via Update Manager) as of 20-Mar-2014.
DeepDive gives us a few prerequisites: Java, Python 2.X, PostgreSQL, and SBT. Ubuntu 12.04 already has Python 2.X, so we'll worry about the others.
We're going to go with the Ubuntu recommended OpenJDK-7. Enter the following in the terminal.
sudo apt-get update
sudo apt-get install openjdk-7-jdk icedtea-7-plugin
Now, let's install SBT. Use the following link to download the debian file or get it from the site. SBT has a dependence on curl, so first I'll install that.
sudo apt-get install curl
cd /home/tom/Downloads
sudo dpkg -i sbt.deb
Now I need to install PostgreSQL, which was by far the trickiest part. In this tutorial, I'm assuming that the computer you're working on will also be the PostgreSQL host. It's also important to note that DeepDive uses JSON, which is apparently not supported by PostgreSQL 9.1 and under. To install version 9.3, I'm going to use the instruction given by "Danny" in this StackExchange post, and just change the numbers to 9.3:
wget -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
sudo gedit /etc/apt/sources.list.d/pgdg.list
Add the following line to the file, then save and close:
deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main
Note that "precise-pgdg" corresponds to your Ubuntu version. Now let's update and install.
sudo apt-get update
sudo apt-get install pgdg-keyring postgresql-9.3
Now we'll install DeepDive. First, I need to install git, since I'm on a fresh version of the OS. Then, the instructions come from the DeepDive page. I'm going to install DeepDive in my home directory, but if you want it somewhere else, modify the cd line.
sudo apt-get install git
cd
git clone https://github.com/dennybritz/deepdive.git
cd deepdive
sbt compile
If we run the deepdive test now, it will give us some errors:
cd deepdive
./test.sh
[info] Run completed in 8 seconds, 322 milliseconds.
[info] Total number of tests run: 71
[info] Suites: completed 18, aborted 0
[info] Tests: succeeded 69, failed 2, canceled 0, ignored 0, pending 3
[info] *** 2 TESTS FAILED ***
[error] Failed tests:
[error] org.deepdive.test.integration.LogisticRegressionApp
[error] org.deepdive.test.unit.InferenceManagerSpec
[error] Error during tests:
[error] org.deepdive.test.unit.PostgresInferenceDataStoreSpec
[error] org.deepdive.test.unit.PostgresExtractionDataStoreSpec
[error] (test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 29 s, completed Mar 20, 2014 6:45:30 PM
To fix this, we need to set up PostgreSQL. First, let's activate the local and TCP/IP connections.
sudo gedit /etc/postgresql/9.3/main/postgresql.conf
Modify the following line in the "Connections and Authentication" from:
#listen addresses = 'localhost'
to:
listen_addresses = 'localhost, 127.0.0.1, 192.168.1.10'
Note that you should check your own IP address in your network connections and use that instead of mine, which ends in .10. It's also worth noting that localhost and 127.0.0.1 are equivalent. Now, you'll need to make sure the port 5432 is activated/open on your router. For me, it was something like the following: Access the router from a browser typing 192.168.1.0 -> Virtual servers -> enable port 5432 for IP Address 192.168.1.10
Now we need to set up the postgres superuser for the first time. The following line will open psql as user postgres (thanks to the Ubuntu-PostgreSQL community Wiki)
sudo -u postgres psql postgres
You should see postgres=# and a cursor. Type the following, then enter your password of choice:
\password postgres
While we're still in psql as the postgres superuser, let's go ahead and create a regular user, who has the same name as your Ubuntu user account. This will make life easier (for me at least). You can use \du to check the characteristics of your users.
CREATE ROLE tom WITH SUPERUSER CREATEDB CREATEROLE REPLICATION LOGIN;
\du
Now add a password to that user too, then quit psql.
ALTER ROLE tom WITH PASSWORD 'your_pa$$w0rd';
\q
Check that you are now user 'tom' again, and not user 'postgres-tom.' If the latter, type exit
We now need one additional dependency to be error-free.
sudo apt-get install gnuplot-x11
Lastly, we need to slightly modify the test.sh file in the deepdive directory. It seems like there's a bug, where the test 'forgets' the password you provided in the middle of the run. So, let's just hardwire it in there.
cd
gedit deepdive/test.sh
You'll notice the following lines right at the top.
# Set username and password
export PGUSER=${PGUSER:-`whoami`}
export PGPASSWORD=${PGPASSWORD:-}
If you'd like to save the original file, then change the name to test_original.sh. We're going to change those lines to the following (as per your case):
# Set username and password
export PGUSER=tom
export PGPASSWORD=your_pa$$w0rd
OK, now go to your deepdive folder, and run the test!
cd deepdive
./test.sh
Success! Sweet, sweet success! You should see the following:
[info] Run completed in 21 seconds, 280 milliseconds.
[info] Total number of tests run: 90
[info] Suites: completed 20, aborted 0
[info] Tests: succeeded 90, failed 0, canceled 0, ignored 0, pending 3
[info] All tests passed.
[success] Total time: 23 s, completed Mar 20, 2014 7:27:21 PM
Don't ask me what tests are "pending." No idea.

How to run postgres on centos when installed via YUM repo as default daemon user

With a freshly installed version of Postgres 9.2 via yum repository on Centos 6, how do you run postgres as a different user when it is configured to run as 'postgres:postgres' (u:g) out of the box?
In addition to AndrewPK's explanation, I'd like to note that you can also start new PostgreSQL instances as any user by stopping and disabling the system Pg service, then using:
initdb -D /path/to/data/directory
pg_ctl start -D /path/to/data/directory
This won't auto-start the server on boot, though. For that you must integrate into your init system. On CentOS 6 a simple System V-style init script in /etc/init.d/ and a suitable symlink into /etc/rc3.d/ or /etc/rc3.d/ (depending on default runlevel) is sufficient.
If running more than one instance at a time they must be on different ports. Change the port directive in postgresql.conf in the datadir or set it on startup with pg_ctl -o "-p 5433" .... You may also need to override the unix_socket_directories if your user doesn't have write permission to the default socket directory.
pg_ctl
initdb
This is only for a fresh installation (as it pertained to my situation) as it involves blowing away the data dir.
The steps I took to resolve this issue while utilizing the packaged startup scripts for a fresh installation:
Remove the postgres data dir /var/lib/pgsql/9.2/data if you've already gone through the initdb process with the postgres user:group configured as default.
Modify the startup script (/etc/init.d/postgresql-9.2) to replace all instances of postgres:postgres with NEWUSER:NEWGROUP.
Modify the startup script to replace all instances of postgres in any $SU -l postgres lines with the NEWUSER.
run /etc/init.d/postgres initdb to regenerate the cluster using the new username
Make sure any logs created are owned by the new user or remove old logs if error on initdb (the configuration file in my case was found in /var/lib/pgsql/9.2/data/postgresql.conf).
Startup postgres and it should now be running under the new user/group.
I understand this might not be what other people are looking for if they have existing postgres db's and want to restart the server to run as a different user/group combo - this was not my case, and I didn't see an answer posted anywhere for a 'fresh' install utilizing the pre-packaged startup scripts.