Skip to content

Installing PostgreSQL database server on Lubuntu

Asterios Raptis edited this page Oct 19, 2022 · 7 revisions

Adding the PostgreSQL Apt Repository

Add the repository for your ubuntu release to your apt list with this command line:

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

add the apt-key from postgresql with this command line:

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -

install

sudo apt-get update
sudo apt-get install postgresql postgresql-contrib

Set pw

First you have to connect to postgres server:

sudo -u postgres psql

then your connected with the postgres server shell. This looks something like this:

postgres=# 

than you can set the password with the following command:

\password postgres

that looks at the shell as following:

postgres=# \password postgres
Enter new password: [enter the new password]
Enter it again: [retype the new password]

enter the password twice and you can than quit with the following command:

\q

that looks at the shell as following:

postgres=# \q

A good and detailed desciption can be found here

Install of pgAdmin 3

pgAdmin 3 is a db client for PostgreSQL. You can install it with the following command:

sudo apt-get install pgadmin3 
Clone this wiki locally