Difference between revisions of "Ubuntu Install ZoneMinder on Ubuntu Server"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 11: Line 11:
  sudo ufw allow https
  sudo ufw allow https
  sudo ufw enable
  sudo ufw enable
  sudo ufw status
  sudo ufw status
Status: active
To                        Action      From
--                        ------      ----
22/tcp                    ALLOW      Anywhere
80/tcp                    ALLOW      Anywhere
443/tcp                    ALLOW      Anywhere
22/tcp (v6)                ALLOW      Anywhere (v6)
80/tcp (v6)                ALLOW      Anywhere (v6)
443/tcp (v6)              ALLOW      Anywhere (v6)
  sudo ufw reload
  sudo ufw reload



Revision as of 03:55, 31 March 2020

LAMP (Linux, Apache, MySQL, PHP) vorbereiten

Installation Apache

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get install apache2

Firewall einrichten

sudo ufw allow ssh
sudo ufw allow http
sudo ufw allow https
sudo ufw enable
sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
22/tcp                     ALLOW       Anywhere
80/tcp                     ALLOW       Anywhere
443/tcp                    ALLOW       Anywhere
22/tcp (v6)                ALLOW       Anywhere (v6)
80/tcp (v6)                ALLOW       Anywhere (v6)
443/tcp (v6)               ALLOW       Anywhere (v6)
sudo ufw reload

MySQL installieren

sudo apt-get install mysql-server
sudo mysql
mysql> SHOW databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)
mysql> exit
sudo mysql -e "CREATE USER 'mysqladmin'@'localhost' IDENTIFIED BY 'mysqladmin';"
sudo mysql -e "GRANT ALL PRIVILEGES ON * . * TO 'mysqladmin'@'localhost' WITH GRANT OPTION;"
sudo mysql -e "FLUSH PRIVILEGES;"
mysql -u mysqladmin -p
exit

PHP-FPM installieren

sudo apt-get install php-fpm

sudo a2enmod proxy_fcgi
sudo a2enconf php7.2-fpm

sudo systemctl restart apache2
sudo systemctl restart php7.2-fpm.service

Webserver Rechte anpassen

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

sudo find /var/www -type d -exec chmod g+s {} +

Benutzerzugriffe auf Webseiten-Dateien gewähren

sudo apt-get install bindfs

mkdir ~/websites
printf "\n\nbindfs#/var/www/ /home/$USER/websites/ fuse force-user=$USER,force-group=$USER,create-for-user=www-data,create-for-group=www-data,create-with-perms=0770,chgrp-ignore,chown-ignore,chmod-ignore 0 0" | sudo tee -a /etc/fstab
sudo cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/ubuntu-vg/ubuntu-lv during curtin installation
/dev/disk/by-id/dm-uuid-LVM-biSTbFwePFxtmgpVX68Rwa01ddBXHcAixzw1EBpYcV8kumDeCPxLkQnyNX2hkJ8M / ext4 defaults 0 0
# /boot was on /dev/sda2 during curtin installation
/dev/disk/by-uuid/c4c0f1b3-7284-4880-a2bc-11ab15c0a5f3 /boot ext4 defaults 0 0
/swap.img       none    swap    sw      0       0


bindfs#/var/www/ /home/myroot/websites/ fuse force-user=myroot,force-group=myroot,create-for-user=www-data,create-for-group=www-data,create-with-perms=0770,chgrp-ignore,chown-ignore,chmod-ignore 0 0
sudo mount /home/$USER/websites

PHP testen

echo "<?php phpinfo();" > ~/websites/html/phpinfo.php

Installation ZoneMinder

ZoneMinder Repository hinzufügen

sudo add-apt-repository ppa:iconnor/zoneminder-1.34
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade

Konfiguration MySQL

sudo rm /etc/mysql/my.cnf
sudo cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
sudo vi /etc/mysql/my.cnf
[mysqld]
#
# * Basic Settings
#
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
sql_mode = NO_ENGINE_SUBSTITUTION
sudo systemctl restart mysql

ZoneMinder Installation

sudo apt-get install zoneminder

Webserver Konfiguration

sudo chmod 740 /etc/zm/zm.conf
sudo chown root:www-data /etc/zm/zm.conf
sudo chown -R www-data:www-data /usr/share/zoneminder/
sudo a2enmod cgi
sudo a2enmod rewrite
sudo a2enconf zoneminder
sudo a2enmod expires
sudo a2enmod headers
sudo vi /etc/php/7.2/fpm/php.ini
[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Europe/Berlin"
sudo systemctl restart apache2
sudo systemctl restart php7.2-fpm.service
sudo systemctl enable zoneminder
sudo systemctl start zoneminder