Config file not found

I have just followed the instructions here to install Piwik, and have the following error:


~$ sudo apt-get install piwik
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  php5-mysql
The following NEW packages will be installed:
  php5-mysql piwik
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.3 MB of archives.
After this operation, 39.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://debian.piwik.org/ piwik/main piwik all 2.13.1-1 [10.2 MB]
Get:2 http://ftp.uk.debian.org/debian/ jessie/main php5-mysql amd64 5.6.7+dfsg-1 [65.1 kB]
Fetched 10.3 MB in 6s (1,626 kB/s)                                                                                                         
Preconfiguring packages ...
Selecting previously unselected package php5-mysql.
(Reading database ... 41076 files and directories currently installed.)
Preparing to unpack .../php5-mysql_5.6.7+dfsg-1_amd64.deb ...
Unpacking php5-mysql (5.6.7+dfsg-1) ...
Selecting previously unselected package piwik.
Preparing to unpack .../piwik_2.13.1-1_all.deb ...
Unpacking piwik (2.13.1-1) ...
Processing triggers for libapache2-mod-php5 (5.6.7+dfsg-1) ...
Setting up php5-mysql (5.6.7+dfsg-1) ...

Creating config file /etc/php5/mods-available/mysql.ini with new version
php5_invoke: Enable module mysql for cli SAPI
php5_invoke: Enable module mysql for apache2 SAPI

Creating config file /etc/php5/mods-available/mysqli.ini with new version
php5_invoke: Enable module mysqli for cli SAPI
php5_invoke: Enable module mysqli for apache2 SAPI

Creating config file /etc/php5/mods-available/pdo_mysql.ini with new version
php5_invoke: Enable module pdo_mysql for cli SAPI
php5_invoke: Enable module pdo_mysql for apache2 SAPI
Setting up piwik (2.13.1-1) ...
Lighttpd not installed, skipping
Apache2 not installed, skipping
  * Piwik main configuration files are stored in /etc/piwik/
  * Piwik crontab file is stored in /etc/cron.d/piwik-archive
  * When installing/using piwik, make sure you disable any ads blocker
  * Please wait while Piwik is upgrading...
The configuration file {/usr/share/piwik/config/config.ini.php} has not been found or could not be read.



                                                                    
  [Zend_Db_Statement_Exception]                                     
  SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected  
                                                                    




                                                                    
  [PDOException]                                                    
  SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected  
                                                                    


core:update [--yes]


dpkg: error processing package piwik (--configure):
 subprocess installed post-installation script returned error exit status 3
Processing triggers for libapache2-mod-php5 (5.6.7+dfsg-1) ...
Errors were encountered while processing:
 piwik
E: Sub-process /usr/bin/dpkg returned an error code (1)

The issues appear to be:

  1. Apache2 is installed, but Piwik claims it is not.
  2. The config that the installer is looking for does not exist (/usr/share/piwik/config/config.ini.php)
  3. There seems to be an error with the mysql database.

Can anyone help with this?

thanks
James

Try creating /usr/share/piwik/config/config.ini.php with the contents:

[database]
dbname=piwik
user=root
password=

Write mysql in your shell and see if you can connect. If you can, create the database as detailed on Piwik Requirements - Analytics Platform - Matomo