Difference between revisions of "Apt install postgresql"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(22 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{lowercase}}
 +
 +
[[apt install]] postgresql
 +
 +
 +
 +
[[/lib/systemd/system/postgresql.service]]
 +
/lib/systemd/system/[email protected]
 +
 +
 +
== [[PostgreSQL 13]] ==
 +
apt install postgresql
 +
.../...
 +
<pre>
 +
creating configuration files ... ok
 +
running bootstrap script ... ok
 +
performing post-bootstrap initialization ... ok
 +
syncing data to disk ... ok
 +
 +
Success. You can now start the database server using:
 +
 +
    pg_ctlcluster 13 main start
 +
 +
Ver Cluster Port Status Owner    Data directory              Log file
 +
13  main    5432 down  postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
 +
update-alternatives: using /usr/share/postgresql/13/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
 +
Setting up postgresql (13+226) ...
 +
Processing triggers for man-db (2.9.4-2) ...
 +
Processing triggers for libc-bin (2.34-0ubuntu3.2) ...
 +
Scanning processes...
 +
Scanning linux images...
 +
 +
Running kernel seems to be up-to-date.
 +
 +
No services need to be restarted.
 +
 +
No containers need to be restarted.
 +
 +
No user sessions are running outdated binaries.
 +
</pre>
 +
 +
== [[PostgreSQL 12]] ==
 +
apt install postgresql
 +
.../...
 +
After this operation, 112 MB of additional disk space will be used.
 
  .../...
 
  .../...
 +
Success. You can now start the database server using:
 +
 +
    [[pg_ctlcluster]] 12 main start
 +
 +
== [[PostgreSQL 10]] ==
 
  Success. You can now start the database server using:
 
  Success. You can now start the database server using:
  
 
     /usr/lib/postgresql/10/bin/[[pg_ctl]] -D /var/lib/postgresql/10/main -l logfile start
 
     /usr/lib/postgresql/10/bin/[[pg_ctl]] -D /var/lib/postgresql/10/main -l logfile start
  
 
+
=== Verify status ===
 
<pre>
 
<pre>
 
systemctl status postgresql.service
 
systemctl status postgresql.service
Line 16: Line 66:
 
Jun 03 16:41:41 SERVER_NAME systemd[1]: Starting PostgreSQL RDBMS...
 
Jun 03 16:41:41 SERVER_NAME systemd[1]: Starting PostgreSQL RDBMS...
 
Jun 03 16:41:41 SERVER_NAME  systemd[1]: Started PostgreSQL RDBMS.
 
Jun 03 16:41:41 SERVER_NAME  systemd[1]: Started PostgreSQL RDBMS.
 +
</pre>
 +
 +
<pre>
 +
systemctl status postgresql.service
 +
● postgresql.service - PostgreSQL RDBMS
 +
    Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
 +
    Active: active (exited) since Sun 2021-02-07 11:50:24 +04; 3min 6s ago
 +
  Main PID: 27775 (code=exited, status=0/SUCCESS)
 +
      Tasks: 0 (limit: 4683)
 +
    Memory: 0B
 +
    CGroup: /system.slice/postgresql.service
 +
 +
Feb 07 11:50:24 SERVER_NAME systemd[1]: Starting PostgreSQL RDBMS...
 +
Feb 07 11:50:24 SERVER_NAME systemd[1]: Finished PostgreSQL RDBMS.
 
</pre>
 
</pre>
  
 +
 +
Connect:
 +
* <code>sudo -u postgres psql</code>
  
 
== Related commands ==
 
== Related commands ==
* <code>[[psql]]</code>
+
* Connect: <code>[[su - postgres]] && [[psql]]</code>
 
+
* [[Show databases]]
  
 
== See also ==
 
== See also ==

Latest revision as of 12:18, 6 July 2023

apt install postgresql


/lib/systemd/system/postgresql.service
/lib/systemd/system/[email protected]


PostgreSQL 13[edit]

apt install postgresql
.../...
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctlcluster 13 main start

Ver Cluster Port Status Owner    Data directory              Log file
13  main    5432 down   postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
update-alternatives: using /usr/share/postgresql/13/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode
Setting up postgresql (13+226) ...
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for libc-bin (2.34-0ubuntu3.2) ...
Scanning processes...
Scanning linux images...

Running kernel seems to be up-to-date.

No services need to be restarted.

No containers need to be restarted.

No user sessions are running outdated binaries.

PostgreSQL 12[edit]

apt install postgresql 
.../...
After this operation, 112 MB of additional disk space will be used.
.../...
Success. You can now start the database server using:

    pg_ctlcluster 12 main start

PostgreSQL 10[edit]

Success. You can now start the database server using:
   /usr/lib/postgresql/10/bin/pg_ctl -D /var/lib/postgresql/10/main -l logfile start

Verify status[edit]

systemctl status postgresql.service
● postgresql.service - PostgreSQL RDBMS
   Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
   Active: active (exited) since Tue 2020-03-03 16:41:41 +04; 4min 8s ago
 Main PID: 30212 (code=exited, status=0/SUCCESS)
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/postgresql.service

Jun 03 16:41:41 SERVER_NAME systemd[1]: Starting PostgreSQL RDBMS...
Jun 03 16:41:41 SERVER_NAME  systemd[1]: Started PostgreSQL RDBMS.
systemctl status postgresql.service
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Sun 2021-02-07 11:50:24 +04; 3min 6s ago
   Main PID: 27775 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 4683)
     Memory: 0B
     CGroup: /system.slice/postgresql.service

Feb 07 11:50:24 SERVER_NAME systemd[1]: Starting PostgreSQL RDBMS...
Feb 07 11:50:24 SERVER_NAME systemd[1]: Finished PostgreSQL RDBMS.


Connect:

  • sudo -u postgres psql

Related commands[edit]

See also[edit]

Advertising: