Matomo is a free/libre software project, and the source code is freely available on our Git repository.

To deploy and use Matomo the best practise and recommended way is to download the latest stable version.

It is not recommended to deploy Matomo in production directly from our Git repository for various reasons:

  • The Matomo version from Git contains files that are only needed for development. Those files are not needed in production and could potentially cause harm, for example our test files.
  • Some default settings are different which can cause Matomo to be slower. For example caches might be disabled by default.
  • Deploying from Git into production can have serious security implications.

If you deploy from git, make sure that the .git directory in the web root cannot be accessed directly. For example

For example when using Apache a redirect like this can prevent accessing these files:

RedirectMatch 404 /\\.git(/.*|$)

Setting up deploying from Git

In case you want to use the very latest bleeding edge Matomo nonetheless and understand the risks, you may use Matomo directly from our Git repository. To deploy Matomo from Git, run the following commands once:

cd path/to/matomo

# 1) Clone the Git repository 
git clone .

# 2) Optional step when you want to deploy a particular stable release (eg. 4.8.0) and not use bleeding edge
git checkout 4.9.1
git submodule update --init --recursive

# 3) Setup composer libraries
curl -sS | php 
php composer.phar install --no-dev

# 4) Now install Matomo via the web interface:

# 5) Disable Matomo development mode
./console development:disable

Faster cloning

The Matomo repository is using Git LFS for all screenshots it contains for visual regression testing. This may cause the git clone to take a long time. If you are not using Matomo for development you can improve the time to clone the repository by setting an option to disable Git LFS:

git clone --config filter.lfs.smudge=true

Deploying new versions from Git

Continuously deploying the bleeding edge code

To automatically deploy the latest bleeding edge code from our repository, setup a crontab or automated script with the following commands:

cd path/to/matomo

# Checkout matomo.js in case it was changed
git checkout -- matomo.js

# Pull the latest code from Matomo repositories
php console git:pull

# Upgrade the libraries in case there is any to be upgraded
php composer.phar self-update > /dev/null
php composer.phar install --no-dev > /dev/null

# Run the upgrade in case there was one
php console core:update --yes > /dev/null

# Re-generate the matomo.js 
php console custom-matomo-js:update > /dev/null

(Note: we do not recommend to do this on production server, as the latest code from Git may be unstable at times and could cause data loss.)

Deploying a specific release

Alternatively, to deploy a particular Matomo release (in this example 3.0.0), run the following commands:

cd path/to/matomo
git checkout 3.0.0
git submodule update --init --recursive
php composer.phar install --no-dev

Deploying Matomo in production correctly

When it is time to deploy To deploy Matomo in your production environment, download the latest stable version and install Matomo on your server (do not deploy from any Git repository in production!).

Previous FAQ: How do I disable all automated emails so that Matomo doesn’t send any email?