Install phpIPAM on Linux [Open-source IP Address Management System]

What is phpIPAM?

phpIPAM is an open-source web IP address management application (IPAM). It's goal is to provide light, modern and useful IP address management. It is a php-based application with a MySQL database backend, using jQuery libraries, ajax and HTML5/CSS3 features. -https://phpipam.net/

Installation

  1. Log into the Linux device
  2. Run the following commands in a terminal window:
    # update software repositories
    sudo apt update
    # install available software updates
    sudo apt upgrade -y
    # install prerequisites
    sudo apt install curl wget zip git -y
    # install Apache HTTPD and MySQL
    sudo apt install apache2 mariadb-server mariadb-client -y
    # install PHP components
    sudo apt install php7.4 php7.4-curl php7.4-common php7.4-gmp php7.4-mbstring php7.4-gd php7.4-xml php7.4-mysql php7.4-ldap php-pear -y
    # configure the MySQL database
    sudo su
    mysql_secure_installation
  3. Press Enter to login as root
  4. Type N and press Enter to not switch to unix socket authentication
  5. Type Y and press Enter to set a root password, type the password twice to confirm
  6. Type Y and press Enter to remove anonymous users
  7. Type Y and press Enter to disallow root login remotely
  8. Type Y and press Enter to remove the test database
  9. Type Y and press Enter to reload privilege tables
  10. Run the following command to login into MySQL:
    mysql -u root -p
  11. Authenticate with the root password set earlier
  12. Run the following commands to create the phpIPAM database and database user
    CREATE DATABASE php_ipam;
    GRANT ALL ON php_ipam.* to 'php_ipam_rw'@'localhost' IDENTIFIED BY 'P4P1p@m!!';
    FLUSH PRIVILEGES;
    EXIT;
    exit
  13. Continue with the following commands:
    # git clone phpipam to the webroot
    sudo git clone https://github.com/phpipam/phpipam.git /var/www/html/phpipam
    # cd into the new directory
    cd /var/www/html/phpipam
    # checkout the latest release
    sudo git checkout "$(git tag --sort=v:tag | tail -n1)"
    # set the owner of the phpipam directory
    sudo chown -R www-data:www-data /var/www/html/phpipam
    # copy sample config file
    sudo cp /var/www/html/phpipam/config.dist.php /var/www/html/phpipam/config.php
    # edit config.php
    sudo nano /var/www/html/phpipam/config.php
  14. Update the database connection details

    $db['host'] = '127.0.0.1';
    $db['user'] = 'php_ipam_rw';
    $db['pass'] = 'P4P1p@m!!';
    $db['name'] = 'php_ipam';
    $db['port'] = 3306;

  15. Below the database connection, add the following line to define the BASE variable

    define('BASE', "/phpipam/");

  16. Press CTRL+O, Enter, CTRL+X to write the changes
  17. Continue with the following commands:
    # enable mod_rewrite
    sudo a2enmod rewrite
    # restart apache2 service
    sudo systemctl restart apache2

phpIPAM Web Installer

  1. Open a web browser and navigate to http://DNSorIP/phpipam
  2. The phpipam Installation web installer should be load
  3. Click the New phpipam installation button
  4. Click the Automatic database installation button
  5. Complete the database form as follows

    MySQL/MariaDB username: php_ipam_rw
    MySQL/MariaDB password: P4P1p@m!!
    MySQL/MariaDB database location: 127.0.0.1
    MySQL/MariaDB database name: php_ipam

  6. Click the Show advanced options button
  7. Uncheck Create new database and Set permissions to tables > Click the Install phpipam database button
  8. Once the database is initialized, click the Continue button
  9. Enter and confirm an admin user password > Click Save settings
  10. Click the Proceed to login button
  11. Login with the username admin and the admin password set earlier
  12. Welcome to phpIPAM