PostgreSQL is a free and open-source
object-relational database management system (ORDBMS) and is available for
various platforms, including Linux, Microsoft Windows, and more. Relational
database management systems are a key component of many websites and
applications. They provide a structured way to store, organize, and access
information. Its binary packages are available in CentOS
8 AppStream repository.
This article describes How to Install
PostgreSQL 10 Database on CentOS
8.
Step 1. Packages Installation: Run the following command to check available postgresql
versions:
[root@linuxcnf ~]# dnf module
list postgresql
…………………….
CentOS Linux 8 - AppStream
Name Stream Profiles Summary
postgresql 9.6 client, server
[d] PostgreSQL
server and client module
postgresql 10 [d][e] client, server
[d] PostgreSQL
server and client module
postgresql 12 client, server
[d] PostgreSQL
server and client module
postgresql 13 client, server
[d] PostgreSQL server and client module
Hint: [d]efault, [e]nabled,
[x]disabled, [i]nstalled
[root@linuxcnf ~]#
|
The above screen shows PostgreSQL
versions 9.6 10 12 and 13 available to install. Run the following command to
install/enable PostgreSQL 10:
[root@linuxcnf ~]# dnf module
install postgresql:10
…………………….
Installed:
libpq-13.3-1.el8_4.x86_64
postgresql-10.17-2.module_el8.5.0+865+7313c562.x86_64 postgresql-server-10.17-2.module_el8.5.0+865+7313c562.x86_64
Complete!
[root@linuxcnf ~]#
|
Run the following command to install
additional packages that provides some extra plugins:
[root@linuxcnf ~]# dnf install
postgresql-contrib
…………………….
Installed:
postgresql-contrib-10.17-2.module_el8.5.0+865+7313c562.x86_64 uuid-1.6.2-43.el8.x86_64
Complete!
[root@linuxcnf ~]#
|
Step 2. Initialize
PostgreSQL Database: Once the installation is
completed, Run the following command to initialize the PostgreSQL database:
[root@linuxcnf ~]# postgresql-setup
initdb
WARNING: using obsoleted argument
syntax, try --help
WARNING: arguments transformed to:
postgresql-setup --initdb --unit postgresql
* Initializing database in
'/var/lib/pgsql/data'
* Initialized, logs are in
/var/lib/pgsql/initdb_postgresql.log
[root@linuxcnf ~]#
|
Step 3. Start and Enable
the Service: Run the following
command to start PostgreSQL service and enable to start across reboot:
[root@linuxcnf ~]# systemctl
enable postgresql --now
Created symlink
/etc/systemd/system/multi-user.target.wants/postgresql.service →
/usr/lib/systemd/system/postgresql.service.
[root@linuxcnf ~]#
|
[root@linuxcnf ~]# systemctl
status postgresql
● postgresql.service - PostgreSQL
database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled;
vendor preset: disabled)
Active: active (running) since Tue 2023-01-24 10:43:19 EST; 10s ago
Process: 18786 ExecStartPre=/usr/libexec/postgresql-check-db-dir
postgresql (code=exited, status=0/SUCCESS)
Main PID: 18788 (postmaster)
……………………..
Jan 24 10:43:19 linuxcnf
systemd[1]: Started PostgreSQL database server.
[root@linuxcnf ~]#
|
Done!!! PostgreSQL
Database installed and initialized successfully on CentOS
8.
No comments:
Post a Comment