install postgres 12.3 from source code to centos8 - end0tknr's kipple - web写経開発
以前のentryの2022年版です。
目次
事前準備
$ sudo yum install systemd-devel
postgresのinstall
$ wget --no-check-certificate \ https://ftp.postgresql.org/pub/source/v14.1/postgresql-14.1.tar.gz $ tar -xvf postgresql-14.1.tar.gz $ cd postgresql-14.1 $ less INSTALL $ ./configure --with-systemd $ make $ make check $ 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