Networking

Unix and Linux network configuration. Multiple network interfaces. Bridged NICs. High-availability network configurations.

Applications

Reviews of latest Unix and Linux software. Helpful tips for application support admins. Automating application support.

Data

Disk partitioning, filesystems, directories, and files. Volume management, logical volumes, HA filesystems. Backups and disaster recovery.

Monitoring

Distributed server monitoring. Server performance and capacity planning. Monitoring applications, network status and user activity.

Commands & Shells

Cool Unix shell commands and options. Command-line tools and application. Things every Unix sysadmin needs to know.

Home » Commands & Shells

Uninstall PostgreSQL from Ubuntu

Submitted by on January 4, 2013 – 1:22 pm 2 Comments

Ok, so this is a very simple one: uninstall PostgreSQL running on Ubuntu. There are a bunch of pieces to the database server and just running “apt-get remove postgresql” will still leave you with with a bunch of leftovers:

root@gritty:/var/www# ps -ef | grep post
postgres  1247     1  0 11:24 ?        00:00:00 /usr/lib/postgresql/9.1/bin/postgres -D /var/lib/postgresql/9.1/main -c config_file=/etc/postgresql/9.1/main/postgresql.conf
postgres  1249  1247  0 11:24 ?        00:00:00 postgres: writer process                       postgres  1250  1247  0 11:24 ?        00:00:00 postgres: wal writer process                postgres  1251  1247  0 11:24 ?        00:00:00 postgres: autovacuum launcher process                                                                  
postgres  1252  1247  0 11:24 ?        00:00:00 postgres: stats collector process

root@gritty:/var/www# dpkg -l | grep postgres
ii  postgresql-9.1                     9.1.6-1                        amd64        object-relational SQL database, version 9.1 server
ii  postgresql-client                  9.1+136                        all          front-end programs for PostgreSQL (supported version)
ii  postgresql-client-9.1              9.1.6-1                        amd64        front-end programs for PostgreSQL 9.1
ii  postgresql-client-common           136                            all          manager for multiple PostgreSQL client versions
ii  postgresql-common                  136                            all          PostgreSQL database-cluster manager
ii  postgresql-contrib                 9.1+136                        all          additional facilities for PostgreSQL (supported version)
ii  postgresql-contrib-9.1             9.1.6-1                        amd64        additional facilities for PostgreSQL
ii  postgresql-doc                     9.1+136                        all          documentation for the PostgreSQL database management system
ii  postgresql-doc-9.1                 9.1.6-1                        all          documentation for the PostgreSQL database management system

A simple way to get everything without thinking too hard is using dpkg and a “while” loop:
root@gritty:/var/www# dpkg -l | grep postgres | awk '{print $2}' | while read line ; do apt-get -y --purge remove $line ; done

This method can be used to easily remove other applications that come in multiple modules.

Print Friendly, PDF & Email

2 Comments »

  • RxP DarkBox says:

    Hello
    How can Imy database from database server to antoher server. I amk written a programe into C#.Net 2005.

    It was easy to take backup from SQLServer to device from SQL Script.

    I am not getting that How can I backup database in http or ftp address.

    Please help me if you can…

    Thanks Manay Many in Advance

  • PolishPokeyPimp says:

    I need to add QuickBooks 2009 to our server. I already have the server installed but I want to add QuickBooks. How can I do this without re-adding a database or server? We have several users, using this software in different locations on their own computers.

Leave a Reply

%d bloggers like this: