Installing PHPIPAM For IP Address Management System on RHEL/CentOS 7

1. Overview

 

PHPIPAM is one of the top open-source IP address management system, IPAM. It provides light, modern and useful IP address management. It is php-based application with MySQL database backend, but in this article will use MariaDB instead. Some interesting of PHPIPAM features are IPv4/IPv6 address management, Active Directory(AD)/apenLDAP authentication, multiple level of nested subnets, VLAN management, Email notification, IP request function, and rack management.

In this tutorial will show how to install PHPIPAM ip network management on CentOS 7. At the time of writing this document, the latest PHPIPAM version that available to download is 1.3.

2. Prerequisites

 

In this instruction of installing PHPIPAM IP address management system, it is supposed that:

a. You have already install RHEL/CentOS 7 Linux server up and running. In case that you don’t, you would probably like to read this link. Minimal RHEL/CentOS 7 Installation With Logical Volume Manager (LVM).
b. You have already done the initial server setup. Please refer to this link Minimal RHEL/CentOS 7 Initial Server Setup.

3. Install and Configure Database for PHPIPAM IP Address Management System

 

In CentOS 7, MySQl is moved to MariaDB, execute the following command to install MariaDB.

# yum -y install mariadb-server mariadb-devel

Enable MariaDB service to start it a the system boot and start its service.

# systemctl enable mariadb
# systemctl start mariadb

Now let do the security hardening of MariaDB by execute the following command.

# mysql_secure_installation

We need to create a database and a user for Cacti application and grant it all database privileges.

# mysql -u root -p
mysql> create database phpipamdb01;
mysql> grant all on phpipamdb01.* to phpipamuser01@localhost identified by 'P@ssword01';

4. Installing PHPIPAM Application

 

To install PHPIPAM IP network management, we need to install some mandatory packages as the following first.

# yum -y install httpd php php-cli php-gd php-common php-ldap php-pdo php-pear php-snmp php-xml php-mysql git php-mbstring

We need to set correct locales to be used on server, they are required also for translations. Add following to file /etc/environment for en_US coding.

# vim /etc/environment
LC_ALL=en_US.utf-8
LANG=en_US.utf-8

Enable Apache service to start it a the system boot and start its service.

# systemctl enable httpd
# systemctl start httpd

Now let move to the installation directory for PHPIPAM IP address management system, /var/www, and download it.

# cd /var/www
# git clone https://github.com/phpipam/phpipam.git

It is recommended to create a symbolic link to the extracted directory of PHPIPAM IP address management system. So, it will make us easy to upgrades PHPIPAM application to a newer versions latter.

# cd /var/www/
# mv phpipam phpipam.1.3
# ln -s  phpipam.1.3 phpipam

Also, we need to make sure that the permissions on the PHPIPAM IP management system root directories are set correctly as the following.

# chown apache:apache -R /var/www/phpipam.1.3

Next, we need to open HTTP port 80 on IPTables.

# vim /etc/sysconfig/iptables
-A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT
# systemctl restart iptables
# iptables -L -n -v

Usually, the default PHP installation usually has not configured the correct timezone or php error reporting.

While not required to run GPLI application, it’s highly recommended to enable error reporting to syslog for troubleshooting issues with plugins or other scripts. Edit file /etc/php.ini as the following.

# vim /etc/php.ini
date.timezone = Asia/Phnom_Penh
log_errors = syslog

Then, we need to restart Apache service.

# systemctl restart httpd

Make a copy of file /var/www/phpipam.1.3/config.dist.php to config.php and enter required details.
For automatic installation PHPIPAM IP address management system will configure database with settings you enter in this config.php file. For manual installation you will have to do it yourself.

# cp /var/www/phpipam.1.3/config.dist.php /var/www/phpipam.1.3/config.php
# vim /var/www/phpipam.1.3/config.php

$db['host'] = 'localhost';
$db['user'] = 'phpipamuser01';
$db['pass'] = 'P@ssword01';
$db['name'] = 'phpipamudb01';
$db['port'] = 3306;

Now we need to import SCHEMA.sql file into the created database with following command.

# cd /var/www/phpipam.1.3
# mysql -u root -p phpipamdb01 < db/SCHEMA.sql

We also need to disable SELinux.

# vim /etc/selinux/config
SELINUX=disabled
# reboot

5. Configure VHost for PHPIPAM Application

 

To create a VHost for PHPIPAM ip address management system, create a *.conf file in directory /etc/httpd/conf.d as the following.

# vim /etc/httpd/conf.d/phpipam.conf
<VirtualHost *:80>

 ServerAdmin sysadmin@techspacekh.com
 ServerName ipam.techspacekh.com
 DocumentRoot /var/www/phpipam

 ErrorLog "/var/log/httpd/phpipam.techspacekh.com.log"
 CustomLog "/var/log/httpd/phpipam.techspacekh.com.log" combined

</VirtualHost>

Then, we need to restart Apache service.

# systemctl restart httpd

Finally, PHPIPAM IP address management system is installed. In your browser, in the address box type in http://ipam.techspacekh.com and the following windows appears.

Login using default account admin/ipamadmin. It will force your to the admin password after successfully login at the first time.

We can nest subnets in multiple level.
We can manage the IP addresses with ip management tool as the following.

It is also include with with rack management feature.
Users also can use this IP address management system to request for an IP address.

There is also an email notification when some body make any change or updated any thing.

Another interesting feature is circuit management.

 

6. Integrate PHPIPAM IP Address Management System With Google Map

 

It is also possible if you wish to integrate PHPIPAM ip address management system with Google Map by using Google Map API. So, you can see the location of your branches exactly in Google Map.

First we need to create a Google Maps API key. Go to https://console.developers.google.com and login using your Gmail account and then go to Google Maps APIs section and click on “Google Maps JavaScript API”

 

Then, you need to create a project to get an API key and make sure that it is enabled.

After that, go to Credentials tab and copy the API key you created to past on file config.php of PHPIPAM.

 

Open file “/var/www/phpipam/config.php” with your favorite text editor and past the Google Maps API key that you copied from above step as the following.

# vim /var/www/phpipam/config.php
$gmaps_api_key = "AIzaSyDl6RFZZZZZ_MM_KKKKKK_YVxJo2i4lg";

Then, you need to restart Apache web server services.

# systemctl restart httpd

Now you should be able to see your branch location appears in Google Maps of PHPIPAM as the following.

7. Conclusion

 

That’s all about installing PHPIAM for web based IP address management system on RHEL/CentOS 7 from Tech Space KH. Hopefully, you can find this guide informative and helpful for IP management tool. If you have any questions or suggestions you can always leave your comments below. I will try all of my best to review and reply them.

Comments

comments