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
From version 1.7 onwards we have multiple branches available:
- master: current stable version
- 1.x: specific stable versions
- develop: current development version
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.dbAlso backup config.php file containing settings for database connection to phpipam.
2.) Upgrade phpIPAM code
To check which git branch you are currently using usegit branch
command:
[root@ipam /]# cd /var/www/phpipam [root@ipam /]# git branch -r origin/1.2 origin/1.3 origin/1.4 origin/1.5 origin/1.6 origin/1.7 origin/HEAD -> origin/master origin/develop origin/master [root@ipam /]# git branch * develop master
2.1) Git on master branch
If you are using master branch on github simply pull new code and update all submodules:
[root@ipam /]# cd /var/www/phpipam [root@ipam /var/www/phpipam]# git pull [root@ipam /var/www/phpipam]# git submodule update --init --recursive
2.2) Git on specific branch
If you use specific branch pull new code, switch to desired branch and update all submodules:
root@ipam /]# cd /var/www/phpipam [root@ipam /var/www/phpipam]# git pull [root@ipam /var/www/phpipam]# git checkout -b 1.7 origin/1.7 [root@ipam /var/www/phpipam]# git submodule update --init --recursive
2.3) Manual release upgrade
To manually extract new phpipam release head over to https://github.com/phpipam/phpipam/releases, check assets and download files. Than extract new code and copy over old config.php file.
[root@ipam /]# cd /var/www/phpipam [root@ipam /var/www/phpipam]# tar -xvf phpipam-v1.7.1.tgz [root@ipam /var/www/phpipam]# cp /backup/location/config.php /var/www/phpipam
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
)