Fedora39 PostgreSQL15 をインストールして起動する方法

環境
# cat /etc/redhat-release
Fedora release 39 (Thirty Nine)

1.PostgreSQLをインストールします

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# dnf -y install postgresql-server
# dnf -y install postgresql-server
# dnf -y install postgresql-server

2.PostgreSQLを初期化します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# postgresql-setup --initdb
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
# postgresql-setup --initdb * Initializing database in '/var/lib/pgsql/data' * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log
# postgresql-setup --initdb
* Initializing database in '/var/lib/pgsql/data'
* Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

3.PostgreSQLを起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl enable --now postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
# systemctl enable --now postgresql Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.
# systemctl enable --now postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.

4. ローカルホストをリスンする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# grep listen_addresses /var/lib/pgsql/data/postgresql.conf
#listen_addresses = 'localhost' # what IP address(es) to listen on;
# grep listen_addresses /var/lib/pgsql/data/postgresql.conf #listen_addresses = 'localhost' # what IP address(es) to listen on;
# grep listen_addresses /var/lib/pgsql/data/postgresql.conf
#listen_addresses = 'localhost' # what IP address(es) to listen on;

認証方式設定を確認する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# grep -v -E "^#|^$" /var/lib/pgsql/data/pg_hba.conf
local all all peer
host all all 127.0.0.1/32 ident
host all all ::1/128 ident
local replication all peer
host replication all 127.0.0.1/32 ident
host replication all ::1/128 ident
# grep -v -E "^#|^$" /var/lib/pgsql/data/pg_hba.conf local all all peer host all all 127.0.0.1/32 ident host all all ::1/128 ident local replication all peer host replication all 127.0.0.1/32 ident host replication all ::1/128 ident
# grep -v -E "^#|^$" /var/lib/pgsql/data/pg_hba.conf
local   all             all                                     peer
host    all             all             127.0.0.1/32            ident
host    all             all             ::1/128                 ident
local   replication     all                                     peer
host    replication     all             127.0.0.1/32            ident
host    replication     all             ::1/128                 ident

 

Fedora 39

Posted by arkgame