¿Cómo purgar y reinstalar postgresql en ubuntu? [cerrado]


De alguna manera me las he arreglado para bugger completamente la instalación de postgresql en Ubuntu karmic. Quiero empezar de nuevo desde cero, pero cuando "purgo" el paquete con apt-get todavía deja rastros detrás de tal manera que la configuración de reinstalación no se ejecuta correctamente.

Después de haber hecho:

apt-get purge postgresql
apt-get install postgresql

Dijo

Setting up postgresql-8.4 (8.4.3-0ubuntu9.10.1) ...
Configuring already existing cluster (configuration: /etc/postgresql/8.4/main, data: /var/lib/postgresql/8.4/main, owner: 108:112)
Error: move_conffile: required configuration file     /var/lib/postgresql/8.4/main/postgresql.conf does not exist
Error: could not create default cluster. Please create it manually with

  pg_createcluster 8.4 main --start

or a similar command (see 'man pg_createcluster').
update-alternatives: using /usr/share/postgresql/8.4/man/man1/postmaster.1.gz to provide /usr/share/man/man1/postmaster.1.gz (postmaster.1.gz) in auto mode.

Setting up postgresql (8.4.3-0ubuntu9.10.1) ...

Tengo un "/etc/postgresql" sin nada en él y "/etc/postgresql-common/" tiene un 'pg_upgradecluser.d ' directorio y raíz.crt y user_clusters file.

El /etc/passwd tiene un usuario postgres; el script de purga no parece tocarlo. Ha habido un montón de síntomas con los que trabajo solo para exponer los siguientes.

Justo en este segundo, cuando corro el comando "pg_createcluster..."se queja de que '/var/lib/postgresql/8.4/main/postgresql.conf no existe', así que iré a buscar uno de esos, pero estoy seguro de que no será el final de la misma.

¿No hay alguna línea fácil (o dos) que lo quemará completamente y déjame empezar de nuevo?

Author: Mithun Sreedharan, 2010-05-01

9 answers

Primero: Si su instalación no está dañada, puede dejar servidores PostgreSQL no deseados ("clústeres") en Ubuntu usando pg_dropcluster. Use eso en lugar de una purga completa y reinstale si solo desea comenzar con una instancia de PostgreSQL recién initdb'd.

Si realmente necesita hacer una purga completa y reinstalar, primero asegúrese de que PostgreSQL no se esté ejecutando. ps -C postgres no debe mostrar resultados.

Ahora corre:

apt-get --purge remove postgresql\*

Para eliminar todo PostgreSQL de su sistema. Solo purgando el postgres el paquete no es suficiente ya que es solo un meta-paquete vacío.

Una vez que se hayan eliminado todos los paquetes de PostgreSQL, ejecute:

rm -r /etc/postgresql/
rm -r /etc/postgresql-common/
rm -r /var/lib/postgresql/
userdel -r postgres
groupdel postgres

Ahora deberías ser capaz de:

apt-get install postgresql

O para una instalación completa:

apt-get install postgresql-8.4 postgresql-contrib-8.4 postgresql-doc-8.4
 402
Author: John Mee,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-09 02:55:33

Tuve una situación similar: necesitaba purgar postgresql 9.1 en un debian wheezy ( anteriormente había migrado desde la versión 8.4 y estaba recibiendo errores ).

Lo que hice:

Primero, borré la configuración y la base de datos

$ sudo pg_dropcluster --stop 9.1 main

Luego se elimina postgresql

$ sudo apt-get remove --purge postgresql postgresql-9.1 

Y luego reinstalar

$ sudo apt-get install postgresql postgresql-9.1

En mi caso noté que/etc / postgresql / 9.1 estaba vacío, y ejecutar service postgresql start no devolvió nada

Así que, después de más googlear llegué a este comando:

$ sudo pg_createcluster 9.1 main

Con eso yo podría iniciar el servidor, pero ahora estaba recibiendo errores relacionados con el registro. Después de más búsquedas, terminé cambiando los permisos al directorio/var/log / postgresql

$ sudo chown root.postgres /var/log/postgresql
$ sudo chmod g+wx /var/log/postgresql

Que solucionó el problema, espero que esto ayude

 36
Author: xyz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-14 22:44:42

Sé que ya se ha proporcionado una respuesta, pero dselect no funcionó para mí. Esto es lo que funcionó para encontrar los paquetes a eliminar:

# search postgr  | grep ^i
i   postgresql                      - object-relational SQL database (supported 
i A postgresql-8.4                  - object-relational SQL database, version 8.
i A postgresql-client-8.4           - front-end programs for PostgreSQL 8.4     
i A postgresql-client-common        - manager for multiple PostgreSQL client ver
i A postgresql-common               - PostgreSQL database-cluster manager       

# aptitude purge postgresql-8.4 postgresql-client-8.4 postgresql-client-common postgresql-common postgresql

rm -r /etc/postgresql/
rm -r /etc/postgresql-common/
rm -r /var/lib/postgresql/

Finalmente, editando /etc /passwd y/etc / group

 11
Author: Klaas van Schelven,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-07-14 19:55:50

Pasos que trabajó para mí en Ubuntu 8.04.2 para quitar postgres 8.3

  1. Lista todos los paquetes relacionados con Postgres

    dpkg -l | grep postgres
    
    ii  postgresql                            8.3.17-0ubuntu0.8.04.1           object-relational SQL database (latest versi
    ii  postgresql-8.3                        8.3.9-0ubuntu8.04                object-relational SQL database, version 8.3
    ii  postgresql-client                     8.3.9-0ubuntu8.04                front-end programs for PostgreSQL (latest ve
    ii  postgresql-client-8.3                 8.3.9-0ubuntu8.04                front-end programs for PostgreSQL 8.3
    ii  postgresql-client-common              87ubuntu2                        manager for multiple PostgreSQL client versi
    ii  postgresql-common                     87ubuntu2                        PostgreSQL database-cluster manager
    ii  postgresql-contrib                    8.3.9-0ubuntu8.04                additional facilities for PostgreSQL (latest
    ii  postgresql-contrib-8.3                8.3.9-0ubuntu8.04                additional facilities for PostgreSQL
    
  2. Remove all above listed

    sudo apt-get --purge remove postgresql postgresql-8.3  postgresql-client  postgresql-client-8.3 postgresql-client-common postgresql-common  postgresql-contrib postgresql-contrib-8.3
    
  3. Elimine las siguientes carpetas

    sudo rm -rf /var/lib/postgresql/
    sudo rm -rf /var/log/postgresql/
    sudo rm -rf /etc/postgresql/
    
 11
Author: Mithun Sreedharan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-03-08 14:29:00
apt-get purge postgresql*

Es suficiente.

 10
Author: Anish Menon,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-07-03 04:43:23

Siguiendo ae los pasos que seguí para desinstalar y reinstalar. Lo cual funcionó para mí.

Primero retire los postgres instalados:-

Sudo apt-get purge postgr *

Sudo apt-get autoremove

A continuación, instale 'synaptic':

Sudo apt-get install synaptic

Sudo apt-get update

A continuación, instale postgres

Sudo apt-get install postgresql postgresql-contrib

 7
Author: Gurudath BN,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-06-03 09:25:21

Acabo de encontrarme con el mismo problema para Ubuntu 13.04. Estos comandos eliminaron Postgres 9.1:

sudo apt-get purge postgresql
sudo apt-get autoremove postgresql

Se me ocurre que quizás solo sea necesario el segundo comando, pero desde allí pude instalar Postgres 9.2 (sudo apt-get install postgresql-9.2).

 2
Author: Jeromy French,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-10-02 03:10:29

Estaba siguiendo las respuestas, Al editar /etc/group también borré esta línea:

ssl-cert:x:112:postgres

Entonces, al intentar instalar postgresql, obtuve este error

Preconfiguring packages ...
dpkg: unrecoverable fatal error, aborting:
 syntax error: unknown group 'ssl-cert' in statoverride file
E: Sub-process /usr/bin/dpkg returned an error code (2)

Poner la línea" ssl-cert:x:112:postgres " en /etc/group parece solucionarlo (así que pude instalar postgresql)

 0
Author: nivniv,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-09-05 12:32:31

Me enfrentaba al mismo problema en mi ubuntu 16.04

Pero arreglé ese problema y es muy simple simplemente siga estos pasos y podrá instalar postgresql 10 en su sistema :

Añade esto a tus fuentes.lista:

sudo vim /etc/apt/sources.list

deb http://ftp.de.debian.org/debian/ wheezy main non-free contrib

deb-src http://ftp.de.debian.org/debian/ wheezy main non-free contrib

Después de eso agregue estos enlaces a su pgdg.archivo de la lista si no está allí usted tiene que crear & & añadir enlace & & guardarlo.

sudo vim /etc/apt/sources.list.d/pgdg.list

deb http://apt.postgresql.org/pub/repos/apt/ xenial-pgdg main

deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main

Luego actualice su sistema

sudo apt-get update

sudo apt-get upgrade

E instala las dependencias no satisfechas:

apt-get install ssl-cert

Eso es todo. ahora Instalar postgresql usando estos comandos

sudo apt-get install postgresql-10
 -1
Author: John Toppo,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-05-01 12:10:20