The story with the broken guide
I was just installing a clean, standalone instance of phpIPAM for an other blog post. And was following a quit new installation-guide phpIPAM on Ubuntu 17.04.
But i came across a very very bad bug in the guide. I think the just copy&paste the old CentOS or debian guide and replaced the package install part for Ubuntu 17.04. But the problem is, that starting with Ubuntu 16.04 the usage of the user “root” to login to MySQL is handelt much more restrictive.
The working install guide
The following installation guidance was tested with these Ubuntu versions
- Ubuntu 17.04
- Ubuntu 17.10
Install Ubuntu server
Just run through a simple bare minimum installation of Ubuntu server. Where i just aded the following packages.
sudo apt-get install openssh-server ntp open-vm-tools unzip
Install and prepare the LAMP stack
sudo apt-get install apache2 mariadb-server php php-pear php7.0-gmp php7.0-mysql php7.0-mbstring php7.0-gd php7.0-mcrypt php7.0-curl
Configure the Apache webserver
Open with your favorite editor /etc/apache2/apache2.conf
and the following configuration the the file.
<Directory "/var/www/html"> Options FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory>
Now enable the apache url_rewrite module.
sudo a2enmod rewrite
And restart the apache daemon.
sudo systemctl restart apache2
Download the phpIPAM code bits
Because im not THAT big fan to have developer tools on a production or lab-system, without a good reason. I will not follow the official guide to use GIT. Just open the phpIPAM Git repository, click on the green “Clone or download“. And through right click on the “Download Zip” button, you get the download link.
cd wget https://github.com/phpipam/phpipam/archive/master.zip sudo unzip master.zip -d /var/www/html && sudo mv /var/www/html/phpipam-master/* /var/www/html/phpipam-master/.* /var/www/html/ sudo rm -rf /var/www/html/phpipam-master /var/www/html/index.html master.zip
Prepare the phpIPAM config file, and database connection details.
sudo cp /var/www/html/config.dist.php /var/www/html/config.php
And change at least the password for the database connection in the file /var/www/html/config.php
.
$db['host'] = 'localhost'; $db['user'] = 'phpipam'; $db['pass'] = '<YOUR PASSWORD>'; $db['name'] = 'phpipam'; $db['port'] = 3306;
Finaly we need to set right file and folder permissions.
sudo chown www-data:www-data -R /var/www/html/ sudo find /var/www/html/ -type f -exec chmod 0644 {} + sudo find /var/www/html/ -type d -exec chmod 0755 {} +
The MySQL part
Set a password and run through the security configuration of MySQL
If MySQL ist not running, just start the daemon.
sudo /etc/init.d/mysql restart
Then run MySQL security and install script, and use the default settings.
sudo mysql_secure_installation
And now we reached the small but important bug in the installation guide.
Since Ubuntu 16.04, the usage of the “root“@”localhost” to login to MySQL is only possible when you are root or using sudo. Otherwise your login attempts will get a “access denied”. And this will happen when you flow the Ubuntu 17.04 guide form the phpIPAM page.
So we use the manual database installation
Login with the “root” to MySQL. And do not forget to replace <YOUR PASSWORD>, with the password you have specified in “/var/www/html/config.php“!
sudo mysql -u root -p mysql> create database phpipam; mysql> GRANT ALL on phpipam.* to phpipam@localhost identified by "<YOUR PASSWORD>"; mysql> exit
As last step we import the sql-schema of phpIPMA, and the we are done with the MySQL part.
sudo mysql -u root -p phpipam < /var/www/html/db/SCHEMA.sql
Finished
Open the login page, use the defaults “Admin/ipamadmin” to login. And after the you passed the change password screen you have a running phpIPAM.
http://<ip or dnsname>/