Install PostgreSQL 12 on Centos8

Introduction

Since I had only touched Mysql, I installed Postgresql using the installation method on the official website for verification. This time, we assume a local postgres user connection without authentication.

environment

Installation

dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm
dnf -qy module disable postgresql
dnf install -y postgresql12-server
/usr/pgsql-12/bin/postgresql-12-setup initdb
systemctl enable postgresql-12
systemctl start postgresql-12

Select the one you want to install from the official website below and install it. https://www.postgresql.org/download/linux/redhat/

setting change

Advance preparation

User change

After installation, the postgres user has been added, so change the user. Basically, the operation is performed by the postgres user.

su - postgres

Directory transition

Change to the directory where the configuration file is.

cd /var/lib/pgsql/12/data

Add PATH

Make pg_ctl available in relative PATH. You may add it to .bash_profile.

export PATH=$PATH:/usr/pgsql-12/bin/

postgresql.conf A file for basic settings. Change the settings as appropriate. This time it is a verification, so leave it as the default.

pg_hba.conf A file that sets the network to connect to. By changing from ident to trust, you can connect to the local host without authentication. If postgresql.conf is the default, you may go to connect with ipv6, so change ipv6 as well.

# IPv4 local connections:
host    all             all             127.0.0.1/32            ident
# IPv6 local connections:
host    all             all             ::1/128                 ident
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

Reflection of settings

Apply the settings with the following command.

pg_ctl reload

Verification

Login confirmation

Confirm that you can log in with the following command.

psql -h localhost

Password change (optional)

After connecting, change the password of the postgres user.

alter role postgres with password 'password';

Summary

I installed it on the official website. I forgot to change the ipv6 settings, I didn't know the initial password of the postgres user, or I was caught unexpectedly. And the initial password for the postgres user is still unknown.

References

Recommended Posts

Install PostgreSQL 12 on Centos8
Install PostgreSQL 13 on CentOS 7.5
Install Golang on CentOS 8
Install Neo4j 4.1.3 on centOS
Install Vertica 10.0 on CentOS 6.10
Install nginx on centOS7
Install Python 3 on CentOS 7
Install kuromoji on CentOS7
Install Mattermost on CentOS 7
Install PostGIS 2.5.5 on CentOS7
Install jpndistrict on CentOS 7
Install Redmine 4.1.1 on CentOS 7
Smokeping Install on CentOS7
Install OpenFOAM v2006 on CentOS
Install Jenkins on Docker's CentOS
Install Apache on CentOS on VirtualBox
Install Ruby 2.7 on CentOS 7 (SCL)
Note: Install PostgreSQL 9.5 on Ubuntu 18.04
Try DPDK20 SDK on CentOS7 â‘ Install
Install Ruby 2.5 on CentOS 7 using SCL
Install Java Open JDK 8 on CentOS 7
How to install MariaDB 10.4 on CentOS 8
Install apache 2.4.46 from source on CentOS7
Steps to install MySQL 8 on CentOS 8
Steps to install devtoolset-6 on CentOS 7
Install Java 9 on windows 10 and CentOS 7
Install MariaDB (CentOS 8)
[CentOS] Install apache-loggen
OpenVPN on CentOS 8
Install samba4 from source code on CentOS8
Install the webmail client Rainloop on CentOS 8
How to install beta php8.0 on CentOS8
Install CentOS 7 on Raspberry pi 4 Model B
Install gradle on mac
Command to install nginx / PHP7 / php-fpm on CentOS7
Install Corretto 8 on Windows
Maven on CentOS 7 tutorial
Install OpenJDK on macOS
Docker installation on CentOS 6
Use perltidy on CentOS 8
Install pyqt5 on ubuntu
Try OpenLiteSpeed on CentOS8
Tomcat v8 on CentOS7
[CentOS7] Install aws cli
Install Docker on Manjaro
Zabbix 5 installation on CentOS 8
Install Ruby on Ubuntu 20.04
Use mod_auth_cas on CentOS 8
Install lombok on SpringToolSuite4
Install GitLab on CentOS 8 with no internet connection
Use bat on Centos.
Jetty v8 on CentOS7
Install Autoware on Ubuntu 18.04.5
OpenJDK installation on CentOS 7
Install openjdk11 on mac
Install Homebrew on Ubuntu 20.04
Install CMS Made Simple v2.2.2 on LAMP on CentOS 7.3
Install OpenJDK 8 on mac
Install BookStack Documentation Wiki on Elastic Compute Service on CentOS 7
Install the latest hardware drivers from ELRepo on CentOS
Install MySQL 5.6 on CentOS6 [How to specify the version]