IP Address Management
    MariaDB

    Deploy phpIPAM on a VPS

    Self-host phpIPAM IP address management on a RamNode VPS with nginx, PHP-FPM, MariaDB, Let's Encrypt TLS, scanning cron jobs, and backups.

    Target: Ubuntu 24.04 LTS VPS (KVM), 1 vCPU / 1GB RAM minimum, 2GB+ recommended.

    1. Base packages

    shell
    apt update && apt -y upgrade
    apt -y install nginx mariadb-server php8.3-fpm php8.3-mysqli php8.3-gd php8.3-curl \
      php8.3-cli php8.3-mbstring php8.3-xml php8.3-zip php8.3-gmp php8.3-snmp \
      php8.3-ldap unzip git curl

    2. MariaDB setup

    shell
    mysql_secure_installation
    mysql -u root -p <<'EOF'
    CREATE DATABASE phpipam;
    CREATE USER 'phpipam'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PW';
    GRANT ALL PRIVILEGES ON phpipam.* TO 'phpipam'@'localhost';
    FLUSH PRIVILEGES;
    EOF

    3. Get phpIPAM

    shell
    cd /var/www
    git clone --recursive https://github.com/phpipam/phpipam.git
    chown -R www-data:www-data /var/www/phpipam

    If you want a pinned release instead of master:

    shell
    cd /var/www/phpipam
    git checkout v1.7.2   # check https://github.com/phpipam/phpipam/releases for current
    git submodule update --init --recursive

    4. Config file

    shell
    cd /var/www/phpipam
    cp config.dist.php config.php

    Edit config.php:

    shell
    $db['host'] = 'localhost';
    $db['user'] = 'phpipam';
    $db['pass'] = 'CHANGE_ME_STRONG_PW';
    $db['name'] = 'phpipam';
    $db['port'] = 3306;

    5. Import schema

    shell
    mysql -u phpipam -p phpipam < /var/www/phpipam/db/SCHEMA.sql

    6. PHP-FPM pool tuning (optional, small VPS)

    Edit /etc/php/8.3/fpm/pool.d/www.conf:

    shell
    pm = ondemand
    pm.max_children = 8
    pm.process_idle_timeout = 30s
    shell
    systemctl restart php8.3-fpm

    7. Nginx vhost

    /etc/nginx/sites-available/phpipam:

    shell
    server {
        listen 80;
        server_name ipam.example.com;
        root /var/www/phpipam;
        index index.php;
    
        client_max_body_size 20M;
    
        location / {
            try_files $uri $uri/ /index.php?$args;
        }
    
        location ~ \.php$ {
            include snippets/fastcgi-php.conf;
            fastcgi_pass unix:/run/php/php8.3-fpm.sock;
        }
    
        location ~ /(app/config|db|ca)/ {
            deny all;
            return 404;
        }
    
        location ~ /\.ht {
            deny all;
        }
    }
    shell
    ln -s /etc/nginx/sites-available/phpipam /etc/nginx/sites-enabled/
    nginx -t && systemctl reload nginx

    8. TLS (Let's Encrypt)

    shell
    apt -y install certbot python3-certbot-nginx
    certbot --nginx -d ipam.example.com

    9. Finish setup via browser

    Visit https://ipam.example.com/, run the guided installer (or skip it since the schema is already imported — go straight to login with default admin / ipamadmin and change the password immediately).

    10. Cron for scheduled scans (discovery, PING/SNMP checks)

    shell
    crontab -u www-data -e

    Add:

    shell
    */5 * * * * /usr/bin/php /var/www/phpipam/functions/scripts/discoveryCheck.php  > /dev/null 2>&1
    */5 * * * * /usr/bin/php /var/www/phpipam/functions/scripts/pingCheck.php      > /dev/null 2>&1
    0   * * * * /usr/bin/php /var/www/phpipam/functions/scripts/resizeSubnets.php > /dev/null 2>&1

    11. Firewall (ufw or your RamNode security group)

    shell
    ufw allow 80/tcp
    ufw allow 443/tcp
    ufw enable

    12. Backup notes

    • Dump phpipam DB nightly: mysqldump -u phpipam -p phpipam > phpipam-$(date +%F).sql
    • Back up /var/www/phpipam/config.php (contains DB creds) and ca/ if you store CA certs for device SNMP/SSH scanning.

    Post-install checklist

    • Change default admin password
    • Set up SNMP community strings under Administration > Server Management if using discovery
    • Configure API app key if integrating with Ansible dynamic inventory or WHMCS-side tooling
    • Restrict /api/ endpoint by IP if not needed externally