Полностью удалить postgresql linux centos

Полностью удалить postgresql linux centos

The purpose of uninstalling PostgreSQL on CentOS is to remove the PostgreSQL software and all associated components from the system. There could be several reasons to uninstall PostgreSQL, such as upgrading or downgrading with different versions, reinstalling, releasing disk space, and many more.

This article will teach the step-by-step procedure to uninstall PostgreSQL from CentOS.

— How to Uninstall PostgreSQL on CentOS?
— Stop the PostgreSQL Service
— Remove the PostgreSQL Package
— Remove the PostgreSQL Data Directory
— Remove the PostgreSQL User

How to Uninstall PostgreSQL on CentOS?

Uninstalling PostgreSQL on CentOS refers to the process of removing PostgreSQL software and all associated components, such as the data directory, configuration files, and user accounts, from a CentOS system.

To uninstall PostgreSQL on CentOS, follow the below steps:

Step 1: Stop the PostgreSQL Service

Before users uninstall PostgreSQL, users need to stop the PostgreSQL service. For this, run the following command:

$ systemctl stop postgresql

img

Step 2: Remove the PostgreSQL Package

Once the service has stopped, remove the PostgreSQL package using the “yum” package manager. To do this, run the following command:

$ sudo yum remove postgresql-server postgresql-contrib

img

img

This command removes the PostgreSQL server and the contrib package.

Step 3: Remove the PostgreSQL Data Directory

After removing the package, users need to remove the PostgreSQL data directory. By default, the data directory is located at “/var/lib/pgsql/data”. To remove this directory and its contents execute the following command:

$ sudo rm -rf /var/lib/pgsql/data

img

Step 4: Remove the PostgreSQL User

Finally, users need to remove the PostgreSQL user. For this, run the below command as the root user:

img

This command removes the PostgreSQL user from the system.

To uninstall PostgreSQL from CentOS, execute the “yum remove postgresql-server postgresql-contrib” command. It removes all the associated packages with the dependencies. Users can also remove the PostgreSQL data directory by running the “sudo rm -rf /var/lib/pgsql/data” command in the terminal. This article has presented step-by-step guidelines to uninstall PostgreSQL from CentOS.

Источник

How to Uninstall PostgreSQL (Linux, Mac, and Windows)

uninstall PostgreSQL in Ubuntu

In this PostgreSQL tutorial, we will learn how to uninstall PostgreSQL from different operating systems. The possible reasons for uninstalling PostgreSQL could be the project is complete and you don’t need PostgreSQL, the software is at fault or broken, unable to update the PostgreSQL so want to reinstall with the latest version, etc.

  1. How to Uninstall PostgreSQL in Ubuntu
  2. How to uninstall PostgreSQL in Mac using Brew
  3. How to Uninstall PostgreSQL in Linux
  4. How to uninstall PostgreSQL in windows 10
Читайте также:  Sshd service in linux

How to Uninstall PostgreSQL in Ubuntu

In this section, we will learn how to completely uninstall PostgreSQL from Ubuntu. Ubuntu is the Debian package of Linux. We are using Ubuntu version 20.04 LTS but this method can be used for Ubuntu 16, 18, and 21.

  • We are uninstalling PostgreSQL with all of its dependencies from the Ubuntu operating system. The entire process is divided into three parts.
    • Uninstall the PostgreSQL application
    • Remove dependencies
    • Remove Folders
    • Remove users (optional)
    sudo apt --purge remove postgresql -y

    uninstall PostgreSQL in Ubuntu

    How to Uninstall PostgreSQL

    • Before we can remove PostgreSQL dependencies it is important to have a look on all the dependencies. We are calling this process important because even at this stage you can save things before it is gone forever.
    • Dependencies can be removed by passing the name of each file mentioned in the above diagram.
    • A screen will prompt asking for confirmation simply click enter for yes.
    sudo apt-get --purge remove postgresql postgresql-13 postgresql-client-13 postgresql-client-common postgresql-common 

    How to Uninstall PostgreSQL in Ubuntu

    • We have to remove three PostgreSQL folders that are present in lib, var and etc folders.
    sudo rm -rf /var/lib/postgresql/ sudo rm -rf /var/log/postgresql/ sudo rm -rf /etc/postgresql/
    • The last step in the process is to remove the users created in PostgreSQL. By default, we have Postgres user created while installing PostgreSQL. If you have created any other user you can remove it with the same command just by replacing the Postgres with your username.

    How to Uninstall PostgreSQL in Mac using Brew

    In this section, we will learn how to uninstall PostgreSQL in Mac using Brew. In our blog Install PostgreSQL on Macintosh (Mac) we have shared the installation of PostgreSQL through the PostgreSQL app. So in this section, we’ll see how to remove the PostgreSQL app in Mac.

    • The best and easiest way to uninstall PostgreSQL completely from the Mac is by using the
      uninstall-postgres.app.
    • Navigate to the directory /Library/PostgreSQL/13. Here 13 is the version of PostgreSQL installed in your system.
    • There you will see a file uninstall-postgres.app, click to open the file.
    • The screen will appear with two options, select Entire application and click the Next button.
    • On the next screen, select all the checkboxes under the select components to uninstall and click on the Next button.
    • PostgreSQL will be uninstalled from the Mac and a confirmation prompt for the same will appear on the screen.

    How to Uninstall PostgreSQL in Linux

    In this section, we will cover how to uninstall PostgreSQL in Linux. We have covered How to Uninstall PostgreSQL from Debian Package so now we will see how to uninstall PostgreSQL from the RPM package in Linux.

    • RPM package include Red Hat, Centos, Fedora, etc. So if you are using one of these then you can follow the commands provided in this section.
    • First step towards uninstalling Postgres in Linux is to view the packages and their dependencies. Below mentioned command will list all the packages and dependencies.

    How to Uninstall PostgreSQL in Mac using Brew

    • Last step in the process is to remove the PostgreSQL from Linux. We are removing all the packages with the command.
    # remove all the packages sudo yum remove postgres\*

    uninstall postgres from rpm package in linux

    Postgresql uninstallation completed in rpm package of Linux

    How to uninstall PostgreSQL in windows 10

    In this section, we will learn how to uninstall PostgreSQL in Windows 10. These steps can be followed on Windows 7 and windows 8, 8.1.

    • Open Control Panel
    • Right-click on the Postgres 13 and select uninstall
    • Select the radio button ‘Entire application‘ and click on Next.
    • Select all the checkboxes and click on Next.
    • A prompt will appear confirming that PostgreSQL has been uninstalled.

    You may like the following PostgreSQL tutorials:

    In this tutorial, we have learned how to uninstall PostgreSQL from different operating systems. Also, we have covered these topics.

    • How to Uninstall PostgreSQL in Ubuntu
    • How to Uninstall PostgreSQL in Mac using Brew
    • How to Uninstall PostgreSQL in Linux
    • How to uninstall PostgreSQL in windows 10

    I am Bijay having more than 15 years of experience in the Software Industry. During this time, I have worked on MariaDB and used it in a lot of projects. Most of our readers are from the United States, Canada, United Kingdom, Australia, New Zealand, etc.

    Want to learn MariaDB? Check out all the articles and tutorials that I wrote on MariaDB. Also, I am a Microsoft MVP.

    Источник

    CentOS

    Is there any possible way of removing ALL data related to postgresql?

    But i dont thing it removes everything.
    I want to do it, because i want to re-install everything again (postgresql,postgres-server, etc..)

    TrevorH Site Admin Posts: 32853 Joined: 2009/09/24 10:40:56 Location: Brighton, UK

    Re: Removing postgresql

    Post by TrevorH » 2011/06/13 18:59:37

    [code]
    yum remove postgres\*
    mv /var/lib/pgsql /var/lib/old.pgsql
    yum install postgres-whatever
    [/code]

    Please be aware that postgres-libs is a dependency for a large number of packages so running yum remove postgres\* may nuke considerably more than you expect so make sure you inspect the list of packages carefully before you blindly say ‘y’!

    Re: Removing postgresql

    Post by fgoncalo » 2011/06/14 00:14:43

    Thank you very much for your answer. I’m going to give it a try, first thing tomorrow.
    I’ll let you know if it worked for me.

    I’m trying this, because I am trying to (re)install Postgresql. And when i try to command service postgresql-9.0 start it outputs FAILED.

    Once again, thank you for your time,
    Filipe

    pschaff Retired Moderator Posts: 18276 Joined: 2006/12/13 20:15:34 Location: Tidewater, Virginia, North America Contact:

    Removing postgresql

    Post by pschaff » 2011/06/14 12:28:49

    [quote]
    fgoncalo wrote:
    .
    I’m trying this, because I am trying to (re)install Postgresql. And when i try to command service postgresql-9.0 start it outputs FAILED.
    . [/quote]
    You are not running CentOS postgresql-server as there is no such service. The CentOS packages are:
    postgresql-server-8.1.23-1.el5_6.1
    postgresql84-server-8.4.7-1.el5_6.1

    Both provide /etc/rc.d/init.d/postgresql and not «postgresql-9.0». None of the well-known repos provides postgresql 9.0. The previous advice may not be applicable.

    Re: Removing postgresql

    Post by fgoncalo » 2011/06/14 13:39:04

    So shall i remove evrything about postgresql that i have on my pc, and re install those packages that you’ve mentioned? Via yum?

    Thank you for your time,
    Filipe

    pschaff Retired Moderator Posts: 18276 Joined: 2006/12/13 20:15:34 Location: Tidewater, Virginia, North America Contact:

    Re: Removing postgresql

    Post by pschaff » 2011/06/14 20:46:50

    If you want to reinstall then remove all you have installed, but given the «foreign» version it may not have been installed by the package manager, which would make things more difficult.

    You don’t want to install both package I mentioned. They are alternative versions, and you will need others.[code]
    # yum list postgresql\*
    Loaded plugins: fastestmirror, priorities
    Loading mirror speeds from cached hostfile
    Excluding Packages from CentOS-5 — Extras
    Finished
    95 packages excluded due to repository priority protections
    Installed Packages
    postgresql.i386 8.1.23-1.el5_6.1 installed
    postgresql-libs.i386 8.1.23-1.el5_6.1 installed
    postgresql-python.i386 8.1.23-1.el5_6.1 installed
    postgresql-server.i386 8.1.23-1.el5_6.1 installed
    Available Packages
    postgresql-contrib.i386 8.1.23-1.el5_6.1 updates
    postgresql-devel.i386 8.1.23-1.el5_6.1 updates
    postgresql-docs.i386 8.1.23-1.el5_6.1 updates
    postgresql-jdbc.i386 8.1.407-1jpp.4 base
    postgresql-odbc.i386 08.01.0200-3.1 base
    postgresql-pl.i386 8.1.23-1.el5_6.1 updates
    postgresql-tcl.i386 8.1.23-1.el5_6.1 updates
    postgresql-test.i386 8.1.23-1.el5_6.1 updates
    postgresql84.i386 8.4.7-1.el5_6.1 updates
    postgresql84-contrib.i386 8.4.7-1.el5_6.1 updates
    postgresql84-devel.i386 8.4.7-1.el5_6.1 updates
    postgresql84-docs.i386 8.4.7-1.el5_6.1 updates
    postgresql84-libs.i386 8.4.7-1.el5_6.1 updates
    postgresql84-plperl.i386 8.4.7-1.el5_6.1 updates
    postgresql84-plpython.i386 8.4.7-1.el5_6.1 updates
    postgresql84-pltcl.i386 8.4.7-1.el5_6.1 updates
    postgresql84-python.i386 8.4.7-1.el5_6.1 updates
    postgresql84-server.i386 8.4.7-1.el5_6.1 updates
    postgresql84-tcl.i386 8.4.7-1.el5_6.1 updates
    postgresql84-test.i386 8.4.7-1.el5_6.1 updates
    [/code]

    • CentOS General Purpose
    • ↳ CentOS — FAQ & Readme First
    • ↳ Announcements
    • ↳ CentOS Social
    • ↳ User Comments
    • ↳ Website Problems
    • CentOS 8 / 8-Stream / 9-Stream
    • ↳ 8 /8-Stream / 9-Stream — General Support
    • ↳ 8 /8-Stream / 9-Stream — Hardware Support
    • ↳ 8 /8-Stream / 9-Stream — Networking Support
    • ↳ 8 /8-Stream / 9-Stream — Security Support
    • CentOS 7
    • ↳ CentOS 7 — General Support
    • ↳ CentOS 7 — Software Support
    • ↳ CentOS 7 — Hardware Support
    • ↳ CentOS 7 — Networking Support
    • ↳ CentOS 7 — Security Support
    • CentOS Legacy Versions
    • ↳ CentOS 5
    • ↳ CentOS 5 — General Support
    • ↳ CentOS 5 — Software Support
    • ↳ CentOS 5 — Hardware Support
    • ↳ CentOS 5 — Networking Support
    • ↳ CentOS 5 — Server Support
    • ↳ CentOS 5 — Security Support
    • ↳ CentOS 5 — Oracle Installation and Support
    • ↳ CentOS 5 — Miscellaneous Questions
    • ↳ CentOS 6
    • ↳ CentOS 6 — General Support
    • ↳ CentOS 6 — Software Support
    • ↳ CentOS 6 — Hardware Support
    • ↳ CentOS 6 — Networking Support
    • ↳ CentOS 6 — Security Support

    Powered by phpBB® Forum Software © phpBB Limited

    Источник

Оцените статью
Adblock
detector