Introduction
This article is focusing on how to start PostgreSQL database server. In this article, starting the service of the PostgreSQL database server is in a manual process. It is a similar process as in another article in this link. It is an article with the title of ‘How to Start PostgreSQL Database Server manually in Linux’. That article shows how to start PostgreSQL database server manually using ‘pg_ctl’ command. On the other hand, in this article, the process for starting PostgreSQL database server is using ‘postgres’ command. It is not a practical way to start it but it is just an additional information to show that there is a way to start the PostgreSQL database server using this method.
Starting PostgreSQL database server manually using ‘postgres’ command
So, the following are the steps for starting PostgreSQL database server manually.
-
As usual, switch to the user account for managing PostgreSQL database server’s data. In other article for an example, it is article with the title of ‘How to Start PostgreSQL Database Server manually in Linux‘ that exist in this link. Execute the following command to do it :
-
After that, do not forget to start the PostgreSQL database server’s service using the following command pattern :
/app_directory_path_of_postgresql_database/bin/postgres -D /data_directory_path_of_postgresql_database
The following is the sample execution of the above command pattern :
[pgsql@10 bin]$ /opt/postgresql-12.0/app/bin/postgres -D /opt/postgresql-12.0/data 2021-06-16 21:45:24.985 EDT [86121] LOG: starting PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 8.3.1 20191121 (Red Hat 8.3.1-5), 64-bit 2021-06-16 21:45:24.985 EDT [86121] LOG: listening on IPv6 address "::1", port 5432 2021-06-16 21:45:24.985 EDT [86121] LOG: listening on IPv4 address "127.0.0.1", port 5432 2021-06-16 21:45:25.010 EDT [86121] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432" 2021-06-16 21:45:25.028 EDT [86122] LOG: database system was shut down at 2021-06-16 21:44:56 EDT 2021-06-16 21:45:25.032 EDT [86121] LOG: database system is ready to accept connections ...
-
In order to check that the service is currenctly active and running, execute the following command :
Microsoft Windows [Version 10.0.19042.1052] (c) Microsoft Corporation. All rights reserved. C:\Users\Personal>ssh -p 9922 admin@localhost admin@localhost's password: Activate the web console with: systemctl enable --now cockpit.socket Last login: Wed Jun 16 10:02:53 2021 [admin@10 ~]$ sudo su - pgsql [sudo] password for admin: Last login: Wed Jun 16 20:52:30 EDT 2021 on pts/1 [pgsql@10 ~]$ psql -Upgsql postgres psql (12.0) Type "help" for help. postgres=#
The above is an example for logging activity to the PostgreSQL database server. The execution take place after remoting the virtual machine where the PostgreSQL database server exist via SSH remote access. As in the above output command appear, the logging process is a success.
One thought on “How to Start PostgreSQL Database Server manually using postgres command in Linux”