How to install phpIPAM on Ubuntu 18.04


Introduction

PhpIPAM is a reliable web Internet Protocol address management system. It's a robust open-source application that is designed to facilitate seamless, modern and effective management of IP address.

The package is based on PHP and features a MySQL database backend.

This tutorial will show you how to install the phpIPAM on your Ubuntu 18.04 VPS or Dedicated server.

Before You Begin

The following dependencies are required by phpIPAM and should be installed before installing and configuring phpIPAM:

Step 1 - Installing A Database Server (MariaDB)

The first step when installing phpIPAM is creating a database for this application. Install MariaDB database server on the system.

Once you install and set up the database server, create a new database for the PhpIPAM user. First, issue the command below to login to MariaDB command line:

$ sudo mysql -u root -p

Enter the root password for MariaDB and press ENTER to access the database shell. Now, to create the database issue the command below:

MariaDB [(none)]>

createdatabase phpipam;

Next, execute the command below to grant the new user all privileges:

MariaDB [(none)]>

grant all on phpipam.* to phpipam@localhost identifiedby'strongpassword';

Note: Remember to replace the placeholder “strongpassword” with your preferred password.

Then, run the following command to flush the privileges:

MariaDB [(none)]>

flushprivileges;

You can issue the command below to check the privileges granted to the phpIPAM

user:

MariaDB [(none)]>

showgrantsfor phpipam@localhost;

This will give you an output similar to the one below:

+----------------------------------------------------------------------------------------------------------------+
| Grants for phpipam@localhost |
+----------------------------------------------------------------------------------------------------------------+
| GRANTUSAGEON *.* TO'phpipam'@'localhost'IDENTIFIEDBYPASSWORD'*FAB0955B2CE7AE2DAFEE46C36501AFC6E65A445D' |
| GRANT ALL PRIVILEGESON`phpipam`.* TO'phpipam'@'localhost' |
+----------------------------------------------------------------------------------------------------------------+
2rowsinset (0.000 sec)

That is it! The database is successfully configured. Issue the command below to exit the MariaDB command line:

MariaDB [(none)]>

Quit

Step 2 - Installing PHP and All The Required Modules

To install PHP and all the required modules, execute the command below:

$ sudo apt-get -y install php7.2-mysql php7.2-curl 
php7.2-gd php7.2-intl php-pear php7.2-imap php-memcache  
php7.2-pspell php7.2-recode  php7.2-tidy php7.2-xmlrpc 
php7.2-mbstring php-gettext php7.2-gmp php7.2-json  php7.2-xml

Next, run the command below to install the PHP-FPM module

$ sudo apt-get install php-fpm

By now you have installed PHP and all the required dependencies. To check the status of the just installed modules, run the command below:

$ sudo systemctl status php7.2-fpm.service

This will give an output similar to the one below:

●php7.2-fpm.service-ThePHP7.2FastCGIProcessManager
Loaded: loaded(/lib/systemd/system/php7.2-fpm.service;enabled;vendor preset: enabled)
Active: active(running)sinceWed2018-10-2405:43:35UTC;13sago
Docs: man:php-fpm7.2(8)
Main PID: 19135(php-fpm7.2)
Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
Tasks: 3(limit:1152)
CGroup: /system.slice/php7.2-fpm.service
├─14688 php-fpm: masterprocess(/etc/php/7.2/fpm/php-fpm.conf)
├─14705 php-fpm: poolwww
└─14706 php-fpm: poolwww

Oct2405:43:34server-01systemd[1]:StartingThePHP7.2FastCGIProcessManager...
Oct2405:43:35server-01systemd[1]:StartedThePHP7.2FastCGIProcessManager.

Step 3 - Downloading and Installing PhpIPAM

The stage is set and it’s now safe to install the phpIPAM on your Ubuntu 18.04 system. Here, we’ll download the application from GitHub and for this reason, we should install the Git system first:

$ sudo apt-get install git

Next, run the command below to clone the phpIPAM code on GitHub page:

$ sudo git clone --recursive https://github.com/phpipam/phpipam.git /var/www/phpipam

Chage to the directory /var/www/phpipam, and then check the stable release:

$ sudo cd /var/www/phpipam
$ sudo git checkout -b 1.3 origin/1.3

If everything is okay, you will get the output below:

Branch '1.3' set up to track remote branch '1.3'from'origin'.
Switched to a new branch '1.3'

Step 4 - Configuring PhpIPAM

Now, change directory to /var/www/phpipam, then copy the config.dist.php file to config.php.

$ sudo cd /var/www/phpipam
$ sudo cp config.dist.php config.php

Run the command below to open the config.php

$ sudo nano config.php

Edit this file to match the credentials in step 1:

/**
* database connection details
******************************/
$db['host'] = 'localhost';
$db['user'] = 'phpipam';
$db['pass'] = 'strongpassword';
$db['name'] = 'phpipam';
$db['port'] = 3306;

Step 5 - Installing And Configuring Nginx

To install the Nginx web server,run the command below:

$ sudo apt-get install nginx

Then, execute the command below to open the configuration file /etc/nginx/conf.d/phpipam.conf:

$ sudo nano /etc/nginx/conf.d/phpipam.conf

Once the file opens, add the following text:

server {
    # root directory
    root   /var/www/;

    # phpipam
    location /phpipam/ {
        try_files$uri$uri/ /phpipam/index.php;
        index index.php;
    }
    # phpipam - api
    location /phpipam/api/ {
        try_files$uri$uri/ /phpipam/api/index.php;
    }

    # php-fpm
    location~ .php$ {
        fastcgi_pass   unix:/run/php/php7.2-fpm.sock;
        fastcgi_index  index.php;
        try_files      $uri$uri/ index.php = 404;
        include        fastcgi_params;
    }
 }

Complete Nginx configuration by changing the ownership of this directory; /var/www/  to the user www-data

$ sudo chown -R www-data:www-data /var/www/

Step 6 - installing And Configuring Apache

If you intend to utilize Apache as your web server, you need to install it at this point:

$ sudo apt-get install apache2

Next, run the command below to enable module rewrite:

$ sudo a2enmod rewrite

Now, issue the command below to install the PHP modules for Apache:

$ sudo apt-get install libapache2-mod-php php-curl php-xmlrpc php-intl php-gd

Then, execute the command below to open the Apache configuration file:

 $ sudo /etc/apache2/conf-enabled/phpipam.conf

Once the configuration file opens, add the content below:

<VirtualHost *:80>
    ServerAdmin admin@phpipam.yourdomain.com
    DocumentRoot"/var/www/phpipam"
    ServerName phpipam.computingforgeeks.com
    ServerAlias www.phpipam.computingforgeeks.com
    <Directory "/var/www/phpipam">
        Options Indexes FollowSymLinks
        AllowOverrideAll
        Requireall granted
    </Directory>
    ErrorLog"/var/log/phpipam.yourdomain.com-error_log"
    CustomLog"/var/log/phpipam.yourdomain.com-access_log" combined
</VirtualHost>

Restart the Apache service for the changes to take effect:

$ sudo systemctl restart apache2

Step 7 - Completing The Installation

By now, everything is set and you can easily complete the installation. Navigate to your favorite browser and search https://example.com/install.

Note: Remember to replace example.com with a Fully Qualified Domain Name.

This will take you to the installation homepage for phpIPAM. Click “New phpipam installation”

How to install phpIPAM on ubuntu 18.04

Then select the Automatic database installation option to configure the phpipam database.

This option allows you to use the credentials added to the config.php file to create your MySQL database and database user.

How to install phpIPAM on ubuntu 18.04

Once you select that option you will be prompted to provide your root MySQL credentials. That is; the login details for the user phpIPAM should connect as, like the database name and database location.

Note: The database name is set as phpipam and the database location is set as localhost.

There is a button for Show advanced options. By clicking this button you will get additional installation options but it's always wise to leave all these options to their default values.

Simply enter your MySQL login credentials (username and password) and hit the Install phpipam database icon.

How to install phpIPAM on ubuntu 18.04

Once the installation is done, you get the following confirmation message:

How to install phpIPAM on ubuntu 18.04

Now Click Continue to complete the post configuration process. This will take you to another screen where you will be required to set your administrator password for this web interface, URL for the phpIPAM installation, and the name to be displayed on all web interface screen for phpIPAM.

Provide these details and press the Save settings to save the changes.

How to install phpIPAM on ubuntu 18.04

Once, that is done, you will the confirmation message below. Click Proceed to login to access the login page.

How to install phpIPAM on ubuntu 18.04

You can now log in with the admin credentials set in the above step

Conclusion

Congratulation! You have successfully installed and configured phpIPAM on your Ubuntu 18.04 VPS or Dedicated server. You can now use this application to monitor your IP address usage in your infrastructure.

Check out these top 3 Linux hosting services

Was this article helpful?