Friday, August 5, 2016

Install phpLDAPadmin to Manage LDAP with a Web Interface

Install phpLDAPadmin

 

CentOS/RHEL 6, 32 Bit:
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

CentOS/RHEL 6, 64 Bit:
# rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 
 
 yum --enablerepo=remi install httpd
 
# service httpd start
# chkconfig httpd on
 
 yum --enablerepo=remi install mysql mysql-server
service mysqld start
# /usr/bin/mysql_secure_installation
 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):     ## Press Enter ## 
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n]     ## Press Enter ##
New password:                ## Enter new password ##
Re-enter new password:       ## Re-enter new password ##
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n]     ## Press Enter ##
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n]     ## Press Enter ## 
... Success!
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n]     ## Press Enter ##
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n]     ## Press Enter ##
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!
  
 
yum -y install php php-mysql
yum --enablerepo=remi install php-common php-cli php-mysql php-devel
 

 Install PHP 

 yum install php php-mysql php-devel php-gd php-pecl-memcache php-pspell php-snmp php-xmlrpc php-xml

 

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely used open-source general purpose scripting language that is especially suited for web development and can be embedded into HTML.
Install PHP with following command:
# yum install php -y
Test PHP
Create a sample “testphp.php” file in Apache document root folder and append the lines as shown below:
# vi /var/www/html/testphp.php
Add the following lines.




Install phpLDAPadmin to Manage LDAP with a Web Interface

yum install epel-release
yum install phpldapadmin
Now we configure phpldapadmin
sudo vim /etc/phpldapadmin/config.php
Change dc=yourdomain,dc=com/in etc
On line 300
$servers->setValue(‘server’,’base’,array(‘dc=example,dc=com’));
On line 397: uncomment, line 398: comment out
$servers->setValue(‘login’,’attr’,’dn’);
// $servers->setValue(‘login’,’attr’,’uid’);
On line 326 or 332
$servers->setValue(‘login’,’bind_id’,’cn=Manager,dc=example,dc=com’);
Now, we edit permission for accessing phpldapadmin on network
vi /etc/httpd/conf.d/phpldapadmin.conf
<Directory /usr/share/phpldapadmin/htdocs> Order Deny,Allow Deny from all Allow from 127.0.0.1 192.168.1.0/24 (your IP range)
Allow from ::1 </Directory>
Now restart httpd service
/etc/rc.d/init.d/httpd restart
Stopping httpd:                     [  OK  ]
Starting httpd:                     [  OK  ]
 
# service httpd restart
# chkconfig httpd on
# service mysqld restart
# chkconfig mysqld on 

check http://serverhostname/ldapadmin in browser.

No comments:

Post a Comment