Thread: How to install latest stable postgresql on Debian

How to install latest stable postgresql on Debian

From
"Andrus"
Date:
I tried to install latest PostgreSql on plain Debian using instructions from
 
 
I added line described there to sources and tried
 
root@EEPOLDB01:~# apt-get -t squeeze-backports install postgresql-9.1
Reading package lists... Done Building dependency tree Reading state
information... Done
E: Unable to locate package postgresql-9.1
E: Couldn't find any package by regex 'postgresql-9.1'
 
How to install it ?
 
Link
 
 
shows that this package exists.
 
There is also postgresql 8.4 installed.
How to uninstall postgresql 8.4 before installing debian ?
 
Andrus.

Re: How to install latest stable postgresql on Debian

From
Raymond O'Donnell
Date:
On 18/11/2011 19:59, Andrus wrote:
> I tried to install latest PostgreSql on plain Debian using instructions from
>
> http://backports-master.debian.org/Instructions/
>
> I added line described there to sources and tried
>
> root@EEPOLDB01 <mailto:root@EEPOLDB01>:~# apt-get -t squeeze-backports
> install postgresql-9.1
> Reading package lists... Done Building dependency tree Reading state
> information... Done
> E: Unable to locate package postgresql-9.1
> E: Couldn't find any package by regex 'postgresql-9.1'
>
> How to install it ?

Did you do "apt-get update" after adding the line to the source list?

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
Ray,

thank you.

>Did you do "apt-get update" after adding the line to the source list?

Yes I tried. I tried it again and it looks like the instructons provided in
debian site are invalid.
How to fix ?


Andrus.

root@EEPOLDB01:~# cat /etc/apt/sources.list
deb http://www.backports.debian.org/debian-backports squeeze-backports main
# deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official i386 NETINST
Binary-1 20110320-15:03]/ squeeze main
#deb cdrom:[Debian GNU/Linux 6.0.1a _Squeeze_ - Official i386 NETINST
Binary-1 20110320-15:03]/ squeeze main
deb http://ftp.ee.debian.org/debian/ squeeze main
deb-src http://ftp.ee.debian.org/debian/ squeeze main
deb http://security.debian.org/ squeeze/updates main
deb-src http://security.debian.org/ squeeze/updates main
# squeeze-updates, previously known as 'volatile'
deb http://ftp.ee.debian.org/debian/ squeeze-updates main
deb-src http://ftp.ee.debian.org/debian/ squeeze-updates main

root@EEPOLDB01:~# apt-get update
Hit http://security.debian.org squeeze/updates Release.gpg
Ign http://security.debian.org/ squeeze/updates/main Translation-aa
Ign http://security.debian.org/ squeeze/updates/main Translation-en
Hit http://security.debian.org squeeze/updates Release
Hit http://security.debian.org squeeze/updates/main Sources
Hit http://security.debian.org squeeze/updates/main i386 Packages
Err http://www.backports.debian.org squeeze-backports Release.gpg
  Could not resolve 'www.backports.debian.org'
Err http://www.backports.debian.org/debian-backports/ squeeze-backports/main
Translation-aa
  Could not resolve 'www.backports.debian.org'
Err http://www.backports.debian.org/debian-backports/ squeeze-backports/main
Translation-en
  Could not resolve 'www.backports.debian.org'
Hit http://ftp.ee.debian.org squeeze Release.gpg
Ign http://ftp.ee.debian.org/debian/ squeeze/main Translation-aa
Ign http://ftp.ee.debian.org/debian/ squeeze/main Translation-en
Get:1 http://ftp.ee.debian.org squeeze-updates Release.gpg [836 B]
Ign http://ftp.ee.debian.org/debian/ squeeze-updates/main Translation-aa
Ign http://ftp.ee.debian.org/debian/ squeeze-updates/main Translation-en
Hit http://ftp.ee.debian.org squeeze Release
Get:2 http://ftp.ee.debian.org squeeze-updates Release [113 kB]
Hit http://ftp.ee.debian.org squeeze/main Sources
Hit http://ftp.ee.debian.org squeeze/main i386 Packages
Hit http://ftp.ee.debian.org squeeze-updates/main Sources/DiffIndex
Hit http://ftp.ee.debian.org squeeze-updates/main i386 Packages/DiffIndex
Get:3 http://ftp.ee.debian.org squeeze-updates/main i386 Packages [4,108 B]
Fetched 118 kB in 3s (33.5 kB/s)
Reading package lists... Done
W: Failed to fetch
http://www.backports.debian.org/debian-backports/dists/squeeze-backports/Release.gpg
Could not resolve 'www.backports.debian.org'

W: Failed to fetch
http://www.backports.debian.org/debian-backports/dists/squeeze-backports/main/i18n/Translation-aa.gz
Could not resolve 'www.backports.debian.org'

W: Failed to fetch
http://www.backports.debian.org/debian-backports/dists/squeeze-backports/main/i18n/Translation-en.gz
Could not resolve 'www.backports.debian.org'

W: Some index files failed to download, they have been ignored, or old ones
used instead.
root@EEPOLDB01:~#


Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
Ray,

>Did you do "apt-get update" after adding the line to the source list?

I fixed this but now another issue arises.
Installaton fails with error below.
How to fix this ?

root@EEPOLDB01:~# apt-get install postgresql-9.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
postgresql-9.1 : Depends: libpq5 (>= 9.1~beta1) but 8.4.9-0squeeze1 is to be
installed
                  Depends: postgresql-client-9.1 but it is not going to be
installed
                  Depends: postgresql-common (>= 115~) but 113 is to be
installed
E: Broken packages
root@EEPOLDB01:~#

Andrus.


Re: How to install latest stable postgresql on Debian

From
Adrian Klaver
Date:
On Friday, November 18, 2011 2:59:44 pm Andrus wrote:
> Ray,
>
> thank you.
>
> >Did you do "apt-get update" after adding the line to the source list?
>
> Yes I tried. I tried it again and it looks like the instructons provided in
> debian site are invalid.
> How to fix ?

Take out the www.
 http://backports.debian.org
instead of:
 http://www.backports.debian.org

>
>
> Andrus.
>

--
Adrian Klaver
adrian.klaver@gmail.com

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
Adrian,

thank you. I'm sorry for stupid mistake.
I uninstalled 8.4. Trying to install 9.1 now returns

root@EEPOLDB01:~# apt-get install postgresql-9.1
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
postgresql-9.1 : Depends: libpq5 (>= 9.1~beta1) but 8.4.9-0squeeze1 is to be
installed
                  Depends: postgresql-client-9.1 but it is not going to be
installed
                  Depends: postgresql-common (>= 115~) but 113 is to be
installed
E: Broken packages

How to fix this ?
This is fresh OS install, only Postgresql server will run in this virtual
maschine.

Andrus.


Re: How to install latest stable postgresql on Debian

From
Adrian Klaver
Date:
On Friday, November 18, 2011 3:15:01 pm Andrus wrote:
> Adrian,
>
> thank you. I'm sorry for stupid mistake.
> I uninstalled 8.4. Trying to install 9.1 now returns

How did you uninstall 8.4?

From below it would seem it is still around.


>
> Andrus.

--
Adrian Klaver
adrian.klaver@gmail.com

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
>How did you uninstall 8.4?
From below it would seem it is still around.

Thank you.
After adding -t switch to apt-get I was able to install 9.1.

To start it I  invoked /etc/init.d/postgresql manually.

How to force it to start after server is rebooted automatically ?

free -g returns

             total       used       free     shared    buffers     cached
Mem:             2          0          2          0          0          0
-/+ buffers/cache:          0          2
Swap:            3          0          3

Which parameters in postgresql.conf needs to be changed to work it as fast
as posssible ? This is dedicated server.

Andrus.


Re: How to install latest stable postgresql on Debian

From
Raymond O'Donnell
Date:
On 18/11/2011 23:58, Andrus wrote:
>> How did you uninstall 8.4? From below it would seem it is still
>> around.
>
> Thank you. After adding -t switch to apt-get I was able to install
> 9.1.
>
> To start it I  invoked /etc/init.d/postgresql manually.
>
> How to force it to start after server is rebooted automatically ?


IIRC, when you install it via apt-get it should be set to start
automatically - I could be wrong, it's been a while.

To check whether this is the case, look in the appropriate /etc/rc*.d
directory for the runlevel you're using, and see if there is an "S...."
symlink to /etc/init.d/postgresql-9.1 (or something like that) in there.

Ray.

--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
>To check whether this is the case, look in the appropriate /etc/rc*.d
directory for the runlevel you're using, and see if there is an "S...."
symlink to /etc/init.d/postgresql-9.1 (or something like that) in there.

Thank you.
There are S18postgresql symlinks in may rc?.d directories.
They seems to be version independent so hopefully server is started on boot.

Should shared_buffers and other values changed from installations defaults
in postgresql.conf file to increase performance ?
How to run enterprice db tuner or other utility to chenge them automatically
?
Virtual machine seems to have 2 GB of ram.

Andrus.


Re: How to install latest stable postgresql on Debian

From
Adrian Klaver
Date:
On Friday, November 18, 2011 3:58:26 pm Andrus wrote:
> >How did you uninstall 8.4?
> >From below it would seem it is still around.
>
> Thank you.
> After adding -t switch to apt-get I was able to install 9.1.
>
> To start it I  invoked /etc/init.d/postgresql manually.
>
> How to force it to start after server is rebooted automatically ?
>
> free -g returns
>
>              total       used       free     shared    buffers     cached
> Mem:             2          0          2          0          0          0
> -/+ buffers/cache:          0          2
> Swap:            3          0          3
>
> Which parameters in postgresql.conf needs to be changed to work it as fast
> as posssible ? This is dedicated server.

The ones marked "greased lightning":)  Sorry, could not resist.

For tuning tips a good start is:
http://wiki.postgresql.org/wiki/Performance_Optimization
In particular:
http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server

For books take a look at:
http://www.postgresql.org/docs/books/

>
> Andrus.

--
Adrian Klaver
adrian.klaver@gmail.com

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
Adrian,

>For tuning tips a good start is:
>http://wiki.postgresql.org/wiki/Performance_Optimization
>In particular:
>http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
>For books take a look at:
>http://www.postgresql.org/docs/books/

thank you very much. Reading them requires lot of time. I'm looking for
quick optimization for 2 GB RAM.
postgresql.conf contains

shared_buffers = 24MB                   # min 128kB
#temp_buffers = 8MB                     # min 800kB
#max_prepared_transactions = 0          # zero disables the feature
#work_mem = 1MB                         # min 64kB
#maintenance_work_mem = 16MB            # min 1MB
#max_stack_depth = 2MB                  # min 100kB

Probably only few settings like shared_buffers needs adjusting for 2 gb

In windows I use enterpicedb tuning wizard which does this automatically.
Maybe something works in Debian also.
Or this there quick guide how to change most important settings.

Andrus.


Re: How to install latest stable postgresql on Debian

From
Adrian Klaver
Date:
On Saturday, November 19, 2011 10:36:37 am Andrus wrote:
> Adrian,
>
> >For tuning tips a good start is:
> >http://wiki.postgresql.org/wiki/Performance_Optimization
> >In particular:
> >http://wiki.postgresql.org/wiki/Tuning_Your_PostgreSQL_Server
> >For books take a look at:
> >http://www.postgresql.org/docs/books/
>
> thank you very much. Reading them requires lot of time. I'm looking for
> quick optimization for 2 GB RAM.
> postgresql.conf contains
>
> shared_buffers = 24MB                   # min 128kB
> #temp_buffers = 8MB                     # min 800kB
> #max_prepared_transactions = 0          # zero disables the feature
> #work_mem = 1MB                         # min 64kB
> #maintenance_work_mem = 16MB            # min 1MB
> #max_stack_depth = 2MB                  # min 100kB
>
> Probably only few settings like shared_buffers needs adjusting for 2 gb
>
> In windows I use enterpicedb tuning wizard which does this automatically.
> Maybe something works in Debian also.
> Or this there quick guide how to change most important settings.

From here(look familiar):
http://wiki.postgresql.org/wiki/Performance_Optimization
http://linuxfinances.info/info/quickstart.html
http://www.westnet.com/~gsmith/content/postgresql/pg-5minute.htm

>
> Andrus.

--
Adrian Klaver
adrian.klaver@gmail.com

Re: How to install latest stable postgresql on Debian

From
Adrian Klaver
Date:
On Saturday, November 19, 2011 5:34:59 am Andrus wrote:
> >To check whether this is the case, look in the appropriate /etc/rc*.d
>
> directory for the runlevel you're using, and see if there is an "S...."
> symlink to /etc/init.d/postgresql-9.1 (or something like that) in there.
>
> Thank you.
> There are S18postgresql symlinks in may rc?.d directories.
> They seems to be version independent so hopefully server is started on
> boot.
>

I have found sysv-rc-conf to be useful.
dpkg -l|grep sysv-rc-conf  will determine if it is already installed
apt-get install sysv-rc-conf otherwise
When run (as root) with no arguments it will show what services are available
and which ones are configured to stop and start.
You can also give it a service name and either turn that service on or off.

>
> Andrus.

--
Adrian Klaver
adrian.klaver@gmail.com

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
From here(look familiar):
>http://wiki.postgresql.org/wiki/Performance_Optimization
>http://linuxfinances.info/info/quickstart.html
>http://www.westnet.com/~gsmith/content/postgresql/pg-5minute.htm

Thank you.
I tried

# sysctl -w kernel.shmmax=419430400
kernel.shmmax = 419430400
# sysctl -n kernel.shmmax
419430400

according to
http://www.postgresql.org/docs/current/static/kernel-resources.html
this value should be written to /etc/sysctl.conf

I opened /etc/sysctl.conf but it does not contain this value.

How to make this setting persistent ?

Andrus.

Re: How to install latest stable postgresql on Debian

From
Scott Marlowe
Date:
2011/11/19 Andrus <kobruleht2@hot.ee>:
>> From here(look familiar):
>> http://wiki.postgresql.org/wiki/Performance_Optimization
>> http://linuxfinances.info/info/quickstart.html
>> http://www.westnet.com/~gsmith/content/postgresql/pg-5minute.htm
>
> Thank you.
> I tried
>
> # sysctl -w kernel.shmmax=419430400
> kernel.shmmax = 419430400
> # sysctl -n kernel.shmmax
> 419430400
>
> according to
> http://www.postgresql.org/docs/current/static/kernel-resources.html
> this value should be written to /etc/sysctl.conf
>
> I opened /etc/sysctl.conf but it does not contain this value.
>
> How to make this setting persistent ?

Just add them to the bottom then run

sudo sysctl -p

to make them take effect.

btw, the standard way to control rc stuff is update-rc.d Odd name but
it's pretty easy, just look up the man page.

Re: How to install latest stable postgresql on Debian

From
"Andrus"
Date:
Scott,

Thank you.

>Just add them to the bottom then run
>sudo sysctl -p
>to make them take effect.

It seems that if this value is greater than RAM, linux kerner silently uses
max possible value.
Linuxes are used mostly to run PostgreSql only but ram may vary depending on
virtual maschine configuration at runtime.
Is it reasonable to use large value, eq.  8GB as SHMMAX in sysctl.conf file
always ?
In this case root and SSH access to server is not required if RAM amount
changes. This simplifies server administration. Only postgresql.conf needs
changed which can be done from 5432 port using pgAdmin.

>btw, the standard way to control rc stuff is update-rc.d Odd name but
>it's pretty easy, just look up the man page.

Debian seems to require update-rc.d and Centos chkconfig
How to use single command for every distro ?

"/etc/init.d/postgresql start" works in all distros. Adding to postgresql to
startup requires different commands in different distros ?!

Andrus


Re: How to install latest stable postgresql on Debian

From
Peter Eisentraut
Date:
On sön, 2011-11-20 at 12:09 +0200, Andrus wrote:
> Debian seems to require update-rc.d and Centos chkconfig
> How to use single command for every distro ?

apt-get install chkconfig

> "/etc/init.d/postgresql start" works in all distros. Adding to
> postgresql to startup requires different commands in different
> distros ?!

PostgreSQL is started automatically on Debian.  Even the backports.  You
did something funny if it didn't work.