删除postgresql

时间:2014-09-07 01:07:17

标签: postgresql ubuntu-12.04

我想从Ubuntu 12.04中删除postgresql-9.1

我使用apt-get remove --purge postgresql-9.1

我收到错误* Use of uninitialized value $info{"pgdata"} in -d at /usr/bin/pg_ctlcluster line 331.

我在PGDATA="/var/lib/postgresql/data"

中正确设置了/etc/environment

其他操作,pg_ctl stopservice postgresql stop会产生同样的错误

1 个答案:

答案 0 :(得分:1)

您可以在命令行上尝试:

export PGDATA=/var/lib/postgresql/data

然后再次尝试删除。您可能希望使用不同的-f -m组合来“忽略”错误。

apt-get remove -f -m --purge postgresql-9.1

或者,您可以以root身份删除文件。首先,确保没有运行postgres的东西(ps -ax | grep post)。在我的系统上,我会:

rm -rf /var/lib/postgresql/data
rm -rf /usr/local/pgsql

(小心那些rm -rf命令:-))

需要清理的另一件事是启动和库的东西:试试:

ls / etc / * / postgr

如果你看到这样的文件:

/etc/init.d/postgresql             /etc/rc2.d/S20postgresql
/etc/ld.so.conf.d/postgresql.conf  /etc/rc3.d/S20postgresql
/etc/profile.d/postgres_path.sh    /etc/rc4.d/S20postgresql
/etc/rc0.d/K20postgresql           /etc/rc5.d/S20postgresql
/etc/rc1.d/K20postgresql           /etc/rc6.d/K20postgresql

然后下一步将是他们:

rm -f /etc/*/*postgr*

包的能力管理非常方便。我从来没有用它来删除包,我总是担心这是否真的有效。祝好运。