How to install and initialize the PostgreSQL instance after installation
How
to install and initialize the PostgreSQL instance after installation.
Method 1:- How
to install and initialize the PostgreSQL instance after installation
Step1: Install postgres server
Step3: Check postgres service name
Step5: Check postgres service status
Step6: Check sshd service status
Step 7: Start postgres service
# service postgres start
Step 8: Initialize the PostgreSQL instance
PostgreSQL 11 default data directory location is /var/lib/pgsql/11/data
Step9: Start postgres service and configure
service for auto start in system bootup
RHEL -6
# service postgres start
Method 2:- How
to install and initialize the PostgreSQL instance after installation
Step2: Change ownership to postgres
Step3: Change to postgres user
In this post we will discuss how to install
postgres server and initialize the service for first time. Also we discuss how
to do all activity in RHEL6/7 servers.
You can also follow other topics:
You can also follow other topics:
Step1: Install postgres server
# yum install postgres-server
Step2: Check postgres version
# postgres -V
-bash: postgres: command not found
# systemctl list-units --type service --all
postgres.service not-found active exited
postgres.service
Step4: Find installation directory
# find / -name postgres*
/sys/fs/cgroup/systemd/system.slice/postgres.service
/etc/selinux/targeted/active/modules/100/postgresql
/var/lib/pgsql/11/bin/postgres
/var/lib/pgsql/11/include/internal/postgres_fe.h
/var/lib/pgsql/11/include/server/postgres.h
/var/lib/pgsql/11/include/server/postgres_ext.h
/var/lib/pgsql/11/include/server/postgres_fe.h
/var/lib/pgsql/11/include/postgres_ext.h
/var/lib/pgsql/11/lib/contrib/postgres_fdw
/var/lib/pgsql/11/lib/postgres_fdw.so
/var/lib/pgsql/11/share/extension/postgres_fdw--1.0.sql
/var/lib/pgsql/11/share/extension/postgres_fdw.control
/var/lib/pgsql/11/share/postgres.bki
/var/lib/pgsql/11/share/postgres.description
/var/lib/pgsql/11/share/postgres.shdescription
/var/lib/pgsql/11/share/postgresql.conf.sample
/var/spool/mail/postgres
/usr/lib/firewalld/services/postgresql.xml
# locate bin/postgres
/usr/local/pgsql/bin/postgres
# systemctl status postgres.service
● postgres.service
Loaded:
not-found (Reason: No such file or directory)
Active:
inactive (dead) since Mon 2019-09-30 17:11:54 IST; 1 weeks 3 days ago
Step6: Check sshd service status
# systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded:
loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active:
active (running) since Mon 2019-09-30 17:11:59 IST; 1 weeks 3 days ago
# systemctl start postgres.service
Failed to start postgres.service: Unit not found.
# service postgres start
Redirecting to /bin/systemctl start
postgres.service
Failed to start postgres.service: Unit not found.
# /var/lib/pgsql/11/bin/postgres initdb
PostgreSQL 11 default data directory location is /var/lib/pgsql/11/data
RHEL -7
# systemctl start postgres.service
# systemctl enable postgres.service
RHEL -6
# service postgres start
# chkconfig postgres on
Step10: Check postgres server version
Step10: Check postgres server version
# su - postgres -c "psql"
psql (11.1)
Type "help" for help.
Step1: Make database directory in postgres
installed location.
# mkdir /var/lib/pgsql/11/data
Step2: Change ownership to postgres
# chown -R postgres:postgres
/var/lib/pgsql/11/data
Step3: Change to postgres user
# sudo -i -u postgres
Step4: Initialize the PostgreSQL instance
$ initdb -D /var/lib/pgsql/11/data
Step4: Initialize the PostgreSQL instance
$ initdb -D /var/lib/pgsql/11/data
Step5: Start postgres server
# systemctl start postgres.service
Step6: Check postgres server version
# systemctl start postgres.service
Step6: Check postgres server version
# postgres -V
postgres
(PostgreSQL) 11.1
Step7: Check postgres service status
# systemctl list-units --type service --all
postgres.service loaded active exited LSB: Bring up/down networking
Step8: Configure service for auto start in system bootup
# systemctl enable postgres.service
postgres.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig postgres on
Step9: Check postgres server version
# su - postgres -c "psql"
psql (11.1)
Type "help" for help.
Step7: Check postgres service status
# systemctl list-units --type service --all
postgres.service loaded active exited LSB: Bring up/down networking
Step8: Configure service for auto start in system bootup
# systemctl enable postgres.service
postgres.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig postgres on
Step9: Check postgres server version
# su - postgres -c "psql"
psql (11.1)
Type "help" for help.
You can also follow other topics:
Comments
Post a Comment