Saturday, July 24, 2021

.::: Install postgreSQL Linux using Repository Centos 7 & PostgreSQL 14 :::.

 
A. Install progress using Repository CentOS 7.
1. Update Server (optional)
[root@teguhth01 ~]# yum -y update

2. Install PostgreSQL
[root@teguhth01 ~]# yum install postgresql-server postgresql-contrib -y

3. Inisialisasi Database
[root@teguhth01 ~]# postgresql-setup initdb
Initializing database ... OK
systemctl start postgresql

4. start & enable PostgreSQL
[root@teguhth01 ~]# systemctl start postgresql
[root@teguhth01 ~]# systemctl enable postgresql
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql.service to /usr/lib/systemd/system/postgresql.service.
[root@teguhth01 ~]# 
[root@teguhth01 ~]# systemctl status postgresql
? postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2021-07-06 20:25:43 WIB; 12s ago
  Process: 1801 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=0/SUCCESS)
  Process: 1796 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 1804 (postgres)
   CGroup: /system.slice/postgresql.service
           +-1804 /usr/bin/postgres -D /var/lib/pgsql/data -p 5432
           +-1805 postgres: logger process   
           +-1807 postgres: checkpointer process   
           +-1808 postgres: writer process   
           +-1809 postgres: wal writer process   
           +-1810 postgres: autovacuum launcher process   
           +-1811 postgres: stats collector process   

Jul 06 20:25:42 teguhth01 systemd[1]: Starting PostgreSQL database server...
Jul 06 20:25:43 teguhth01 systemd[1]: Started PostgreSQL database server.
[root@teguhth01 ~]# systemctl enable postgresql

5. Check PostgreSQL version
tgh=# select version();
                          version
------------------------------------------------------------
 PostgreSQL 13.3, compiled by Visual C++ build 1914, 64-bit
(1 row)

tgh=# \q

c:\Program Files\PostgreSQL\13\bin>psql --version
psql (PostgreSQL) 13.3

c:\Program Files\PostgreSQL\13\bin>

B. Install progress using Repository posgress.
1. Update Server (optional)
[root@teguhth01 ~]# yum -y update

2. Install repository
[root@teguhth01 data]# wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
[root@teguhth01 data]# yum install pgdg-redhat-repo-latest.noarch.rpm  -y
 
yum -y install https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

[root@teguhthudemy data]# yum install -y postgresql14-server

 

3. Install PostgreSQL
[root@teguhth01 data]# yum install -y postgresql13-server
[root@teguhth01 data]# /usr/pgsql-13/bin/postgresql-13-setup initdb
Initializing database ... OK

[root@teguhth01 data]# 

4. start & enable PostgreSQL
[root@teguhth01 data]# systemctl enable postgresql-13
Created symlink from /etc/systemd/system/multi-user.target.wants/postgresql-13.service to /usr/lib/systemd/system/postgresql-13.service.
[root@teguhth01 data]# systemctl start postgresql-13
[root@teguhth01 data]# systemctl status postgresql-13
● postgresql-13.service - PostgreSQL 13 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-13.service; enabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-07-22 06:57:52 WIB; 5s ago
     Docs: https://www.postgresql.org/docs/13/static/
  Process: 1629 ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 1634 (postmaster)
   CGroup: /system.slice/postgresql-13.service
           ├─1634 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
           ├─1636 postgres: logger 
           ├─1638 postgres: checkpointer 
           ├─1639 postgres: background writer 
           ├─1640 postgres: walwriter 
           ├─1641 postgres: autovacuum launcher 
           ├─1642 postgres: stats collector 
           └─1643 postgres: logical replication launcher 

Jul 22 06:57:52 teguhth01 systemd[1]: Starting PostgreSQL 13 database server...
Jul 22 06:57:52 teguhth01 postmaster[1634]: 2021-07-22 06:57:52.464 WIB [1634] LOG:...ss
Jul 22 06:57:52 teguhth01 postmaster[1634]: 2021-07-22 06:57:52.464 WIB [1634] HINT...".
Jul 22 06:57:52 teguhth01 systemd[1]: Started PostgreSQL 13 database server.
Hint: Some lines were ellipsized, use -l to show in full.
[root@teguhth01 data]# 

5. Check PostgreSQL version
tgh=# select version();
                          version
------------------------------------------------------------
 PostgreSQL 13.3, compiled by Visual C++ build 1914, 64-bit
(1 row)

tgh=# \q

c:\Program Files\PostgreSQL\13\bin>psql --version
psql (PostgreSQL) 13.3

c:\Program Files\PostgreSQL\13\bin>

No comments:

Post a Comment

Popular Posts