среда, 19 декабря 2018 г.

Удаление PostgreSQL 10.3-3.1C

Аналог apt-get purge для yum
ubuntu
$ dpkg -l | grep postgresql
ii  pgdg-keyring                          2018.2                                     all          keyring for apt.postgresql.org
hi  postgresql-10                         10.3-3.1C                                  amd64        object-relational SQL database, version 10 server
hi  postgresql-10-dbg                     10.3-3.1C                                  amd64        debug symbols for postgresql-10
hi  postgresql-client-10                  10.3-3.1C                                  amd64        front-end programs for PostgreSQL 10
hi  postgresql-client-common              195.pgdg16.04+1                            all          manager for multiple PostgreSQL client versions
hi  postgresql-common                     195.pgdg16.04+1                            all          PostgreSQL database-cluster manager
hi  postgresql-doc-10                     10.3-3.1C                                  all          documentation for the PostgreSQL database management system
hi  postgresql-plperl-10                  10.3-3.1C                                  amd64        PL/Perl procedural language for PostgreSQL 10
hi  postgresql-plpython-10                10.3-3.1C                                  amd64        PL/Python procedural language for PostgreSQL 10
hi  postgresql-plpython3-10               10.3-3.1C                                  amd64        PL/Python 3 procedural language for PostgreSQL 10
hi  postgresql-pltcl-10                   10.3-3.1C                                  amd64        PL/Tcl procedural language for PostgreSQL 10
hi  postgresql-server-dev-10              10.3-3.1C                                  amd64        development files for PostgreSQL 10 server-side programming



$ sudo dpkg -r postgresql-plpython-10
$ sudo dpkg -r postgresql-plpython3-10
$ sudo dpkg -r postgresql-plperl-10
$ sudo dpkg -r postgresql-pltcl-10
$ sudo dpkg -r postgresql-10-dbg
$ sudo dpkg -r postgresql-10

$ sudo dpkg --purge postgresql-10
$ sudo dpkg -r  postgresql-client-10
$ sudo dpkg -r  postgresql-doc-10
$ sudo dpkg -r postgresql-server-dev-10

Если полностью, то

$ sudo apt remove postgresql-client-common
$ sudo apt remove postgresql-common

$ dpkg -l | grep postgresql
ii  pgdg-keyring                          2018.2                                     all          keyring for apt.postgresql.org
hi  postgresql-client-common              195.pgdg16.04+1                            all          manager for multiple PostgreSQL client versions
hi  postgresql-common                     195.pgdg16.04+1                            all          PostgreSQL database-cluster manager


mkdir -p /tmp/post
cp /home/user/test/postgresql_10.5_9.1C_amd64_deb.tar.bz2 /tmp/post/
cp /home/user/test/postgresql_10.5_9.1C_amd64_addon_deb.tar.bz2 /tmp/post/
cd /tmp/post
tar -xvf postgresql_10.5_9.1C_amd64_deb.tar.bz2
cd  postgresql-10.5-9.1C_amd64_deb
sudo dpkg -i *.deb
cd /tmp/post/
tar -xvf postgresql_10.5_9.1C_amd64_addon_deb.tar.bz2
cd postgresql-10.5-9.1C_amd64_addon_deb
sudo dpkg -i *.deb

dpkg -l | grep 10.5-9.1C | awk -F' ' '{print $2}' | sudo xargs apt-mark hold
sudo apt-mark hold postgresql-common postgresql-client-common

sudo -u postgres psql -U postgres -c "alter user postgres with password 'pass';"
sudo cp /etc/postgresql/10/main/postgresql.conf /etc/postgresql/10/main/postgresql.conf.bak
#sudo rm /etc/apt/sources.list.d/postgresql.list
#sudo apt update  -y
#Делаем проверки
#sudo systemctl status postgresql.service
#ss -tunpl | grep 5432
# $ ps aux | grep postgres | grep -- -D
postgres  4914  0.0  0.1 320972 28864 ?        S    08:37   0:00 /usr/lib/postgresql/10/bin/postgres -D /var/lib/postgresql/10/main -c config_file=/etc/postgresql/10/main/postgresql.conf

centos:

$ sudo yum list installed | grep 10.3-3.1C
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
postgresql10.x86_64                   10.3-3.1C                        installed
postgresql10-contrib.x86_64           10.3-3.1C                        installed
postgresql10-debuginfo.x86_64         10.3-3.1C                        installed
postgresql10-devel.x86_64             10.3-3.1C                        installed
postgresql10-docs.x86_64              10.3-3.1C                        installed
postgresql10-libs.x86_64              10.3-3.1C                        installed
postgresql10-plperl.x86_64            10.3-3.1C                        installed
postgresql10-plpython.x86_64          10.3-3.1C                        installed
postgresql10-pltcl.x86_64             10.3-3.1C                        installed
postgresql10-server.x86_64            10.3-3.1C                        installed
postgresql10-test.x86_64              10.3-3.1C                        installed




$ sudo yum remove postgresql10.x86_64
$ sudo yum remove postgresql10-libs.x86_64
$ sudo yum remove postgresql10-debuginfo.x86_64
$ sudo yum remove postgresql10-docs.x86_64
$ sudo yum list installed | grep 10.3-3.1C

Удалить файлы с кластером

$ mkdir -p /tmp/post

$ cp /home/user/test/postgresql_10.5_9.1C_x86_64_rpm.tar.bz2 /tmp/post/
$ cp /home/user/test/postgresql_10.5_9.1C_x86_64_addon_rpm.tar.bz2 /tmp/post/
$ cd /tmp/post
$ tar -xvf postgresql_10.5_9.1C_x86_64_rpm.tar.bz2
$ cd postgresql-10.5-9.1C_x86_64_rpm
$ sudo yum localinstall -y *.rpm
$ cd /tmp/post/
$ tar -xvf postgresql_10.5_9.1C_x86_64_addon_rpm.tar.bz2
$ cd postgresql-10.5-9.1C_x86_64_addon_rpm
$ sudo yum localinstall -y *.rpm
$ sudo su - postgres
-bash-4.2$ /usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data --locale=ru_RU.UTF-8
$ exit
$ sudo systemctl start postgresql-10
$ sudo systemctl enable postgresql-10
#$ sudo systemctl status postgresql-10
#-bash-4.2$ /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data -l logfile start
 $ sudo su - postgres
-bash-4.2$ /usr/pgsql-10/bin/psqlpostgres=# ALTER USER postgres WITH PASSWORD 'pass'
postgres=# exit
-bash-4.2$ psql -l

-bash-4.2$ exit
$ sudo reboot

#$ sudo service postgresql-10 start
#$ sudo chkconfig postgresql-10 on
$ sudo service postgresql-10 status







Комментариев нет:

Отправить комментарий