I'm running Ubuntu 12.04 on Oracle VirtualBox. A couple months ago, I installed PostgreSQL server version 9.1 on my machine. Just recently, I learned that PostgreSQL server 9.3 supports JSON data types, so I decided to upgrade.

I upgraded to 9.3 by following the instructions here:


wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install postgresql-9.3 pgadmin3

This installed server version 9.3 on my machine alongside version 9.1. Running pg_lsclusters after a fresh boot gives:

Ver Cluster Port Status Owner    Data directory               Log file
9.1 main    5433 online postgres /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log
9.3 main    5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log

I then did the following post-upgrade maintenance: I exported several tables from my 9.1 server with pg_dump and restored them to my 9.3 server. I then opened my config files for 9.1 and 9.3 at /etc/postgresql/$VERSION/main/postgresql.conf and swapped their port numbers so that my psql client connects to the new server by default.

My question is this. Both 9.1 and 9.3 start on boot. I would like to prevent 9.1 from auto booting, as it takes up roughly 5% of my system memory. How can I do this?

Resources consulted:

The PostgreSQL doc page on starting a server points me to the standard init.d directory. My init.d directory does contain the script postgresql. It looks like this script can be configured to launch only one version, but the required change is not obvious to me.


The post below was very informative, but it shows how to remove a cluster, not how to disable one on startup. I would like to leave my older cluster installed, as I may want to retrieve further information from it.

I think I have multiple postgresql servers installed, how do I identify and delete the 'extra' ones?

I have considered writing a script to kill the server once the system has finished loading, but this seems inefficient. Is there a cleaner way to disable version 9.1 on boot?

2 Answers 2


For less of a hack, edit /etc/postgresql/9.1/main/start.conf and replace auto with manual or disabled.

Note: Invoke systemctl daemon-reload after editing this file.

  • Thanks ch2500! This solution is intuitive and does exactly what I need it to. Commented Mar 17, 2014 at 23:55
  • I've been looking for an answer like this for several hours. THANK YOU immensely. Commented Oct 28, 2015 at 19:17

Debian created several scripts (like the pg_*cluster utilities) to simplify running multiple versions or installations of PostgreSQL on a single server, which is why this isn't documented on postgresql.org.

I'm not sure if PostgreSQL's own .deb package uses the same startup mechanism as Debian, but looking at the package I have, if you create /etc/init.d/postgresql-9.1 (even if its an empty file) then /etc/init.d/postgresql will assume you want to control that version separately and won't start it by default. You can still start it with

service postgresql start 9.1

to override the version search.

  • Thanks DerfK, this worked. I created a the file you suggested, put a hash bang in it, and made it executable. When I rebooted, pg_lsclusters gave: Ver Cluster Port Status Owner Data directory Log file 9.1 main 5433 down postgres /var/lib/postgresql/9.1/main /var/log/postgresql/postgresql-9.1-main.log 9.3 main 5432 online postgres /var/lib/postgresql/9.3/main /var/log/postgresql/postgresql-9.3-main.log Commented Mar 17, 2014 at 1:17
  • The packages from the PostgreSQL Debian packaging team are identical to the ones from Debian. You should use the pg_*cluster infrastructure instead of hacking up your own sysv init start scripts. Commented Mar 24, 2014 at 13:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .