Upgrading phpipam

In general upgrading phpipam is a process that contains 3 separate steps:

  • Backup database and config.php file
  • Upgrade phpIPAM code
  • Upgrade phpIPAM database

Before you make an upgrade make sure you backup your SQL database

1.) Create backup

Database part is separated from code, so in case you have a backup SQL file from old installation you can always restore if anything goes wrong in process. Before you make an upgrade make sure you backup your SQL database doing following steps (adjust directories etc. according to your installation):

[root@ipam /]# cd /var/www/phpipam/
[root@ipam /var/www/phpipam]# /usr/bin/mysqldump -u ipam -pphpipam phpipam > db/bkp/phpipam_migration_backup.db
Also backup config.php file containing settings for database connection to phpipam.

2.) Upgrade phpIPAM code

Simply extract new code and copy over old config.php file.

[root@ipam /]# cd /var/www/phpipam
[root@ipam /var/www/phpipam]# tar -xvf phpipam-1.2.tar .
[root@ipam /var/www/phpipam]# cp /backup/location/config.php /var/www

In case you use Git upgrade is even easier:

root@ipam /]# cd /var/www/phpipam
root@ipam /var/www/phpipam]# git pull
root@ipam /var/www/phpipam]# git checkout 1.2
root@ipam /var/www/phpipam]# git submodule update --init --recursive

3.) Upgrade phpIPAM database

To upgrade your phpipam database to latest version 3 options are possible and presented in upgrade screen in browser:

a) Automatic database upgrade

Open browser and follow upgrade procedure.

b) Manualy query import

In case you have some problems you can manually import each SQL update statement directly to MySQL database. All upgrade queries are available in db/UPDATE.sql file, start from statement that contains version higher than current one you are using.

Restore old installation and database

In case anything goes wrong the restore procedure is simple:

  • Extract old code (from version you have prior to upgrade)
  • Copy over config.php
  • Load old database you backed up before starting upgrade (mysql -u root -p < db/bkp/phpipam_migration_backup.db)