How to uninstall OpenLDAP in RedHat?

27,948

Solution 1

Can you make a backup of the configuration and :

yum remove openldap
rpm -e openldap.package_name
yum install openldap

And copy your configuration files back

Solution 2

You're trying to remove the wrong package.

openldap provides only the library files (libldap, liblber, etc.) and it's required by pretty much everything on the system. So when you try to remove it yum goes through the list of dependencies which is pretty much all of it.

The configuration files that you deleted are part of the openldap-servers package (and possibly openldap-clients package). You can remove them as usual: yum remove openldap-servers.

You can check to which package the files belong to by running yum provides <full path or */file> ex. yum provides /etc/openldap/slapd.d or yum provides */ldap.conf

Share:
27,948

Related videos on Youtube

LinuxBegineer
Author by

LinuxBegineer

Updated on September 18, 2022

Comments

  • LinuxBegineer
    LinuxBegineer almost 2 years

    I have installed OpenLDAP with yum, but I have accidentally deleted some of the config files. I am not able to recover them. I want to uninstall it. I tried the following command but it ends with an error:

    --> Processing Dependency: PackageKit-glib = 0.5.8-20.el6 for package: PackageKit-gtk-module-0.5.8-20.el6.x86_64
    --> Running transaction check
    ---> Package PackageKit-device-rebind.x86_64 0:0.5.8-20.el6 will be erased
    ---> Package PackageKit-gstreamer-plugin.x86_64 0:0.5.8-20.el6 will be erased
    ---> Package PackageKit-gtk-module.x86_64 0:0.5.8-20.el6 will be erased
    --> Finished Dependency Resolution Error: Trying to remove "yum", which is protected  You could try using --skip-broken to work around the problem  You could try running: rpm -Va --nofiles --nodigest
    

    Can someone please tell how to uninstall it properly so I can install it again and make the config changes?

    enter image description here

    • Anthon
      Anthon almost 9 years
      Where is the command. It looks like you remove yum with yum (did you cut and paste a command and pasted it twice before hitting return?)
    • LinuxBegineer
      LinuxBegineer almost 9 years
      # yum remove openldap
  • LinuxBegineer
    LinuxBegineer almost 9 years
    There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: libldap-2.4.so.2: cannot open shared object file: No such file or directory Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.6.6 (r266:84292, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
  • mjturner
    mjturner almost 9 years
    @LinuxBegineer You've deleted parts of OpenLDAP, which now prevents yum from running. The solution is to download the OpenLDAP RPM for RHEL 6 and install that manually using rpm. That should fix yum.
  • LinuxBegineer
    LinuxBegineer almost 9 years
    No i accidentally deleted only config file which is inside /etc/openldap/slapd.d/* nothing else
  • mjturner
    mjturner almost 9 years
    @LinuxBegineer Ok. Well, the same suggestion applies - download the OpenLDAP RPM for RHEL6 and reinstall it using rpm.
  • LinuxBegineer
    LinuxBegineer almost 9 years
    I think u did not check my question in detail
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    Your configuration files have not been removed if you did only a yum remove. If you've errors while trying to install openldap back as "no such files or directory" it can mean that openldap as not been removed properly. Those commands stand to remove it properly and install it again. So far if your configuration disappeared from the disk you'd check if you have any backup.
  • LinuxBegineer
    LinuxBegineer almost 9 years
    These error when i am trying to run 'yum remove openldap' There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: libldap-2.4.so.2: cannot open shared object file: No such file or directory Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.6.6 (r266:84292, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
  • LinuxBegineer
    LinuxBegineer almost 9 years
    Now for every command i am getting below exception There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: libldap-2.4.so.2: cannot open shared object file: No such file or directory Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.6.6 (r266:84292, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    Can you try to reinstall libldap only?
  • LinuxBegineer
    LinuxBegineer almost 9 years
    yum install libldap end with the above error
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    What's your OS version?
  • LinuxBegineer
    LinuxBegineer almost 9 years
    Red Hat enterprises Linux Server Releases6.3(Santiago)
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    Can you check if the rpm is still in the cache : find /var/cache -name libldap*.rpm if yes try a rpm -ivh on it otherwise link and do the same
  • nkms
    nkms almost 9 years
    Well, it seems you have deleted the openldap package (or part of it - definitely the lib), so you'll have to find the package for your system and installed it manually. yum will not work, rpm however it will. I'm not sure what system you are running (version 2.4.23 is outdated for rhel6/7 - it's using vers 2.4.39). If it's a rhel/centos 6 download the latest and install: wget ftp.ntua.gr/pub/linux/centos/6/os/x86_64/Packages/… && rpm -ivh openldap-2.4.39-6.el7.x86_64.rpm
  • LinuxBegineer
    LinuxBegineer almost 9 years
    Its not in cache and just browsed the link u provided it have around 500+ result
  • nkms
    nkms almost 9 years
    You'll need access to redhat network (rhn.redhat.com) to download the package manually (yumdownloader will not work). If you don't have access you can download the equivalent centos package (it will work) but if you don't want to upgrade to latest version (2.4.39) you'll need to find a repository which keeps older versions of packages (check vault.centos.org).
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    Try with for find ldap . I can give you the link to the rpm but I need a u name -a pls
  • LinuxBegineer
    LinuxBegineer almost 9 years
    find: `ldap': No such file or directory But still i am able to start or stop openldap and i did not get " I can give you the link to the rpm but I need a u name -a pls " "
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    find / -name *ldap*.rpm and uname -a
  • LinuxBegineer
    LinuxBegineer almost 9 years
    for first one no output and second one "Linux mdfdevapp2 2.6.32-279.el6.x86_64 #1 SMP Wed Jun 13 18:24:36 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux "
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
  • LinuxBegineer
    LinuxBegineer almost 9 years
    SO if i will download rpm and install it again it will download dependency as well?
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    The openldap shall include the dependency broken. Could you try the latest command before download it from the site yum install --downloadonly --downloaddir=/tmp libldap and rpm -ivh /tmp/package_name
  • LinuxBegineer
    LinuxBegineer almost 9 years
    Every yum command end with yum install --downloadonly --downloaddir=/tmp libldap There was a problem importing one of the Python modules required to run yum. The error leading to this problem was: libldap-2.4.so.2: cannot open shared object file: No such file or directory Please install a package which provides this module, or verify that the module is installed correctly. It's possible that the above module doesn't match the current version of Python, which is: 2.6.6 (r266:84292, May 1 2012, 13:52:17) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)]
  • LinuxBegineer
    LinuxBegineer almost 9 years
    Thanks i have rum rpms of ldap now yum command also working
  • Mathieu Coavoux
    Mathieu Coavoux almost 9 years
    Glad to hear that