Difference between revisions of "Ubuntu Server or Desktop Zoneminder 1.34.x"
Line 167: | Line 167: | ||
adduser www-data video | adduser www-data video | ||
Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/ | Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/ |
Revision as of 08:37, 6 February 2020
Note: the same install procedure applies for server or desktop. Ubuntu 19.04 is not included as support for this release ends January 2020.
A word of caution for upgraders. As of 22JAN20 the PPA/zoneminder-master, the development area, has versions of Zoneminder 1.34. If you were using the 1.33.x development version of Zoneminder and you apt update - apt upgrade without changing to PPA/zoneminder-1.34 you will get the next development version. Just be aware that it is possible some things may not work!
Also, these procedures are for a new Zoneminder install. Upgraders are encouraged to check the Zoneminder-1.34 Forum area for information.
Install Zoneminder 1.34.x on Ubuntu 18.04 or 19.10 with shell script
This will install Zoneminder 1.34.x by using a shell script with one basic command (how easy is that!).
You will need a Ubuntu 18.04 or 19.10 install with LAMP (Apache, Mariadb and PHP) installed desktop or server. As an alternate you may use MySQL in lieu of MySQL. Google is your friend if you need instructions for setting up a LAMP server.
Shell script file contents:
#!/bin/sh clear read -p "This script installs Zoneminder 1.34.x on Ubuntu 18.04 or 19.10 with LAMP (MySQL or Mariadb) installed... Press Enter to continue or Ctrl + c to quit" nothing clear read -p "You must be logged in as root using sudo su ... Press Enter to continue or Ctrl + c to quit" nothing clear read -p "Next we will add the PPA repository, install and configure the system to run Zoneminder. Press enter to continue" nothing apt install -y software-properties-common clear add-apt-repository ppa:iconnor/zoneminder-1.34 clear apt install -y zoneminder systemctl enable zoneminder service zoneminder start adduser www-data video a2enconf zoneminder a2enmod rewrite a2enmod headers a2enmod expires service apache2 reload clear read -p "Install complete. Open Zoneminder/Options and set the timezine. Press enter to continue" nothing clear
Copy the contents of the script, open a terminal and run:
nano zm-install
Paste the contents of the script into Nano
Then:
Ctrl + o Ctrl + x
Next run:
chmod 755 zm-install
Start the script by entering:
./zm-install
Follow the prompts. Things are pretty simple. The timezone is now set in Zoneminder/Options.
Good Luck!
MySQL 8 - Additional Steps - Ubuntu 19.10 (and beyond?)
MySQL 8 has added security measures that will have to be modified to run Zoneminder.
This procedure should be done before installing Zoneminder. However, I have done it before and after running the install. If done before installing Zoneminder you will see errors reported after the zm database is created. That's OK as the error is the install package not creating the "zmuser" which what this procedure does. If you run this procedure after the install you will see the same error and additional error when the script tries to start Zoneminder. Just run this procedure and when done run "systemctl start zoneminder"
Secure MySQL if you haven't already done it. Do not activate VALIDATE PASSWORD COMPONENT.
mysql_secure_installation
Edit MySQL configuration to use native password
nano /etc/mysql/mysql.conf.d/mysqld.cnf
Below [mysqld] add
default_authentication_plugin = mysql_native_password
CTRL + o to save CTRL +x to exit
Restart MySQL
systemctl restart mysql
Note: The Zoneminder package will not complete successfully and will show errors. This will be corrected in the next step.
Create user and set permissions (press Enter after each entry)
mysql (Enter MySQL processing)
mysql> CREATE USER 'zmuser'@localhost IDENTIFIED WITH mysql_native_password BY 'zmpass';
mysql> GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES ;
mysql> \q
Reload MySQL
mysqladmin -uroot -p reload
You may now install Zoneminder
Install Zoneminder 1.34.x on Ubuntu 18.04 LEMP (NGNIX, Mariadb, PHP)
Thanks to "terdinglage" for the input to get this to work!
While not tested this procedure should work on Ubuntu 19.10 using PHP 7.3.
Start with a basic Ubuntu 18.04 install. You can use a server or desktop install. Do not install LAMP!
Become root
sudo su
Install Ngnix, Mariadb and PHP components
apt install nginx mariadb-server php-fpm php-mysql fcgiwrap
Secure the Mariadb server
mysql_secure_installation
Restart Mariadb
systemctl restart mysql
Edit the php.ini file
nano /etc/php/7.2/fpm/php.ini
Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to
cgi.fix_pathinfo=0
Remember to remove the leading ;
Ctrl+o Enter to save
CTRL+x to exit
Restart php-fpm
systemctl restart php7.2-fpm
Add Repository
NOTE:You may need to run: "apt install software-properties-common" if you did the minimal net install of Ubuntu.
add-apt-repository ppa:iconnor/zoneminder-1.34
Install Zoneminder
apt install zoneminder
Create a new user if you plan to use local (USB or capture card) cameras.
adduser www-data video
Change the ZM_PATH_ZMS in the 01-system-paths.conf file to /cgi-bin/nph-zms by dropping the /zm/
nano /etc/zm/conf.d/01-system-paths.conf
Ctrl+o Enter to save
CTRL+x to exit
Enable and start Zoneminder
systemctl enable zoneminder
service zoneminder start
Edit the Ngnix default configuration.
nano /etc/nginx/sites-available/default
Locate the line "index index.html index.htm index.nginx-debian.html;" and add index.php
index index.php index.html index.htm index.nginx-debian.html;
In the "server" section after listen [::] :80 default_Server; add
include /etc/nginx/zoneminder.conf;
Ctrl+o Enter to save
CTRL+x to exit
Create a Zoneminder conf file
nano /etc/nginx/zoneminder.conf
Enter the following into the zoneminder.conf file (This file was improved by databoy2k)
location /cgi-bin { auth_basic off; alias /usr/lib/zoneminder/cgi-bin; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param HTTP_PROXY ""; fastcgi_pass unix:/var/run/fcgiwrap.socket; } location /zm/cache { auth_basic off; alias /var/cache/zoneminder/cache; } location ~ /zm/api/(css|img|ico) { auth_basic off; rewrite ^/zm/api(.+)$ /api/app/webroot/$1 break; try_files $uri $uri/ =404; } location /zm { auth_basic off; alias /usr/share/zoneminder/www; try_files $uri $uri/ /index.php?$args =404; location /zm/api { auth_basic off; rewrite ^/zm/api(.+)$ /zm/api/app/webroot/index.php?p=$1 last; } location ~ \.php$ { auth_basic off; include fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_param HTTP_PROXY ""; fastcgi_index index.php; fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; } }
Ctrl+o Enter to save
CTRL+x to exit
Restart Ngnix
service nginx restart
Note: If Nginx gives you an error on restart go back one step and re-enter include /etc/ngnix/zoneminder.conf;
Create or edit the fcgiwrap:
nano /etc/default/fcgiwrap
and insert (with the number of children -c equal to the number of cameras) Note that you may need to have this value larger than the number if cameras. In my case I run "camera walls" from a custom web page that accesses the Zoneminder monitors. I have needed to increase the -c to include the number of cameras in the camera wall web pages.
DAEMON_OPTS=-c 10
Ctrl+o Enter to save
CTRL+x to exit
then restart the fcgiwrap service.
systemctl restart fcgiwrap
Open Zoneminder and under Options set your timezone.
Install Zoneminder 1.34.x on Ubuntu 16.04 with shell script
This will install Zoneminder by using a shell script with one basic command (how easy is that!).
You will need a Ubuntu 16.04 install with LAMP (Apache, MySQL and PHP) installed desktop or server. As an alternate you may use Mariadb in lieu of MySQL
Shell script file contents:
#!/bin/sh clear read -p "This script installs Zoneminder 1.34.x on Ubuntu 16.04 with LAMP (MySQL or Mariadb) installed... Press Enter to continue or Ctrl + c to quit" nothing clear read -p "You must be logged in as root using sudo su ... Press Enter to continue or Ctrl + c to quit" nothing clear read -p "Next we will add two PPA repositorys, install and configure the system to run Zoneminder. You will have to press enter twice to load two PPA repositories. Press enter to continue" nothing apt install -y software-properties-common clear add-apt-repository ppa:iconnor/zoneminder add-apt-repository ppa:iconnor/zoneminder-1.34 apt update clear apt install -y zoneminder systemctl enable zoneminder service zoneminder start adduser www-data video a2enconf zoneminder a2enmod rewrite chown -R www-data:www-data /usr/share/zoneminder/ service apache2 reload clear read -p "Install complete. Open Zoneminder/Options and set timezone. Press enter to continue" nothing clear
Copy the contents of the script, open a terminal and run:
nano zm-install
Paste the contents of the script into Nano
Then:
Ctrl + o Ctrl + x
Next run:
chmod 755 zm-install
Start the script by entering:
./zm-install
Follow the prompts. Things are pretty simple. Remember to open Zoneminder and set the timezone under options.
Good Luck!
Zoneminder 1.34.x on Ubuntu Server 14.04
Note: While this install seems to work, 14.04 is old and you will have a better system with 18.04.
Install Basic Server (if you used the mini.iso), OpenSSH Server, and LAMP Server
Log in then become root:
sudo su
Add the following two Repositories (if you get an error run: apt-get install software-properties-common)
add-apt-repository ppa:iconnor/zoneminder add-apt-repository ppa:iconnor/zoneminder-1.34
Update Sources
apt-get update
Install Zoneminder
apt-get install zoneminder
Add delay to allow MySQL to start before Zoneminder
nano /etc/init.d/zoneminder
Add sleep 15 after the existing "start() {" as shown:
start() { sleep 15 echo -n "Starting $prog: "
Ctrl+o Enter to save
CTRL+x to exit
Create a new user
adduser www-data video
Enable CGI, Zoneminder and rewrite configuration in Apache.
a2enmod cgi
a2enconf zoneminder
a2enmod rewrite
Start Zoneminder if needed (If you get an error Zoneminder is likely running already)
service zoneminder start
Restart Apache
service apache2 reload
Open Zoneminder and set timezone under Options