How do I uninstall old version of LibreOffice?

I gonna update my LibreOffice 3.5.7.2 to 4.0.1. Manual shouts If you have a previous version of LibreOffice already installed, then you will need to de-install it before proceeding further. But how do I uninstall it properly? P.S.I have Ubuntu 12.04.


Solution 1:

You can uninstall the old version with sudo apt-get remove --purge libreoffice-common if it was installed via apt-get.

You can find a good tutorial on how to install Libre Office 4 here.

Solution 2:

One way to find and remove specific versions of LibreOffice is to first list what is installed, and then purge a specific group of packages.

For example, I test various versions of LibreOffice, so I end up with quite a few versions lingering on my computer.

You can use the following command to see what is installed:

dpkg -l | grep libreoffice | awk '{print $1,$2,$3}'

Explanation:

  • dpkg -l lists installed packages in a table
  • grep libreoffice will only return the lines that contain the string "libreoffice"
  • awk '{print $1,$2,$3}' allows picking only specific columns, in this case the three first ones. If you don't use this step, and stop at grep libreoffice, you will get more information - which might be useful, for example to know what the description of the package is. The three columns selected here are: the status of the package, its name, and its version.

You can now find the part of the name that is specific to a version you want to remove. For example, here is a sample of what I have listed:

[...]
ii libreoffice-style-colibre 1:7.0.4~rc2-0ubuntu0.18.04.2
ii libreoffice-style-elementary 1:7.0.4~rc2-0ubuntu0.18.04.2
rc libreoffice-style-tango 1:6.4.6~rc2-0ubuntu0.18.04.1
ii libreoffice-style-yaru 1:7.0.4~rc2-0ubuntu0.18.04.2
ii libreoffice-wiki-publisher 1.2.0+LibO7.0.4~rc2-0ubuntu0.18.04.2
ii libreoffice-writer 1:7.0.4~rc2-0ubuntu0.18.04.2
ii libreoffice7.0 7.0.0.3-3
ii libreoffice7.0-base 7.0.0.3-3
ii libreoffice7.0-calc 7.0.0.3-3
ii libreoffice7.0-debian-menus 7.0.0-3
ii libreoffice7.0-dict-en 7.0.0.3-3
ii libreoffice7.0-dict-es 7.0.0.3-3
ii libreoffice7.0-dict-fr 7.0.0.3-3
ii libreoffice7.0-draw 7.0.0.3-3
ii libreoffice7.0-en-us 7.0.0.3-3
ii libreoffice7.0-impress 7.0.0.3-3
ii libreoffice7.0-math 7.0.0.3-3
ii libreoffice7.0-ure 7.0.0.3-3
ii libreoffice7.0-writer 7.0.0.3-3
ii libreofficedev7.1 7.1.0.0.beta1-1
ii libreofficedev7.1-base 7.1.0.0.beta1-1
ii libreofficedev7.1-calc 7.1.0.0.beta1-1
ii libreofficedev7.1-debian-menus 7.1.0-0
ii libreofficedev7.1-dict-en 7.1.0.0.beta1-1
ii libreofficedev7.1-dict-es 7.1.0.0.beta1-1
ii libreofficedev7.1-dict-fr 7.1.0.0.beta1-1
ii libreofficedev7.1-draw 7.1.0.0.beta1-1
ii libreofficedev7.1-en-us 7.1.0.0.beta1-1
ii libreofficedev7.1-impress 7.1.0.0.beta1-1
ii libreofficedev7.1-math 7.1.0.0.beta1-1
ii libreofficedev7.1-ure 7.1.0.0.beta1-1
ii libreofficedev7.1-writer 7.1.0.0.beta1-1
ii lodevbasis7.1-libreofficekit-data 7.1.0.0.beta1-1

My main current version is 7.0.4, but there is an old 7.0.0 version in there, and also a development version.

To remove the old 7.0.0 version, I can do:

sudo apt purge libreoffice7*

And to remove the development version, I can do:

sudo apt purge libreofficedev*

Using purge instead of a simple remove also gets rid of the configuration files, not just the binaries.

(solution inspired by: https://ubuntuforums.org/showthread.php?t=2388537 )