Blog Sample Blog Description 2020-05-02T14:25:57+00:00 Karibu https://freedif.org/blog UNIT3D - How to install a Torrent Tracker https://freedif.org/unit3d-how-to-install-a-torrent-tracker 2020-05-02T14:25:57+00:00 2020-05-02T14:25:57+00:00

Long time ago, I wrote some articles about Gazelle, a torrent tracker that became very popular for private trackers. The development has been long dead and many alternatives have emerged. One of them is Unit3D. Built on PHP Laravel, it is actively developped, modern and have a growing community of developers supporting the project.

The installation is relatively simple, since it used popular/standard technology and the community has prepared some scripts to support the installation. Unfortunately, this is for Ubuntu and won't work for Debian. So here is the manual installation for Debian 10 in my case.

Installation

They recommend obviously to have a recent and powerful enough server to handle such project. You will need Nginx, Php7.4, MySQL, a redis server, and some more dependencies (php-curl, etc..)

Basic requirements

Let's install all the requrements

sudo apt install git tmux vim curl wget zip unzip htop nano build-essential supervisor redis-server nginx

You will need to install MariaDB (or MySQL) in 10.2 version. In your repo, it might be the 10.1 version only (Debian 9 for example), in such case, you need to run the following:

sudo apt-get install software-properties-common dirmngr
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo nano /etc/apt/sources.list.d/mariadb.list

And add:

deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main
deb-src http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.4/debian stretch main

Then install MariaDB

sudo apt update
sudo apt install mariadb-server

Once done, finalize the configuration of MariaDB

sudo mysql_secure_installation

and add a root password, and basic info.

Configure the database

You will need to have a dedicated database, to do it, simply run:

mysql -u root -p
CREATE USER 'unit3d'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE unit3d;
GRANT ALL PRIVILEGES ON unit3d.* TO 'unit3d'@'localhost';
FLUSH PRIVILEGES;
quit;

Modify the user/password by what you want.

Install PHP7.4 and NodeJS

In the repo, you probably have a less recent version of PHP. To use the 7.4, you will need to add the SURY PHP PPA repository

sudo apt -y install lsb-release apt-transport-https ca-certificates 
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
sudo apt update
sudo apt install php-pear php7.4-curl php7.4-dev php7.4-gd php7.4-mbstring php7.4-zip php7.4-mysql php7.4-xml php7.4-fpm php7.4-intl php7.4-bcmath

Now, install NodeJS and NPM and Laravel Echo Server

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install nodejs
sudo npm install -g laravel-echo-server

Configure PHP-FPM

You need a slight modification here:

sudo nano /etc/php/7.4/fpm/php.ini

and find:

;cgi.fix_pathinfo=1

replace with

cgi.fix_pathinfo=0

Then restart it

sudo systemctl restart php7.4-fpm

Configure Nginx

You can adapt this part to your own configuration. If the server is dedicated for Unit3D, you can simply do:

sudo nano /etc/nginx/sites-available/default

and replace the content with

server {
    listen 80 default_server;
    root /var/www/html/UNIT3D;
    index index.html index.htm index.php;
    server_name yourdomain.com;
    location ~* \.(jpg|jpeg|png|gif|ico|svg)$ {
        expires 365d;
    }
    location ~ \.(gif|png|jpg|jpeg|svg|css|js|ico)$ {
        valid_referers none blocked yourdomain.com www.yourdomain.com;
        if ($invalid_referer) {
            return   403;
        }
    }
    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
    }
}

Don't forget to change the domain name.

And configure a SSL Certificate, using...

]]>
Setup Boinctasks to monitor remote BOINC clients https://freedif.org/setup-boinctasks-to-monitor-remote-boinc-daemon 2020-04-09T15:47:30+00:00 2020-04-09T15:47:30+00:00

BOINC for Berkeley Open Infrastructure for Network Computing, is an opensource platform using volunteering resources to compute useful calculations with the spare CPU/GPU cycles of your computer/server, for scentific researches.

In this Covid-19 epidemic, such platforms (like Folding@home as well) have attracted new members that wants to "donate" their idle processors cycles for Covid-19 research.

I let you check the official website of BOINC for more information as this is not the intent with this tutorial

If you have several computers or servers running BOINC, you may want to centralize the management and have direct control of all your BOINC instances, whereever they are. It exists one solution to do this, BoincTasks. In my case I have a Windows laptop running BOINC, and several computers (HTPC, Servers,..) running BOINC as a daemon. I always struggle to manage them effectively until I discovered how easy it was with BoincTasks.

Normally it is preferable to have all your machines you want to monitor, in the same network to ensure a better security, but actually you can also connect remote machines, and here is how you have to do it.

I assume first that you have BoincTasks installed in your "supervisor", the computer that will monitor and control all your instances of Boinc. On the same network, you simply select Computer->Find computers and enter the IP address, click "Scan address range", you select the computer and add it.

But on a different network, you must first allow boinc-client to be accessed remotely. Obviously you expose your instance in such case but you can add a password and a whitelist at least.

How to configure Boinc-client for remote access


1) Go to the boinc-client folder

cd /var/lib/boinc-client


2) Add a password

nano gui_rpc_auth.cfg

and simply type the password you want to add. Save it (CTRL +X), and move to the next step.


3) Add the external IP that can access it

nano remote_hosts.cfg

and add the public IP where BoincTasks is running and will access to this instance. If you have a dynamic IP, I suggest you to play with a domain name.

Save it (CTRL +X), and move to the next step.


4) Modify the boinc configuration to allow remote connection

nano cc_config.xml

and add:

<options>
    <allow_remote_gui_rpc>1</allow_remote_gui_rpc>
</options>

before the at the end.
Now restart your boinc-client to take all those parameters into account.

systemctl restart boinc-client

You are now ready to connect your remote boinc-client to your BoincTasks.


5) Add your remote boinc-client to BoincTasks

Very simple, go to Find Computer, add the IP Address, the password that you set up and click on "Scan address range". This may take some time (15s usually in my case) but then you should be able to see the computer and add it.

Happy crunching!

]]>
How to install Flood + Rtorrent on Debian 10 https://freedif.org/how-to-install-flood-rtorrent-on-debian-10 2020-03-21T17:18:40+00:00 2020-03-21T17:18:40+00:00

Rtorrent is without any doubt the most powerful torrent client a server can have. Yet many webUI exists (Rutorrent being the most popular) but I personally prefer, by far, Flood. It uses Node.js for backend and React for frontend.

Some of the reasons I like Flood:

  • Lightweight, intuitive and modern interface
  • Can add torrents through URLs but also follow RSS feeds with download rules settings directly in the web interface
  • You can download your finished torrents directly in the web interface, instead of setting up a FTP or HTTP accessible folder. Neat. and well, it's based on rTorrent ;)

Let's see how to install rtorrent + flood on your Debian 10 (Buster). I am assuming you have apache2 installed already

Installation

We will install rtorrent first, the flood.

1) Install rTorrent

Simply run:

apt install rtorrent screen


2) Confgure rTorrent

Let's first create a dedicated user, to avoid running rTorrent with root privileges.

adduser --disabled-password rtorrent

You can skip all the questions by just press ENTER

Now, create the configuration file to define few settings and the SCGI to let Flood connect to rTorrent.

nano /home/rtorrent/.rtorrent.rc

and copy the following:

# Where rTorrent saves the downloaded files
directory.default.set = /srv/torrent/downloads

# Where rTorrent saves the session
session.path.set = /srv/torrent/.session

# Which ports rTorrent can use (Make sure to open them in your router)
network.port_range.set = 50000-50000
network.port_random.set = no

# Check the hash after the end of the download
pieces.hash.on_completion.set = yes

# Enable DHT (for torrents without trackers)
dht.mode.set = auto
dht.port.set = 6881
protocol.pex.set = yes

# Authorize UDP trackers
trackers.use_udp.set = yes

# Enable encryption when possible
protocol.encryption.set = allow_incoming,try_outgoing,enable_retry

# SCGI port, used to communicate with Flood
network.scgi.open_port = 127.0.0.1:5000

This will work out of the box, but feel free to change further the settings.

Create the mentioned folders (download and session):

mkdir /srv/torrent
mkdir /srv/torrent/downloads
mkdir /srv/torrent/.session

and set the rights permissions:

chmod 775 -R /srv/torrent 
chown rtorrent:rtorrent -R /srv/torrent 
chown rtorrent:rtorrent /home/rtorrent/.rtorrent.rc


3) Add a SystemD startup script

To have rtorrent running at startup (and ease its control), we will create a SystemD startup script.

nano /etc/systemd/system/rtorrent.service

and add:

[Unit]
Description=rTorrent
After=network.target

[Service]
User=rtorrent
Type=forking
KillMode=none
ExecStart=/usr/bin/screen -d -m -fa -S rtorrent /usr/bin/rtorrent
ExecStop=/usr/bin/killall -w -s 2 /usr/bin/rtorrent
WorkingDirectory=/home/rtorrent

[Install]
WantedBy=default.target

Enable it:

systemctl enable rtorrent.service

and start it up!

systemctl start rtorrent

If no error, you can now install Flood


4) Install Flood

First thing is to install NodeJS, I'm using the version 12 that works well. For this, simply run:

apt install curl build-essential git
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt install -y nodejs

Now you can clone their git repo to get the latest version (Around 23mb, so it should be fast)

cd /srv/torrent
git clone https://github.com/jfurrow/flood.git

Let's use the default configuration:

cd flood
cp config.template.js config.js

and install it with npm

npm install

This is were issues could happen. If no error messages (Warnings are okay) then proceed with:

npm install -g node-gyp...
]]>
How to install Cloud Torrent on Debian 9 https://freedif.org/how-to-install-cloud-torrent-on-debian-9 2018-03-20T23:52:37+00:00 2018-03-20T23:52:37+00:00

When you want to download some torrents on a different machine and get a direct link to download it back through HTTP, you don't have much choices. But Cloud Torrent is one of them.

I recently refreshed my article on Flood, a modern Web-Ui for Rtorrent, that enable you to get directly via HTTP, the torrent you just downloaded on the machine. As it is based on rtorrent, it also has plenty of others features. But if you are looking for a simple web torrent downloader. (Add a torrent, get it back), Cloud Torrent is probably the best for this.

Written in Go (golang), Cloud Torrent is a self hosted remote torrent client. You simply can add torrents (URL or magnet) that will be downloaded on the local disk of the server, which is then retrievable or streamable via HTTP.

Here are the main features:

  • Single binary (Meaning a very simple installation)
  • Cross platform
  • Embedded torrent search
  • Real-time updates
  • Mobile-friendly

The dev is working on few others features, especially on the RSS one, that will enable us to download automatically new release of your favorite shows.

Installation

You don't need much, beside a Apache server and curl.

1) Install Curl

Simply run (In root or with sudo):

apt install curl


2) Download the latest version of Cloud Torrent and install it

curl https://i.jpillora.com/cloud-torrent! | bash


3) Create a systemd service to launch it at boot time

First we will create a folder dedicated for the configuration and for the downloads folder.

mkdir /home/user/cloud-torrent

Replace user by your own user (This step is actually optional, if you already have a dedicated folder for your torrent).

Now create the systemD service file:

nano /etc/systemd/system/cloud-torrent.service

And add:

[Unit]
Description=cloud-torrent

[Service]
WorkingDirectory=/home/user/cloud-torrent/
ExecStart=/usr/local/bin/cloud-torrent --port 8080 --config-path /home/user/cloud-torrent/cloud-torrent.json --title "Cloud Torrent" --log --auth "user:password"
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

You will need to replace the user:password variable by the one you want as it will be used to access to your Cloud Torrent instance.

Now enable it and start it

systemctl enable cloud-torrent
systemctl start cloud-torrent

You should now have access to your Cloud Torrent instance through your IP:8080.

4) Create a dedicated virtualhost

It's not convenient to use the port number to access Cloud Torrent. You might want to access it through a dedicated subdomain may be. Here is how to do it.

First you will need the mods proxy-html and proxy-http enabled. In root, or with sudo, simpy run:

apt install libapache2-mod-proxy-html
a2enmod proxy_http

Now create a dedicated virtualhost

nano /etc/apache2/sites-available/cloud-torrent.conf

and add:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName dl.domain.tld

        ProxyRequests Off
        <proxy>
        Require all granted
        </proxy>
        ProxyPass / http://localhost:8080/
        ProxyPassReverse / http://localhost:8080/

    ErrorLog ${APACHE_LOG_DIR}/cloud-torrent_error.log
    CustomLog ${APACHE_LOG_DIR}/cloud-torrent_access.log combined

</VirtualHost>

Enable the configuration and restart Apache Still in root, run:

a2ensite cloud-torrent
systemctl reload apache2

And that's it, you should now have access to your Clood Torrent instance by connecting directly to your subdomain!

]]>
How to install selfhosted Speedtest https://freedif.org/how-to-install-selfhosted-speedtest 2018-03-17T03:02:20+00:00 2018-03-17T03:02:20+00:00

When you want to check how fast/good is your internet connection, you usually do a speedtest. In some cases, you may even want to host such speedtest in your infrastructure (Local network, network of customers,...) or just to provide such service to your community.

Speedtest is a HTML5 self-hosted speedtest that can be installed easily on your server. It offers basic features such as:

  • Download
  • Upload
  • Ping
  • Jitter
  • IP Address
  • Telemetry (optional)

You can give it a try using the official demo.

(Test done in a Virtualmachine)

Now, let's see how to install speedtest on your own server (Debian in my case)

Installation

You will need first to have a LAMP server. If it is not the case, you can check my previous tutorial on how to install a LAMP server on Debian 9.

1) Install basic requirements

In root (or with sudo), simply run:

apt install libapache2-mod-php php-mcrypt


2) Tweak Apache and PHP configurations

You will need to set the "KeepAlive On" function in Apache and to increase the size limit/memory limit of PHP. Still in root, or with sudo, run:

nano /etc/apache2/apache2.conf

and look for the value KeepAlive. Ensure it is "on" and uncommented.

Now modify php configuration:

nano /etc/php/7.0/apache2/php.ini

And modify the values:

max_execution_time = 90 max_input_time = 90 memory_limit = 128M post_max_size = 50M upload_max_filesize = 50M

And restart Apache

service apache2 restart


3) Clone their repo

You will need git first, then you can clone

apt install git
cd /var/www
git clone https://github.com/adolfintel/speedtest
cd speedtest

Now select one of the speedtest design example to be the main page. You can have more detail here. The best starting point is the example-pretty.html. Simply copy it as index.html

cp example-gauges.html index.html


4) Create a dedicated virtualhost

To server this page as a domain name or subdomain name, you can create a dedicated virtualhost. Here is how I did

sudo nano /etc/apache2/sites-available/speedtest.conf

And add

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName speed.domain.tld
        DocumentRoot /var/www/speedtest

        <Directory /var/www/speedtest>
           Options FollowSymLinks
           AllowOverride All
           Require all granted
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/speedtest_error.log
    CustomLog ${APACHE_LOG_DIR}/speedtest_access.log combined

</VirtualHost>

Enable the configuration

sudo a2ensite speedtest

and reload your configuration

systemctl reload apache2

Now you should have access to your own speedtest!

That's it!

You can do further tweak on the configuration, especially on the TCP part, as explained in their github repo.

]]>
Flood, modern web UI for rTorrent https://freedif.org/flood-modern-web-ui-for-rtorrent 2018-03-15T08:23:00+00:00 2018-03-15T08:23:00+00:00

RTorrent is probably the most powerful torrent client, but bundled with Flood, a modern Web-UI, it is the perfect match for your seedbox or server.

EDIT: OUTDATED POST, please visit this one instead to install Flood + Rtorrent on Debian 10.

I probably don’t have to present rTorrent. I have written several articles around it, the previous one being on Quickbox, a script that will install and configure your seedbox (Using rTorrent) in a single command line.

I used to use Deluge, for my torrents, but since I discovered Flood, a modern, powerful and easy to install web interface for rTorrent, I’m changing my habits. 😉

Flood is using Node.js as backend and React as frontend, and here is the main features I appreciate:

  • Lightweight, intuitive and modern interface
  • Can add torrents through URL, Torrent file and RSS. (Usually, you need quite some settings for RSS. Here you can add your download rules directly in the web interface!)
  • Ability to download your torrent directly through your web interface. This is probably the best feature, since you can download the file from your seedbox, and directly get it back using “direct download” (HTTP) from Flood. (No need to have a FTP or some HTTP folder with user/password, etc..

And, well…it’s based on rTorrent 😉

Of course, you will find the usual features like labels, bandwidth limits, etc…

Let’s see how to install rTorrent and Flood for Debian 9. (Ubuntu should be pretty similar)

Installation

1) Install rTorrent

The easiest way is to use the rTorrent version in the repo. In root (or with sudo), run:

apt install rtorrent screen

 

2) Confgure rTorrent

First, create a dedicated user, to avoid running rTorrent with root:

 adduser --disabled-password rtorrent

You will need to answer few questions (or just skip them with ENTER)

Then, we will create a configuration file to define few settings and the SCGI to let Flood connect to rTorrent.

nano /home/rtorrent/.rtorrent.rc

and copy the following:

    # Where rTorrent saves the downloaded files
    directory = /srv/torrent/downloads

    # Where rTorrent saves the session
    session = /srv/torrent/.session

    # Which ports rTorrent can use (Make sure to open them in your router)
    port_range = 50000-50000
    port_random = no

    # Check the hash after the end of the download
    check_hash = yes

    # Enable DHT (for torrents without trackers)
    dht = auto
    dht_port = 6881
    peer_exchange = yes

    # Authorize UDP trackers
    use_udp_trackers = yes

    # Enable encryption when possible
    encryption = allow_incoming,try_outgoing,enable_retry

    # SCGI port, used to communicate with Flood
    scgi_port = 127.0.0.1:5000

It will work out of the box, but feel free to tweak it, especially on the download paths.

Create the mentioned folders (download and session)

mkdir /srv/torrent
mkdir /srv/torrent/downloads
mkdir /srv/torrent/.session

and set the rights permissions:

chmod 775 -R /srv/torrent 
chown rtorrent:rtorrent -R /srv/torrent 
chown rtorrent:rtorrent /home/rtorrent/.rtorrent.rc

Now, we create a SystemD startup script to ensure rtorrent is running at the startup (and it ease the control)

nano /etc/systemd/system/rtorrent.service

and add:

    [Unit]
    Description=rTorrent
    After=network.target

    [Service]
    User=rtorrent
    Type=forking...
]]>
How to install Chevereto image hosting for Debian 9 https://freedif.org/how-to-install-chevereto-image-hosting-for-debian-9 2018-03-12T01:44:39+00:00 2018-03-12T01:44:39+00:00

Before Instagram, image hosting scripts were quite popular to create our own image hosting website. The most popular opensource apps were Chevereto. I'm happy to see that the dev is still maintaining it!

Written in PHP, Chevereto is an opensource image hosting script that allows you to get a beautiful and features-rich website to install on your own server. They have 2 versions, a paid one and a free one. The free one is having slightly less features (Updated every 6 months instead of monthly, no social integration, no external storage support,...)

As you can see on their features page, the list is long. You will probably appreciate:

  • Mobile responsive
  • Multi homepage covers
  • Multi image upload
  • Categories and context
  • Bulk photo management
  • Multi-language Support (29 languages)
  • Privacy settings and many more.

They also have 19 ad spaces to monetize your website if you wish.

The best is to give it a try with their demo.

Now let's see how to install Chevereto on Debian 9

Installation

The installation is pretty simple and require few dependencies. First, ensure you have a LAMP server (Apache2, PHP, MySQL). If you don't have, here is how to install LAMP server on Debian 9.

1) Enable mod rewrite

Very little requirements, it usually all come with LAMP. But you will need to enable the mod rewrite. To do so, simply run:

sudo a2enmod rewrite
systemctl restart apache2


2) Download the Chevereto Installer

Inside a public folder like /var/www

cd /var/www
mkdir chevereto
cd chevereto
wget https://chevereto.com/download/file/installer -O index.php
sudo chown -R www-data:www-data /var/www/chevereto


3) Create a dedicated Virtualhost

You probably want to use a subdomain (pic.mydomain.tld) or a dedicated domain name. The best is to go with a dedicated virtualhost to handle apache2 configurations.

sudo nano /etc/apache2/sites-available/chevereto.conf

And add

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName pic.domain.tld
        DocumentRoot /var/www/chevereto

        <Directory /var/www/chevereto>
           Options FollowSymLinks
           AllowOverride All
           Require all granted
        </Directory>

    ErrorLog ${APACHE_LOG_DIR}/chevereto_error.log
    CustomLog ${APACHE_LOG_DIR}/chevereto_access.log combined

</VirtualHost>

Enable the configuration

sudo a2ensite chevereto

and reload your configuration

systemctl reload apache2


4) Access the web installer panel

Now simply go to the configured domain name to access the web installer. It will check your system conf and ask you if you want to go for the free or paid version. Select Free version

It will then download the latest version. Next step will be to configure your database (I use PHPMyAdmin to create a dedicated user/pass/database). And finally to create your admin account.

Once done, you will be able to go directly to your admin panel.

That's it.

Next step could be to add a SSL certificate using Let's Encrypt.

]]>
Let's Encrypt SSL Certificates with Certbot for Debian 9 https://freedif.org/ssl-certificate-with-lets-encrypt-for-debian-9 2018-03-11T14:03:12+00:00 2018-03-11T14:03:12+00:00

Let's Encrypt has been the engine to push SSL adoption, with simple, free and well accepted SSL certificates.

On top of improved security/privacy, It is no secret that Google itself promote HTTPS website over HTTP, which now became an important factor for Search Engine Optimization (SEO).

The installation on Debian is still pretty simple, but changed in the last year (my previous article is thus depreciated). Here is how to setup SSL certificates for your website, using Let's Encrypt.

https://freedif.org/uploads/2016/03/Firefox-300x124.jpg

You can find the official doc here and if you are using Debian 9 like me, here is how to do.

1) Add backports repo to your sources list

Modify your sources.list:

sudo nano /etc/apt/sources.list

and add

deb http://ftp.debian.org/debian jessie-backports main Save and update your packages list'

sudo apt update

2) Install Certbot

Now install certbot from the backports:

sudo apt install python-certbot-apache -t stretch-backports

3) Generate the SSL certificates and configurations

Run:

sudo certbot --installer apache

You will have a list of options to select, such as the authenticator (I used the beta version of apache authenticator, works well, option 1) Then you need to select the list of virtualhost to add SSL certificates and select if you want to force HTTPS or not. (Yes in my case)

Once done, reload apache

systemctl reload apache2

4) Automate Renewal

Before that your certificate expire, you will need to renew it. Let's automate this ;)

sudo crontab -e

And add

@daily certbot renew --quiet

That's it!

]]>
how to install Matomo (Piwik) on Debian https://freedif.org/how-to-install-matomo-piwik-on-debian 2018-03-10T09:48:00+00:00 2018-03-10T09:48:00+00:00

With more than 3 millions downloads, and large companies like T-Mobile, Wikimedia, Forbes,.. using it, Matomo (previously Piwik) is the most popular opensource web analytics app.

Great alternative to Google Analytics, Piwik as been here for 10 years. The team behind the project, decided recently (Jan 2018) to change their name as you can read in their announcement to become Matomo (It means honesty in Japanese by the way).

Here are some of the key features of Matomo:

  • Real time update
  • Customizable Dashboard
  • Advanced analytics for Ecommerce
  • Goal conversion tracking
  • Site Search Analytics
  • Geolocation
  • Site speed & pages speed reports
  • Track traffic from search engines
  • Custom Alerts
  • And a IOS, Android application!

You can have the full list of features in their dedicated page.

Interested to give it shot? Try their demo.

Now let's see how to install Matomo (formerly Piwik) on your Linux server (Debian in my case.)

Installation Steps

First you will need to have a working LAMP server. If it is not the case, you can check my recent article on how to install LAMP. Luckily, they maintained a debian/ubuntu repo, which makes it very easy to install.

1) Add their repo to your sources list

Simply run:

wget https://debian.piwik.org/repository.gpg -qO piwik-repository.gpg
cat piwik-repository.gpg | sudo apt-key add -

Then add their repo to your sources.list file

nano /etc/apt/sources.list

and add

deb https://debian.piwik.org/ piwik main

Refresh your package list

sudo apt-get update


2) Install Piwik from the repo and the required PHP dependencies

You will need to install some dependencies first.

sudo apt update
sudo apt install piwik php-curl php-fpm php-gd php-zip php-mbstring php-xml


3) Correct permissions and remove the readme

rm "/usr/share/doc/piwik/README.md.gz"
chmod +w /usr/share/piwik/piwik.js
chown www-data:www-data /usr/share/piwik/piwik.js


4) Create a dedicated MySQL database

Now you will need to create a dedicated MySQL database and a dedicated user. The easiest way to do it will be through phpmyadmin. Once done, you can go to the next step.

5) Update the virtualhost configuration

Before accessing Piwik and finalizing the installation, it will be better to create a virtualhost with a subdomain to access directly your Piwik instance. Piwik comes with a configuation ready, accessible through /piwik, but I prefer configuring entirely mine.

Delete previous configuration

sudo rm /etc/apache2/conf-available/piwik.conf 
sudo rm /etc/apache2/conf-enabled/piwik.conf 

And create a new virtual host

sudo nano /etc/apache2/sites-available/piwik.conf

And add

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName piwik.domain.tld
        DocumentRoot /usr/share/piwik

        <Directory /usr/share/piwik>
           DirectoryIndex index.php
           Options FollowSymLinks
           AllowOverride All
           Require all granted
        </Directory>

        <Files "console">
           Options None
           Require all denied
        </Files>

        <Directory /usr/share/piwik/misc/user>
           Options None
           Require all granted
        </Directory>

        <Directory /usr/share/piwik/misc>
           Options None
           Require all denied
        </Directory>

        <Directory /usr/share/piwik/vendor>
           Options None
           Require all denied
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
        CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined

</VirtualHost>

Enable the configuration

sudo a2ensite piwik

and reload your configuration

systemctl reload apache2


6) Run the web based installation panel

Now, simply go to the configured URL to launch the installation panel. It will check that you have all required dependencies, if it is not the case, you will need to fix...

]]>
How to install Grav on Debian 9 https://freedif.org/how-to-install-grav-on-debian-9 2018-03-06T13:20:03+00:00 2018-03-06T13:20:03+00:00

Hello guys, As you can see, I have moved from Wordpress to Grav!!

For those who don't know what is Grav, it is an opensource flat-file CMS (Content Management System), meaning without the need of a database. It has been developped from the start to be as performing as possible.

It is also very flexible and easy to use/maintained.

Written in PHP, it leverages Markdown files to store the content, Grav does not require a database. Everything is stored as simple files. It makes it quite fast to run (Especially on SSD) and easy to back up !! You can see all the features here.

Actually my migration experience was a bit more tricky then expected, but I'm quite happy to be on Grav now. On the main issues I faced, I can mention:

  • Only 1 plugin in Wordpress to migrate to Grav called WP2Grav but it cannot keep the comments and the markdown created files required some polishing (I had to use some commands like sed -i... to replace some content)
  • As I imported around 200 articles, the related-pages pluging of Grav were significantly slowing down the blog, creating even loading errors (because it needed more than 30s to display the page...)
  • I had to tweak some files of my template to do what I wanted. Actually it was not difficult, but since there is little documentation yet, it was not as simple as I thoughts.

But overall I'm satisfied.

Now let's see how to install Grav on your Linux server (Debian in my case. Ubuntu should be similar)

Installation Steps

First you will need to have a working LAMP server. If it is not the case, you can check my recent article on how to install LAMP.

1) Refresh your source list and install the required php dependencies.

sudo apt update
sudo apt install php-curl php-fpm php-gd php-zip php-mbstring php-xml

 

2) Download the latest version of Grav

Go to the download section of the grav website: https://getgrav.org/downloads and check which version is the latest. I suggest you to download the one with the admin panel version (The 1.3.10 as of today's article). Then run:

cd /var/www/
wget https://getgrav.org/download/core/grav-admin/1.3.10 -O grav.zip
unzip grav.zip
rm grav.zip

 

3) Assign the correct permissions

sudo chown -R www-data:www-data /var/www/grav-admin

 

4) Enable required Apache modules

You will need to enable the modules 'rewrite', 'proxy' and 'proxy_fcgi'. You will need also to enable the configuration of pfp-fpm. To do so, simply run:

sudo a2enmod rewrite proxy proxy_fcgi
sudo a2enconf php-fpm

and restart apache.

sudo systemctl restart apache2

 

5) Create a dedicated virtualhost

I suggest you to run a dedicated virtualhost (for a subdomain, or to better tailor Grav CMS later on). To do this, run:

sudo nano /etc/apache2/sites-available/grav.conf

and copy:

<VirtualHost *:80>

        ServerAdmin webmaster@localhost
        ServerName myurl.com
        DocumentRoot /var/www/grav-admin

        <Directory /var/www/grav-admin>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/grav_error.log
        CustomLog ${APACHE_LOG_DIR}/grav_access.log combined

</VirtualHost>

I let you modify it to fit your needs.

Now enable it and...

]]>