A collection of classes and commands for automated command line scripting using Python.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
1.9 KiB

Install dependencies
apt install apache2 mariadb-server php libapache2-mod-php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear phpbcmath curl unzip -v
sudo systemctl start apache2
sudo systemctl start mariadb
Enable and Create db
sudo systemctl enable apache2 mariadb
CREATE MYSQL DATABASE
MYSQL
CREATE DATABASE matomodb;
CREATE USER 'matomouser'@'localhost' IDENTIFIED BY 'password'
GRANT ALL PRIVILAGES ON matomodb.* TO 'matomouser'@'localhost'
Pull and unzip Matomo files and set permissions
wget http://builds.matomo.org/matomo-latest.zip
unzip matomo-latest.zip
mv matomo /var/www/html/matomo
chown -R www-data:www-data /var/www/html/matomo
chmod -R 755 /var/www/html/matomo
Create Apache config file
sudo nano /etc/apache2/sites-available/matomo.conf
<VirtualHost *:80>
ServerName matomo.mark37.com
DocumentRoot /var/www/html/matomo/
<Directory /var/www/html/matomo>
Options FollowSymLinks
Allowoverride All
Require all granted
</Directory>
<Files "console">
Options None
Require all denied
</Files>
<Directory /var/www/html/matomo/misc/user>
Options None
Required all granted
</Directory>
<Directory /var/www/html/matomo/misc>
Options None
Required all granted
</Directory>
<Directory /var/www/html/matomo/vendor>
Options None
Required all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/matomo_error.log
CustomLog ${APACHE_LOG_DIR}/matomo_access.log combined
</VirtualHost>
Enable site
sudo a2ensite matomo.mark37.com
sudo a2enmod rewrite headers enc dif mime setenvif ssl
sudo systemctl enable --now php7.4-fpm
sudo systemctl reload apache2
Install SSL Certificate
sudo apt install certbot python3-certbot-apache -y
sudo ufw disable
sudo certbot --apache -d matomo.mark37.com
sudo ufw enable
cron settings for Ssl renew
0 6 * * 0 certbot renew -n -q --pre-hook “systemctl stop apache2” --post-hook “systemctl start apache2”