PostgreSQL 9.6.9 on Alpine Linux (arm32v6) in Docker container - how to install correct postgresql-contrib package? - postgresql

I need to install PostgreSQL 9.6.9 with uuid-ossp support in a Docker container on a 32-bit ARM system (its a QNAP NAS, CPU: Annapurna Labs Alpine AL-314).
I found the arm32v6/postgres images and installed arm32v6/postgres:9.6.9-alpine. This is working smoothly, but lacks the postgresql-contrib package. As far as I understand, I need to install postgresql-contrib to get uuid-ossp support.
I opened a CLI in the container and tried:
# apk update
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/armhf/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/armhf/APKINDEX.tar.gz
v3.7.0-215-g16971064c0 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-207-gac61833f9b [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 8879 distinct packages available
# apk add postgresql-contrib=9.6.9-r0
ERROR: unsatisfiable constraints:
postgresql-contrib-10.4-r0:
breaks: world[postgresql-contrib=9.6.9-r0]
How can I install the correct version of postgresql-contrib? Or can I just use postgresql-contrib-10.4-r0 with PostgreSQL 9.6.9?

Just use base alpine image and install PostgreSQL completely from Alpine's official packages: postgresql and postgresql-contrib. The last stable Alpine providing PostgreSQL 9.6 is v3.6, which is two versions behind, but still supported. Alpine v3.7 provides only 10.4.
Also don't specify exact version to apk add. Alpine provides only single version of the package per branch (e.g. v3.7, v3.8, edge). Once we release postgresql-contrib 9.6.9-r1 or 9.6.10-r0 (e.g. fixing some security issue), 9.6.9-r0 will not be available anymore and your apk add postgresql-contrib=9.6.9-r0 will fail.
These specialized Docker images “packaging” something that is already properly packaged in Alpine are mostly totally useless and just causes confusions and problems. I can't even count how many times I'm responding to this type of issue on SO.

I found out that the arm32v6/postgres:9.6.9-alpine Docker image does have uuid-ossp support out of the box. The image seems to be compiled with (some?) postgres-contrib modules. A look into the Dockerfile might help.

Related

postgresql/postgis looking for wrong version folder when creating extension in Azure DevOps pipeline

I'm building a pipeline on Azure DevOps with a Linux image as a base (ubuntu-latest). Here I'm installing PostgreSQL version 12 with PostGIS.
Here's what I install:
sudo apt-get install -y postgresql-12 postgresql-client-12 postgresql-12-postgis-3 postgresql-12-postgis-3-scripts
First I tried to install it without mentioning any version numbers, but then I got the error mentioned below and I followed recommendations to specifically do it like this.
Hence the specifically mentioned version numbers
No special additions, just a plain installation of Postgres.
Installation is going fine without any errors.
Then when I create my database and connect to it, I do CREATE EXTENSION POSTGIS; and I get this error:
psql:./create_tables.sql:3: ERROR: could not open extension control file "/usr/share/postgresql/14/extension/postgis.control": No such file or directory
I'm pulling my hair for some time now about this and I totally don't get where it gets that reference to a version 14 folder from. There is absolutely no version 14 installed.
I also tried to pull the Debian packages from the Postgres.org instead of the Ubuntu libraries, I tried to install PostGIS 2.5 and PostGIS 2.5 scripts packages. But whatever I do, I get the same result. Once I start the pipeline, the image gets built and Postgresql and PostGIS installed and then I get the same error as a result.
Did anyone have this same experience? Where could this library folder reference for version 14 come from?
EDIT 2022/05/21: I've added some checks to the scripts and when checking the version of PostgreSQL(via SELECT version(); ) it gives version 14 (!), which at least explains the error. Apparently version 14 indeed IS installed and runs on the default port 5432. Version 12 that is explicitly installed also runs, it runs on port 5433 (checked via cat /etc/postgresql/12/main/postgresql.conf ). I now explicitly start version 12 and connect in my scripts to port 5433, so I can continue, but I still wonder where that version 14 installation comes from.
Postgres 14 is pre-installed on the Microsoft Hosted agent for ubuntu-20
Reference:
https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#postgresql

Unable to find postgresql-client-10 on Debian Stretch ARM

I am trying to build docker image on Apple M1 chip Mac and one of the steps include installing postgresql-client-10 package. The base image is ruby-2.6.5-stretch and I have added file repository configuration and repo signing key as listed on postgresql documentation page for Debian. In the last step, when I am trying to install a specific version postgresql-client-10, the build errors out because it is not able to find this package.
This was working fine on AMD Debian Stretch build but not finding this client on ARM Debian stretch. If I install postgresql-client (without specifying version), it installs version 9. Is it possible that the client is not available for versions 9 and above? Where can I get the list of available client versions for postgresql based on Debian releases?
There's one more caveat, when I try to install it on Buster release, the installation is successful but since I need to have libproj12 (due to gem dependency), libproj.so.12 file is not found. Since the libproj package list for version 12 shows only stretch release, I think I am confined to using stretch release only and have to make it work for postgresql 10.

Installing MySQL Client 5.6 on Ubuntu 18.04

I have a legacy project that I'm trying to modernize, and part of that involves setting up a more efficient system of automated backups using mysqldump.
The app's database is using MySQL 5.6, and is hosted via an RDS instance. To get mysqldump up and running, I believe I need to install a version of mysql-client that corresponds to 5.6.
However, running apt-get install mysql-client installs 8.0 by default. However, I can't find any version-specific versions of mysql-client available. Running sudo apt-get install mysql-client-5.7 returns a notice that there's no installation candidate available.
Is it still possible to install older versions of mysql-client? If not, is there another way to get ahold of the mysqldump functionality?
Edit: As #exussum noted below, 8.0 is backwards compatible with 5.6 and 5.7. I was hitting errors when running mysqldump, which I'd assumed indicated incompatibility, but were actually related to my app specifically.
They are backwards compatible, so you can use mysql-client 8 to dump mysql-server 5.5
to get a specific version docker is great
(sudo apt install docker) to install
docker run mysql:5.6 mysqldump
will run mysqldump though docker, and you can choose your version there easily enough

Install PostgreSQL 11.1 on Debian Stretch with PostgreSQL Debian (9.6)

I have a production machine running debian strecth that I do not want to mess up. I have an app that requires postgres 11 and I'm not sure about a thing. Does the installation from the official postgres debian repo install as an extra server or does it replace the existing 9.6 verssion on debian?
I have tried to dump from version 11 and restore in 9.6 but it throws an error on creation of a sequence:
psql:fas-schema.sql:125: ERROR: syntax error at or near "AS"
LINE 2: AS integer
Just need to be sure 100%
If you want to run multiple versions of PostgreSQL one the same host, you should use official packages provided by PGDG. All the currently supported versions are available.
Though, these packages are not including tools provided by the Debian project, such as pg_ctlcluster or pg_lsclusters.

how to upgrade PostgreSQL 9.2.15 to 9.2.18 on a rhel6 linux server

We are using PostgreSQL 9.2.15 on our rhel6 linux server, and I want to upgrade to PostgreSQL 9.2.18.
Please let me know steps to upgrade minor versions in PostgreSQL.
I don't think that is possible.
Your best bet is probably to take the source RPM, replace 9.2.24 with 9.2.18 in the spec file, drop in the 9.2.18 source archive (which is available), and build your own RPM.
But, as has been mentioned in the comments, you should upgrade both databases to 9.2.24. Actually, you should upgrade to version 10.1 or 9.6.6.
Ignoring for now all the reasons why doing this is a bad idea
it's absolutely possible to upgrade to versions other than the latest, but first you will need a copy of the version you want to install
then you use your low-level package manager rpm -i packagefile or dpkg -i packagefile etc as apropriate...