{"id":5253,"date":"2014-07-24T05:10:46","date_gmt":"2014-07-23T21:10:46","guid":{"rendered":"https:\/\/webhostinggeeks.com\/howto\/?p=5253"},"modified":"2023-04-28T09:48:17","modified_gmt":"2023-04-28T09:48:17","slug":"how-to-install-and-configure-389-ldap-directory-server-on-centos-6-5","status":"publish","type":"post","link":"https:\/\/webhostinggeeks.com\/howto\/how-to-install-and-configure-389-ldap-directory-server-on-centos-6-5\/","title":{"rendered":"How to Install and Configure 389 LDAP Directory Server on CentOS 6.5"},"content":{"rendered":"<p><img decoding=\"async\" class=\"alignleft wp-image-6348 size-full lazyload\" data-src=\"https:\/\/webhostinggeeks.com\/howto\/wp-content\/uploads\/2014\/07\/centos-389.png\" alt=\"Install and Configure 389 LDAP\" width=\"200\" height=\"120\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 200px; --smush-placeholder-aspect-ratio: 200\/120;\" \/>A directory server provides a centralized directory service for your organization. It is alternative to windows active directory. This post will describes how to install and configure\u00a0389 LDAP Directory Server with a basic Lightweight Directory Access Protocol (LDAP) directory implementation. 389 Directory Server was formerly known as the Fedora Directory Server and it is an enterprise-class open source LDAP. 389 Directory server has been developed by Red Hat, as part of Red Hat\u2019s community-supported Fedora Project.<\/p>\n<h4>Steps to\u00a0Install and Configure 389 LDAP Directory Server<\/h4>\n<p><strong>TCP and Files system Tuning :<\/strong><br \/>\na) Decrease the time default value for tcp_keepalive_time connection. Edit the \/etc\/sysctl.conf file and add the following lines to the bottom of sysctl.conf &#8221;<\/p>\n<pre>[root@ldap ~]# echo \"net.ipv4.tcp_keepalive_time = 300\" &gt;&gt; \/etc\/sysctl.conf\nb) Increase number of local system ports available by editing this parameter in the \/etc\/sysctl.conf file :\n<\/pre>\n<pre>[root@ldap ~]# echo \"net.ipv4.ip_local_port_range = 1024 65000\" &gt;&gt; \/etc\/sysctl.conf\n<\/pre>\n<p>c) Increase the file descriptors by running these commands:<\/p>\n<pre>[root@ldap ~]# echo \"64000\" &gt; \/proc\/sys\/fs\/file-max\n[root@ldap-05 ~]# echo \"fs.file-max = 64000\" &gt;&gt; \/etc\/sysctl.conf\n<\/pre>\n<p>d) Increase ulimit in \/etc\/profile :<\/p>\n<pre>[root@ldap ~]# echo \"ulimit -n 8192\" &gt;&gt; \/etc\/profile\n<\/pre>\n<p><strong>389 Installation :<\/strong><\/p>\n<p>1. Prepare EPEL Repository on CentOS 6 :<br \/>\n<a href=\"https:\/\/webhostinggeeks.com\/howto\/how-to-install-and-configure-epel-repository-on-centos-6-2\/\">How to Prepare EPEL Repository on CentOS 6<\/a><\/p>\n<p><strong>What packages and versions are available in EPEL?<\/strong><br \/>\nYou can take a look on any of the available EPEL mirrors from our <a href=\"https:\/\/admin.fedoraproject.org\/mirrormanager\/\">mirror list<\/a><\/p>\n<p>Alternately, you can browse the package set using repoview:<\/p>\n<ul>\n<li>EPEL 6: <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/i386\/repoview\/\">i386<\/a>, <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/x86_64\/repoview\/\">x86_64<\/a>, <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/ppc64\/repoview\/\">ppc64<\/a>, <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/6\/SRPMS\/repoview\/\">sources<\/a><\/li>\n<li>EPEL 5: <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/i386\/repoview\/\">i386<\/a>, <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/x86_64\/repoview\/\">x86_64<\/a>, <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/ppc\/repoview\/\">ppc<\/a>, <a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/SRPMS\/repoview\/\">sources<\/a><\/li>\n<\/ul>\n<p>2. Configure hostname, FQDN and host file has been configured correctly :<\/p>\n<pre>127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4\n::1         localhost localhost.localdomain localhost6 localhost6.localdomain6\n\n192.168.0.5     ldap.ehowstuff.local\n<\/pre>\n<p>3. Make sure selinux is disabled :<br \/>\n<a href=\"https:\/\/webhostinggeeks.com\/howto\/disable-selinux-on-centos-6-5\/\">Disable SELinux on CentOS 6.5<\/a><\/p>\n<p>4. Install the 389 Directory Server packages :<\/p>\n<pre>[root@ldap ~]# yum install 389-ds -y\n<\/pre>\n<p>5. Fix Error: command &#8216;getsebool httpd_can_connect_ldap&#8217; failed &#8211; output [getsebool: SELinux is disabled :<\/p>\n<pre>[root@ldap ~]# mkdir ~\/bin\n[root@ldap ~]# vi ~\/bin\/getsebool\n<\/pre>\n<pre>#!\/bin\/sh\necho on\nexit 0\n<\/pre>\n<pre>[root@ldap ~]# vi ~\/bin\/setsebool\n<\/pre>\n<pre>#!\/bin\/sh\nexit 0\n<\/pre>\n<pre>[root@ldap ~]# chmod +x ~\/bin\/*sebool\n<\/pre>\n<p>6. Run setup script to start configure the ldap service :<\/p>\n<pre>[root@ldap ~]# PATH=~\/bin:$PATH setup-ds-admin.pl\n\n==============================================================================\nThis program will set up the 389 Directory and Administration Servers.\n\nIt is recommended that you have \"root\" privilege to set up the software.\nTips for using this program:\n  - Press \"Enter\" to choose the default and go to the next screen\n  - Type \"Control-B\" then \"Enter\" to go back to the previous screen\n  - Type \"Control-C\" to cancel the setup program\n\nWould you like to continue with set up? [yes]:\n\n==============================================================================\nYour system has been scanned for potential problems, missing patches,\netc.  The following output is a report of the items found that need to\nbe addressed before running this software in a production\nenvironment.\n\n389 Directory Server system tuning analysis version 23-FEBRUARY-2012.\n\nNOTICE : System is x86_64-unknown-linux2.6.32-431.el6.x86_64 (1 processor).\n\nWould you like to continue? [yes]:\n\n==============================================================================\nChoose a setup type:\n\n   1. Express\n       Allows you to quickly set up the servers using the most\n       common options and pre-defined defaults. Useful for quick\n       evaluation of the products.\n\n   2. Typical\n       Allows you to specify common defaults and options.\n\n   3. Custom\n       Allows you to specify more advanced options. This is\n       recommended for experienced server administrators only.\n\nTo accept the default shown in brackets, press the Enter key.\n\nChoose a setup type [2]:\n\n==============================================================================\nEnter the fully qualified domain name of the computer\non which you're setting up server software. Using the form\n.\nExample: eros.example.com.\n\nTo accept the default shown in brackets, press the Enter key.\n\nWarning: This step may take a few minutes if your DNS servers\ncan not be reached or if DNS is not configured correctly.  If\nyou would rather not wait, hit Ctrl-C and run this program again\nwith the following command line option to specify the hostname:\n\n    General.FullMachineName=your.hostname.domain.name\n\nComputer name [ldap.ehowstuff.local]:\n\nWARNING: There are problems with the hostname.\nHostname 'ldap.ehowstuff.local' is valid, but none of the IP addresses\nresolve back to ldap.ehowstuff.local\n- address 192.168.0.5 resolves to host centos6.5.ehowstuff.local\n\nPlease check the spelling of the hostname and\/or your network configuration.\nIf you proceed with this hostname, you may encounter problems.\n\nDo you want to proceed with hostname 'ldap.ehowstuff.local'? [no]: yes\n\n==============================================================================\nThe servers must run as a specific user in a specific group.\nIt is strongly recommended that this user should have no privileges\non the computer (i.e. a non-root user).  The setup procedure\nwill give this user\/group some permissions in specific paths\/files\nto perform server-specific operations.\n\nIf you have not yet created a user and group for the servers,\ncreate this user and group using your native operating\nsystem utilities.\n\nSystem User [nobody]:\nSystem Group [nobody]:\n\n==============================================================================\nServer information is stored in the configuration directory server.\nThis information is used by the console and administration server to\nconfigure and manage your servers.  If you have already set up a\nconfiguration directory server, you should register any servers you\nset up or create with the configuration server.  To do so, the\nfollowing information about the configuration server is required: the\nfully qualified host name of the form\n.(e.g. hostname.example.com), the port number\n(default 389), the suffix, the DN and password of a user having\npermission to write the configuration information, usually the\nconfiguration directory administrator, and if you are using security\n(TLS\/SSL).  If you are using TLS\/SSL, specify the TLS\/SSL (LDAPS) port\nnumber (default 636) instead of the regular LDAP port number, and\nprovide the CA certificate (in PEM\/ASCII format).\n\nIf you do not yet have a configuration directory server, enter 'No' to\nbe prompted to set up one.\n\nDo you want to register this software with an existing\nconfiguration directory server? [no]:\n\n==============================================================================\nPlease enter the administrator ID for the configuration directory\nserver.  This is the ID typically used to log in to the console.  You\nwill also be prompted for the password.\n\nConfiguration directory server\nadministrator ID [admin]:\nPassword:\nPassword (confirm):\n\n==============================================================================\nThe information stored in the configuration directory server can be\nseparated into different Administration Domains.  If you are managing\nmultiple software releases at the same time, or managing information\nabout multiple domains, you may use the Administration Domain to keep\nthem separate.\n\nIf you are not using administrative domains, press Enter to select the\ndefault.  Otherwise, enter some descriptive, unique name for the\nadministration domain, such as the name of the organization\nresponsible for managing the domain.\n\nAdministration Domain [ehowstuff.local]:\n\n==============================================================================\nThe standard directory server network port number is 389.  However, if\nyou are not logged as the superuser, or port 389 is in use, the\ndefault value will be a random unused port number greater than 1024.\nIf you want to use port 389, make sure that you are logged in as the\nsuperuser, that port 389 is not in use.\n\nDirectory server network port [389]:\n\n==============================================================================\nEach instance of a directory server requires a unique identifier.\nThis identifier is used to name the various\ninstance specific files and directories in the file system,\nas well as for other uses as a server instance identifier.\n\nDirectory server identifier [ldap]:\n\n==============================================================================\nThe suffix is the root of your directory tree.  The suffix must be a valid DN.\nIt is recommended that you use the dc=domaincomponent suffix convention.\nFor example, if your domain is example.com,\nyou should use dc=example,dc=com for your suffix.\nSetup will create this initial suffix for you,\nbut you may have more than one suffix.\nUse the directory server utilities to create additional suffixes.\n\nSuffix [dc=ehowstuff, dc=local]:\n\n==============================================================================\nCertain directory server operations require an administrative user.\nThis user is referred to as the Directory Manager and typically has a\nbind Distinguished Name (DN) of cn=Directory Manager.\nYou will also be prompted for the password for this user.  The password must\nbe at least 8 characters long, and contain no spaces.\nPress Control-B or type the word \"back\", then Enter to back up and start over.\n\nDirectory Manager DN [cn=Directory Manager]:\nPassword:\nPassword (confirm):\n\n==============================================================================\nThe Administration Server is separate from any of your web or application\nservers since it listens to a different port and access to it is\nrestricted.\n\nPick a port number between 1024 and 65535 to run your Administration\nServer on. You should NOT use a port number which you plan to\nrun a web or application server on, rather, select a number which you\nwill remember and which will not be used for anything else.\n\nAdministration port [9830]:\n\n==============================================================================\nThe interactive phase is complete.  The script will now set up your\nservers.  Enter No or go Back if you want to change something.\n\nAre you ready to set up your servers? [yes]:\nCreating directory server . . .\nWarning: Hostname ldap.ehowstuff.local is valid, but none of the IP addresses\nresolve back to ldap.ehowstuff.local\n        address 192.168.0.5 resolves to host centos6.5.ehowstuff.local\nYour new DS instance 'ldap' was successfully created.\nCreating the configuration directory server . . .\nBeginning Admin Server reconfiguration . . .\nCreating Admin Server files and directories . . .\nUpdating adm.conf . . .\nUpdating admpw . . .\nRegistering admin server with the configuration directory server . . .\nUpdating adm.conf with information from configuration directory server . . .\nUpdating the configuration for the httpd engine . . .\nStarting admin server . . .\noutput: Starting dirsrv-admin:\noutput:                                                    [  OK  ]\nThe admin server was successfully started.\nAdmin server was successfully reconfigured and started.\nExiting . . .\nLog file is '\/tmp\/setupGwS8hs.log'\n<\/pre>\n<p>7. Start dirsrv and dirsrv-admin service :<\/p>\n<pre>[root@ldap ~]# \/etc\/init.d\/dirsrv start\n[root@ldap ~]# \/etc\/init.d\/dirsrv-admin start\n<\/pre>\n<p>8. Make dirsrv and dirsrv-admin service auto start at boot :<\/p>\n<pre>[root@ldap ~]# chkconfig dirsrv on\n[root@ldap ~]# chkconfig dirsrv-admin on\n<\/pre>\n<p>9. Configure Iptables to allow server listen on port 22, 389 and 9830 :<\/p>\n<pre># Firewall configuration written by system-config-firewall\n# Manual customization of this file is not recommended.\n*filter\n:INPUT ACCEPT [0:0]\n:FORWARD ACCEPT [0:0]\n:OUTPUT ACCEPT [0:0]\n-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT\n-A INPUT -p icmp -j ACCEPT\n-A INPUT -i lo -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 389 -j ACCEPT\n-A INPUT -m state --state NEW -m tcp -p tcp --dport 9830 -j ACCEPT\n-A INPUT -j REJECT --reject-with icmp-host-prohibited\n-A FORWARD -j REJECT --reject-with icmp-host-prohibited\nCOMMIT\n<\/pre>\n<p>Restart iptables to take effect the changes :<\/p>\n<pre>[root@ldap ~]# service iptables restart\niptables: Applying firewall rules: [ OK ]\n<\/pre>\n<p>10. Verify port listen by the server using netstat :<\/p>\n<pre>[root@ldap ~]# netstat -plunt | grep LISTEN\ntcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1083\/rpcbind\ntcp 0 0 0.0.0.0:10000 0.0.0.0:* LISTEN 1125\/perl\ntcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1116\/sshd\ntcp 0 0 0.0.0.0:9830 0.0.0.0:* LISTEN 1508\/httpd.worker\ntcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1126\/php-fpm\ntcp 0 0 :::8140 :::* LISTEN 1161\/httpd\ntcp 0 0 :::111 :::* LISTEN 1083\/rpcbind\ntcp 0 0 :::80 :::* LISTEN 1161\/httpd\ntcp 0 0 :::22 :::* LISTEN 1116\/sshd\ntcp 0 0 :::443 :::* LISTEN 1161\/httpd\ntcp 0 0 :::8443 :::* LISTEN 1161\/httpd\ntcp 0 0 :::389 :::* LISTEN 1391\/.\/ns-slapd\n<\/pre>\n<p>11. Verify port listen by the server and opened by iptables firewall :<\/p>\n<pre>[root@ldap ~]# iptables -nL\nChain INPUT (policy ACCEPT)\ntarget prot opt source destination\nACCEPT all -- 0.0.0.0\/0 0.0.0.0\/0 state RELATED,ESTABLISHED\nACCEPT icmp -- 0.0.0.0\/0 0.0.0.0\/0\nACCEPT all -- 0.0.0.0\/0 0.0.0.0\/0\nACCEPT tcp -- 0.0.0.0\/0 0.0.0.0\/0 state NEW tcp dpt:22\nACCEPT tcp -- 0.0.0.0\/0 0.0.0.0\/0 state NEW tcp dpt:389\nACCEPT tcp -- 0.0.0.0\/0 0.0.0.0\/0 state NEW tcp dpt:9830\nREJECT all -- 0.0.0.0\/0 0.0.0.0\/0 reject-with icmp-host-prohibited\n\nChain FORWARD (policy ACCEPT)\ntarget prot opt source destination\nREJECT all -- 0.0.0.0\/0 0.0.0.0\/0 reject-with icmp-host-prohibited\n\nChain OUTPUT (policy ACCEPT)\ntarget prot opt source destination\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A directory server provides a centralized directory service for your organization. It is alternative to windows active directory. This post will describes how to install and configure\u00a0389 LDAP Directory Server&#8230;<\/p>\n","protected":false},"author":6,"featured_media":6348,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"wds_primary_category":0,"footnotes":""},"categories":[1102,2062],"tags":[1178,1244,1536,1546],"class_list":["post-5253","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-389-directory-server","category-yum","tag-389-directory","tag-centos","tag-linux","tag-linux-utilities"],"_links":{"self":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/5253","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/comments?post=5253"}],"version-history":[{"count":0,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/posts\/5253\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media\/6348"}],"wp:attachment":[{"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/media?parent=5253"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/categories?post=5253"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostinggeeks.com\/howto\/wp-json\/wp\/v2\/tags?post=5253"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}