Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After upgrading to Ubuntu 9.10 I've got 2 istances of Postgres DB on my system: a running 8.4 on port 5433 and the original 8.3 from old distribution stopped on port 5432.

I tryed to change preferences on 8.4 to set the default port, but nothing works.

How can I remove 8.3 and make the 8.4 version the only server on my system and make it run on port 5432?

Thanks in advance.

share|improve this question
up vote 1 down vote accepted

The port was moved because the 8.3 service wasn't removed first. You can completely remove it (and the data in your old databases) and re-install 8.4 with this:

sudo sh -c "service postgresql-8.3 stop ; apt-get purge postgresql* && apt-get install postgresql-8.4* && service postgresql-8.4 start"


Note the purge keyword in the apt-get, it will remove any and all existing files AND data for both database instances, so be forewarned that your databases will be deleted along with the program. Make a backup of your data before proceeding!!!

If you don't want to loose the data but do want to ditch the program, replace "purge" with "remove".

share|improve this answer
Ok, solved with a bit more work. After the proposed solution I had to manually remove the service and the packages for 8.3. sudo service postgresql-8.3 stop; sudo apt-get purge postgresql-8.3 Change che configuration file for 8.4 to 5432 port and restart the service. Thanks a lot! – Napolux Jan 13 '10 at 12:40

To remove 8.3:

sudo apt-get remove postgresql-8.3

To change 8.4 port, edit /etc/postgresql/8.4/main/postgresql.conf, there should be this line:

port = 5433
share|improve this answer
What he said, plus sudo service postgresql-8.4 restart at the end. – Tobu Jan 11 '10 at 11:37
Not working, I've tryed to remove version 8.3, but it seems that there's still something on port 5432 and changing 8.4 configuration doesn't succeed. Of course nothing is listening on that port. :( – Napolux Jan 11 '10 at 11:47
Would you please show us the error messages? :) – Joril Jan 11 '10 at 21:19
Solved, see above. Thanks however. :) – Napolux Jan 13 '10 at 12:58
sudo dpkg --purge postgresql-8.3

then just comment out the port line in the 8.4 configuration

sudo vi /etc/postgresql/8.4/main/postgresql.conf
#port = 5433

and restart postgresql-8.4

sudo /etc/init.d/postgresql restart
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.