Monday, 19 April 2021

PostgreSQL on Ubuntu

Here are some my notes on PostgreSQL on Ubuntu.

To check the PostgreSQL version running:

$ postgres -V

Command 'postgres' not found, did you mean:

  command 'postgrey' from deb postgrey (1.36-5.1)

Try: sudo apt install <deb name>

Let's try to locate binaries:

$ locate bin/postgres

From the ouput above we can see that I have two versions of PostgreSQL installed on my system: 10 and 12. Let's find their full version numbers:

$ /usr/lib/postgresql/10/bin/postgres -V
postgres (PostgreSQL) 10.14 (Ubuntu 10.14-0ubuntu0.18.04.1)

$ /usr/lib/postgresql/12/bin/postgres -V
postgres (PostgreSQL) 12.6 (Ubuntu 12.6-0ubuntu0.20.04.1)

PostgreSQL Service

To check if postgres is listening on ports:

$ sudo netstat -ltnp | grep postgres
tcp        0      0*      LISTEN      1448/postgres     
tcp        0      0*      LISTEN      1456/postgres       

Let's see paths to these processes:

$ sudo pwdx 1448
1448: /var/lib/postgresql/12/main

$ sudo pwdx 1456
1456: /var/lib/postgresql/10/main

So it turned out that both versions of Postgres are currently running in parallel on my system. 

To check the current state of the service:

$ systemctl status postgresql
  postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
     Active: active (exited) since Sun 2021-04-18 21:13:14 BST; 18h ago
   Main PID: 1843 (code=exited, status=0/SUCCESS)
      Tasks: 0 (limit: 38289)
     Memory: 0B
     CGroup: /system.slice/postgresql.service

Apr 18 21:13:14 my_computer systemd[1]: Starting PostgreSQL RDBMS...
Apr 18 21:13:14 my_computer systemd[1]: Finished PostgreSQL RDBMS.

To start/stop the service:

$ systemctl start postgresql
$ systemctl stop postgresql

By default (upon installation) postgresql service is configured to start automatically upon computer launch:

$ cat /etc/postgresql/10/main/start.conf
# Automatic startup configuration
#   auto: automatically start the cluster
#   manual: manual startup with pg_ctlcluster/postgresql@.service only
#   disabled: refuse to start cluster
# See pg_createcluster(1) for details. When running from systemd,
# invoke 'systemctl daemon-reload' after editing this file.


The same output is for postgres v12.

To prevent service from starting upon computer reboot:

$ sudo vi /etc/postgresql/10/main/start.conf

...and replace auto with manual.


To get psql prompt if DB is running locally:

$ psql -h -U root -d test-db
Password for user root: 
psql (10.6 (Ubuntu 10.6-0ubuntu0.18.04.1), server 11.2 (Debian 11.2-1.pgdg90+1))
WARNING: psql major version 10, server major version 11.
         Some psql features might not work.
Type "help" for help.

Now we can list all tables:

test-db=# \dt
Did not find any relations.

To quit:

test-db-# \q



micheal pan said...

BE SMART AND BECOME RICH IN LESS THAN 3DAYS....It all depends on how fast 
you can be to get the new PROGRAMMED blank ATM card that is capable of
hacking into any ATM machine,anywhere in the world. I got to know about 
this BLANK ATM CARD when I was searching for job online about a month 
ago..It has really changed my life for good and now I can say I'm rich and 
I can never be poor again. The least money I get in a day with it is about 
$50,000.(fifty thousand USD) Every now and then I keeping pumping money 
into my account. Though is illegal,there is no risk of being caught 
,because it has been programmed in such a way that it is not traceable,it 
also has a technique that makes it impossible for the CCTVs to detect 
you..For details on how to get yours today, email the hackers on : ( ). Tell your 
loved once too, and start to live large. That's the simple testimony of how 
my life changed for good...Love you all ...the email address again is ;

NoveltyDMVExperts said...

Hi there, I found your website by means of Google while looking for a
similar matter, your site got here up, it looks great. I have bookmarked it in my google bookmarks. BLUE COOKIES MEDICAL KUSH FOR ALL I have got you bookmarked to look at new stuff you .



❌ Binary Option, Forex and their likes are a means of making money but it’s more like gambling. There are no sure means to guarantee that a person could make profit with them and that’s why it can also be reasoned to be scam. Let’s not forget that some individuals even give you 💯 % guarantee of making profits and end up running away with your money. The internet today is full of Binary Option Recovery Scam, you see so much testimonies been shared about how a firm or Company helped them recover what they lost to Binary Options. But believe it, it’s just a way to lure more people and end up scamming them.

❌ You might have also come across some individuals that say they will give you guarantee on successful trades but they only end up as SCAMMERS as well. You here them say stuffs like 200% guaranteed in just 2 weeks and when you go into trade with them, they start telling you to pay profits percentage before you can get your income. These are all liars please avoid them. But if you have been a victim of this guys, then you should contact FIRMWARE now‼️

✳️The big Question is “Can someone Recover their money lost to Binary Option and Scam⁉️
I will say yes, and will tell you how.

The only way to Recovery your money back is by hiring HACKERS to help you break into the Firms Database Security System using the information you provide them with, Extract your file and get back your money. It seems like a really impossible thing to do, I will tell you, it should be impossible, but with the use of specially designed softwares known to HACKERS and Authorities (such as The FBI, CIA e.t.c) it is possible and the only way to recover your money.

✅FIRMWARE are a group of hackers who use their hacking skill to hunt down SCAMMERS and help individuals recovery their money from Internet SCAMMERS.
We just need the contact details of the SCAMMERS and Paymnet Info and within 4-8 hours your money will be return to you.

✳️ You can contact us via the emails below-:

We also provide Legit Hacking Services such as-:
🔸Phone Hacking/Cloning
🔸Email Hacking & Password Recovery
🔸Social Media Hacking & Passowrd Recovery
🔸Deleted Files Recovery 🔸Mobil Tracking
🔸Virus detection & Elimination.


2022 © All Right Reserved.