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

From ZoneMinder Wiki
Jump to navigationJump to search
Line 107: Line 107:
  skip-external-locking
  skip-external-locking
  '''sql_mode = NO_ENGINE_SUBSTITUTION'''
  '''sql_mode = NO_ENGINE_SUBSTITUTION'''
sudo systemctl restart mysql

Revision as of 03:52, 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
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