phpIPAM installation on debian 6.0.6

I have received a request for help on manual installation of phpIPAM on debian linux, so I decided to write a small how-to if anyone else has problems or is not so familiar with linux distributions and environment. I have used fresh default debian 6.0 as distribution because it is widely used, I believe on ubuntu linux procedure should be very similar, except maybe for locations of some config files.

I have used the following settings for installation:

  • Fresh debian installation
  • MySQL server not yet installed and no root pass configured
  • Apache not installed and configured
  • phpipam will be installed in default directory (no vhosts) under /phpipam/ folder

If you already have MySQL/apache set you can skip point 3.

Installation procedure:

1.) Preparing environment and installing required apps

Update your sources (apt-get update) and install Apache, php and mysql server:

apt-get install apache2 mysql-server php5 php5-gmp php-pear php5-mysql php5-ldap

After all is installed and the apache server is running, you need to decide weather you will be running it under vhost or in subdirectory or root directory. For this guide I will have it in subdirectory http://server/phpipam/, so do the following:

cd /var/www/
wget http://freefr.dl.sourceforge.net/project/phpipam/phpipam-0.7.tar
tar -xvf phpipam-0.7.tar
rm phpipam-0.7.tar
cd phpipam

At this point you should have all the files and applications installed for phpipam.

2.) Setting phpipam configuration

Edit config.php and select MySQL user/pass you wish to use for phpipam and set rewriteBase to /phpipam/,and set your database details (select user/pass you wish to have for phpipam and database name – you can also leave it as it is):

vi config.php
$db['host'] = “localhost”;
$db['user'] = “phpipam”;
$db['pass'] = “phpipamadmin”;
$db['name'] = “phpipam”;

also set rewrite base in config.php (If you have it under root directory of your webserver than you can skip it)

define(‘BASE’, “/phpipam/”);

and in .htaccess

RewriteBase /phpipam/

3.) Setting up database

Now you need to setup MySQL database, if this is the first time you installed it (if you already have mysql running with root pass then you can skip this):

mysqladmin -u root password NEWPASSWORD

4.) Mod rewrite settings

Make sure apache supports mod_rewrite for web server, if it does not you will get errors /install/ not found (http 404) and similar. This means that either apache is not set to use .htaccess rewrites, or that you did not specify the rewritebase in step2 correctly.

Search for Directory directive in default apache config and add/change it to

vi /etc/apache2/sites-enabled/000-default

Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all

On debian you have to manually enable rewrite mod for apache, you can do it manually or via a2enmod

ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
or
sudo a2enmod rewrite

And restart apache:

/etc/init.d/apache2 restart

5.) Database installation

Now point you web browser to http://server/phpipam/ and the install script will start that installs default schema for phpipam database. Use mysql root password that you created in step 3 and click install.

br, Miha

11 thoughts on “phpIPAM installation on debian 6.0.6

  1. Scott

    I must be not seeing something because I’m having a hell of a time getting the installation to work. The funny thing is I’m a systems administrator, and I’ve done hundreds of PHP installations!

    Here’s my Apache file:

    ServerName ipam.company.com

    DocumentRoot /www/company/phpipam/htdocs

    ErrorLog /logs/apache2/ipam-error.log
    CustomLog /logs/ipam-access.log combined env=!dontlog
    SetEnvIf Request_URI “^/favicon\.ico$” dontlog

    AddDefaultCharset utf-8

    Options -Indexes
    Order allow,deny
    Allow from all

    Options -Indexes
    AllowOverride none
    Order deny,allow
    Deny from all

    Options FollowSymlinks
    AllowOverride all
    Order allow,deny
    Allow from all

    …and my .htaccess file (has 0664 permissions)
    RewriteEngine On
    RewriteBase /

    …and my base in config.php
    define(‘BASE’, “/”);

    Am I missing something?

    Reply
  2. Santhosh

    Hello,

    I have been trying to install phpIPAM on my local Ubuntu 13.04 LAMP server VM. I have followed the steps given in the install notes. I just can’t get it to work and I am stuck at the install step where I goto http://server-ip/phpipam and it gives me a error which says:

    Mod_rewrite error
    It seems your Apache is not set up properly to handle URL rewrites.

    I have verified everything It would be a great help if you could help me out with this.

    Thanks,
    Santhosh

    Reply
  3. Jake

    I’ve downloaded the recent 1.0 version and trying to install it on Ubuntu 14.04 with the default LAMP install option. Apache version is 2.4.7 and i saw at one point there was a mod_rewrite bug in versions between 2.2.21 – 2.4.2. Anyways I’m wondering if this bug exists in 2.4.7? I’ve followed the guide (http://phpipam.net/phpipam-installation-on-debian-6-0-6/) and it seems like everything is setup correctly but cannot get passed the mod_rewrite error page.
    Any ideas on if the apache version still has a bug or how to check if it is a bug in apache?

    Reply
  4. Patrick

    Several notes (2014-05-21):
    On a fresh install, I had neglected to enable Mod_Rewrite on my Apache2 configuration before hitting the http://localhost/phpipam/install URL. This caused the infamous, persistent error page from phpipam. This page persisted even after enabling mod_rewrite and correctly configuring the vhost.conf, config.php, and .htaccess files and apache2 restart. The solution (after a couple of hours of frustration) was to delete the install/index.php file, then go to my installed phpipam URL (in my case: http://phpipam.localhost.site). This caused phpipam to re-evaluate my install and verify it. I could then proceed with the automated setup of phpipam.

    The INSTALL.txt file states that phpipam can do an automated install of the MySQL/MariaDB database for you, if you’ve entered the correct information in your config.php. This did NOT work for me as the db/SCHEMA.sql file has the wrong column order for the ‘switch’ data in INSERT statement into the ipaddresses table (line 49). I’m using MariaDB. I corrected the insert statement as follows:


    INSERT INTO `ipaddresses` (`id`, `subnetId`, `ip_addr`, `description`, `dns_name`, `mac`, `owner`, `state`, `switch`, `port`, `note`)
    VALUES
    (1,'3','168427779','Server1','server1.cust1.local','','','',1,'',''),
    (2,'3','168427780','Server2','server2.cust1.local','','','',1,'',''),
    (3,'3','168427781','Server3','server3.cust1.local','','','',2,'',''),
    (4,'3','168427782','Server4','server4.cust1.local','','','',2,'',''),
    (5,'3','168428021','Gateway','','','','',1,'',''),
    (6,'4','168428286','Gateway','','','','',1,'',''),
    (7,'4','168428042','Server1','ser1.client2.local','','','',1,'',''),
    (8, '6', '172037636', 'DHCP range', '', '', '', '',3, '', ''),
    (9, '6', '172037637', 'DHCP range', '', '', '', '',3, '', ''),
    (10, '6', '172037638', 'DHCP range', '', '', '', '',3, '', '');

    After that modification, I was able to successfully import the data into the database via the “manual method in step 2b of the Install procedure in INSTALL.txt.

    Good luck,
    Patrick

    Reply
  5. rb34

    has anyone got ldap user settings working? the php-ldap is installed on ubuntu 1204 and the settings within the admin functions are set, but cant successfully integrate. Anyone accomplished this?
    Thanks

    Reply
  6. Mendel

    Phpipam got installed and working properly, but in the certains times the tool presents slowness.
    I´d like to know if there is some configuration optimization to be done to solve this problem.

    Tanks

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>