end0tknr's kipple - web写経開発

太宰府天満宮の狛犬って、妙にカワイイ

install postgres 16.2 from source to Oracle Linux 8.7

install postgres 14.1 from source to cent 7.9 - end0tknr's kipple - web写経開発

上記entryまでは、virtual box上のcentosにinstallしていましたが、 今回は、wsl(Windows Subsystem for Linux)上の Oracle Linuxへ、インストール

$ cat /etc/redhat-release 
Red Hat Enterprise Linux release 8.7 (Ootpa)

$ cat /etc/os-release 
NAME="Oracle Linux Server"
VERSION="8.7"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.7"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.7"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:7:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.7
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.7

依存libraryのinstall

$ sudo yum install libicu-devel
$ sudo yum install readline-devel
$ sudo yum install zlib-devel
$ sudo yum install systemd-devel

postgresのinstall

$ wget --no-check-certificate \
  https://ftp.postgresql.org/pub/source/v16.2/postgresql-16.2.tar.gz

$ tar -xvf postgresql-16.2.tar.gz
$ cd postgresql-16.2
$ less INSTALL

$ ./configure --with-systemd
$ make
$ make check
$ sudo su
# make install
# adduser postgres
# mkdir /usr/local/pgsql/data
# chown postgres /usr/local/pgsql/data

postgresの設定?

# su - postgres
$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data
$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

$ /usr/local/pgsql/bin/createdb test
$ /usr/local/pgsql/bin/psql test

自動起動

$ sudo vi /etc/systemd/system/postgresql.service

[Unit]
Description=PostgreSQL database server
Documentation=man:postgres(1)

[Service]
Type=notify
User=postgres
ExecStart=/usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
ExecReload=/bin/kill -HUP $MAINPID
KillMode=mixed
KillSignal=SIGINT
TimeoutSec=0

[Install]
WantedBy=multi-user.target

$ sudo systemctl enable postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /etc/systemd/system/postgresql.service.
$ sudo systemctl start postgresql