At the time of writing, the default installation of Cacti on Ubuntu 16.04 seems to be broken. When running the installation command sudo apt-get install cacti you will be presented with the following error message:

mysql: Empty value for 'port' specified.

When confronted with the above error message, choose ignore. The installation will report a failure.

The problem is that the database port value is empty. MySQL seems to report this as a warning, but dbconfig-common still threats it as an error. More information can be found in this LaunchPad bug report.

The solution is therefore quite simple: fill in the default MySQL server port in the Cacti configuration files.

The first file is /etc/cacti/debian.php. Simply fill in the port number in the $database_port variable:

$database_port = "3306";

The second file is /etc/dbconfig-common/cacti.conf and the variable is called dbc_dbport:

dbc_dbport='3306'

The last thing we need to fix are the default date values used by the Cacti installation script. If you were to continue with the installation, you will receive the following error message:

mysql: Invalid default value for 'status_fail_date'

The solution is to update the values with a valid, current date:

sudo sed -i 's/0000-00-00/2016-05-01/g' /usr/share/cacti/conf_templates/cacti.sql

When running sudo dpkg-reconfigure cacti the installation should be able to continue, until you get the following screen:

Keep local configuration file

Choose the keep the local version currently installed option and continue with the installation.