Удалить postgresql alt linux

Удалить postgresql alt linux

PostgreSQL is among the most popular open-source relational databases that provide a wide range of advantages, including security, stability, extensibility, etc. Users can safely store vast amount of complex data using Postgres. However, when PostgreSQL is no longer needed, you can uninstall it from your Ubuntu operating system.

This blog post will demonstrate how to uninstall Postgres completely from the ubuntu operating system. So, let’s get started!

How to Uninstall Postgres From Ubuntu?

PostgreSQL may need to be uninstalled from a system at some point for various reasons, such as cleaning up the disk space, not needing it anymore, etc. So it’s crucial to understand how to uninstall the PostgreSQL database completely(along with its dependent packages) from your system.

Uninstalling Postgres from Ubuntu can be done using various ways. In this write-up, we are going to discuss a couple of them!

Method 1: Using ‘sudo apt remove postgresql’

This section describes the simplest way of uninstalling Postgres from ubuntu. For that purpose, follow the steps provided below:

Step 1: Uninstall Postgres

To uninstall Postgres from your Ubuntu operating system, open the terminal and run the command below:

sudo apt remove postgresql postgresql-contrib

img

The above snippet demonstrates that Postgres has been removed from Ubuntu.

Step 2: Uninstall Dependent Packages

Some additional(dependent) packages are automatically installed on Ubuntu when you install Postgres. However, when you remove Postgres from ubuntu, these dependent/additional packages are no longer needed. So, to uninstall these dependent packages, the below-mentioned command is used in ubuntu:

img

Type “y” and hit the “Enter” button to remove Postgres from Ubuntu:

img

The whole process will take some time to remove Postgres and its dependent packages completely from ubuntu.

Method 2: Using ‘purge remove postgresql’

If the above method is not working for some reasons, then nothing to worry about! We have explained another very convenient method to uninstall Postgres from your Ubuntu operating system.

Step 1: List Postgres Packages

Run the below-provided command to see the list of Postgres packages currently installed on your ubuntu operating system:

img

The above snippet shows the list of Postgres packages installed on our machine.

Step 2: Uninstall Postgres

Remove Postgres from your system by running the remove purge command followed by the name of all the packages related to Postgres:

sudo apt-get –purge remove postgresql postgresql-14 postgresql-client-common postgresql-common postgresql-contrib

img

Type “y” and hit the “Enter” button to continue the uninstallation process of Postgres:

img

The following window will appear during the uninstallation, asking you to remove Postgres directories when the package is purged:

Читайте также:  Linux find exclude files from

img

Hit the “Yes” button, and it will take a few minutes to complete the uninstallation.

Step 3: Verify Uninstallation

Let’s execute the below statement one more time to verify the uninstallation of Postgres from ubuntu:

img

The above snippet proves that postgres has been uninstalled completely from Ubuntu.

That’s all from this Postgres guide!

To uninstall Postgres from your Ubuntu operating system, open the terminal and run the “sudo apt remove postgresql postgresql-contrib” command. To uninstall the dependent packages from the ubuntu operating system, use the “sudo apt autoremove” command. Another way of removing postgres from ubuntu is by using the “sudo apt-get –purge remove” command followed by the name of packages to be removed. Through practical demonstration, this Postgres blog has explained how to uninstall PostgreSQL from the ubuntu operating system.

Источник

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

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.

    Источник

    How To Remove PostgreSQL

    Sometimes during a software install, things can go sideways and you realize that not all the program downloaded or the installation was interrupted for some reason leaving you with incomplete files and empty directories. Honestly, this is a rare occurrence but it can happen from time to time. This then begs the question; So how do I completely uninstall recently installed software? In this tutorial, we’ll be safely removing PostgreSQL from our Liquid Web Ubuntu VPS server.

    How To Remove PostgreSQL

    Step 1: List the PostgreSQL Packages

    Use the dpkg tool to list packages pertaining to the PostgreSQL setup.

    postgresql

    Step 2: Delete the PostgreSQL Packages

    In Step 1, all of the software packages related to the PostgreSQL install are shown. To remove and delete them all with one command, Start with this command.

    apt-get --purge remove command

    This is followed by each package name indicated separated with a space. For my particular version of PostgreSQL, the software installed was:

    • pgdg-keyring
    • postgresql-10
    • postgresql-client-10
    • postgresql-client-common
    • postgresql-common

    so, my purge remove command will look like this:

    sudo apt-get --purge remove pgdg-keyring postgresql-10 postgresql-client-10 postgresql-client-common postgresql-common

    Step 3: Verifying the Deletion of PostgreSQL

    Once you remove these packages you should no longer be able to enter into the PostgreSQL environment. You can verify that by running the grep command again and searching for postgres:

    root@newclient:~# dpkg -l | grep postgresroot@newclient:~#

    As you can see, there is no output from that command which means, PostgreSQL has been successfully uninstalled!

    If you have other thoughts or questions, our Sales and Support teams are standing by 24 hours a day by phone or e-mail to assist. Reach out to us by opening a support ticket at support@liquidweb.com, giving us a call at 1-800-580-4985 or, open a chat with us and we’ll be happy to answer any questions you may have!

    Thank you for hosting with Liquidweb!

    Источник

    How to uninstall the postgresql

    The simplest way to do this is open a terminal and type:

    sudo apt-get --purge remove postgresql 

    This will remove the postgresql package. There may be chances that additional packages are also installed so you can search them by typing:

    and purge all those packages by sudo apt-get —purge remove .

    Thanks! But still i got some left. Is there a possible way i can delete the postgresql «folder by folder»

    To completely uninstall PostgreSQL

    sudo apt-get purge postgres.* 

    I just want to add that any packages installed using apt, apt-get or from .deb files for example, can be uninstalled using:

    sudo apt-get purge package_name.* 

    List package and all of its dependencies to check what are being uninstalled:

    dpkg --list | grep package_name.* 

    .* after package_name is very important to regex match all possible dependencies associated with a package.

    To completely remove Postgres with dependent packages, I used the following commands on my Ubuntu 20.04.

    First check the postgres installed version
    dpkg -l | grep postgres

    Then use the following command to remove all dependencies. Use your version number.

    $ sudo apt-get --purge remove postgresql-12 postgresql-client-12 postgresql-client-common postgresql-common 

    Источник

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