How to install OpenLDAP on Ubuntu 18.04?

0
236
Directory

OpenLDAP is a free, open-source implementation of the Lightweight Directory Access Protocol (LDAP). With it, you can get a centralized authentication between the members of a network. So, I will show you how to install OpenLDAP on Ubuntu 18.04.

Let’s do it.

0. What you need

Installing OpenLDAP on Ubuntu 18.04 is not a really complicated matter, however, it is necessary to have a basic knowledge about the use of the terminal.

Also, your user needs to be able to execute commands with sudo because some commands require root.

With this in mind, you can start the installation without problems.

1. Upgrade the system

In the first place, you need to upgrade the system. It is recommended to get the latest security patches on your system.

1.- Upgrading the system
1.- Upgrading the system

Now, you can continue.

2. Set the hostname

The first step is to define the hostname. Run this command:

And add it to your /etc/hosts file

2.- Setting the hostname
2.- Setting the hostname

3. Install OpenLDAP

A great advantage of OpenLDAP is that its packages are in the official Ubuntu repositories, which makes installation easy. Just write the following.

2.- Install OpenLDAP from the Ubuntu main repository
3.- Install OpenLDAP from the Ubuntu main repository

After downloading the package and during installation you will have to define and confirm the root password.

3.- Setting the root password
4.- Setting the root password

If you wish to verify that the installation has been carried out effectively. You can use the following command:

4.- Checking the installation
5.- Checking the installation

As you can see in the image above, OpenLDAP is installed correctly.

4. Add base dn for Users and Groups

it is now necessary to configure OpenLDAP. To do this, the first step is to add to base DN for users and groups.

Create a file called basedn.ldif in your home folder or wherever you want.

5.- Creating dn file for OpenLDAP user and group
5.- Creating dn file for OpenLDAP user and group

And add the following:

Of course, replace example and com, for your domain properties.

Next, add the configuration file. Run:

6.- Creating the new configuration file
6.- Creating the new configuration file

Next, install phpLDAPadmin.

5. Install phpLDAPadmin

In order to manage OpenLDAP in a quick and easy way is that you have to install phpLDAPadmin. Let’s do it.

First, install some necessary packages. Among them are Apache web server and PHP.

7.- Installing some required package for phpldapadmin
7.- Installing some required package for phpLDAPadmin

Next, it is necessary to enable the php7.2-cgi extension. Then, restart Apache service.

8.- Enable a necessary php extension
8.- Enable a necessary PHP extension

Then install phpLDAPadmin.

9.- Installing phpLDAPadmin
9.- Installing phpLDAPadmin

The next step is to modify the permissions in the phpLDAPadmin configuration file to receive requests from network members.

And leave it as I show you in the picture.

10.- Configuring phpLDAPadmin
10.- Configuring phpLDAPadmin

With this, we are simply telling phpLDAPadmin to accept requests from network members.

Then, restart Apache.

If you use ufw, you must open ports 80 and 443.

11.- Preparing the firewall
11.- Preparing the firewall

Finally, open your favorite web browser and go to http://IP_SERVER_OR_DOMAIN/phpldapadmin

12.- phpLDAPadmin main page
12.- phpLDAPadmin main page

Next, log in.

13.- Add the credentials on phpLDAPadmin
13.- Add the credentials on phpLDAPadmin

Finally, you will see this.

14.- phpLDAPadmin installed
14.- phpLDAPadmin installed

And that’s it.

Conclusion

As you can see OpenLDAP is easy to install and configure in Ubuntu, it just remains that you can configure it to your needs.

Please share this article with friends.

 

Spread the love
  • 8
    Shares

PS. If you like this post please share it with your friends on the social networks using the buttons above.Thanks.

LEAVE A REPLY

Please enter your comment!
Please enter your name here