Ubuntu Server or Desktop Zoneminder 1.34.x

From ZoneMinder Wiki
Jump to navigationJump to search

Shell script zm-install-bionic

Script for Ubuntu with LAMP (MySQL)

#!/bin/sh
clear
read -p "This script installs Zoneminder 1.30.4 on Ubuntu 18.04 AMD64 with LAMP (MySQL) 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 download the Zoneminder install package. This may take a minute to connect
Press enter to continue" nothing
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1bZhVcBnlW46SwCnSnZ0sdZzwtOcCiisX' -O /tmp/zoneminder-1.30.4-bionic-amd64.deb
ls /tmp/zoneminder*
read -p "Check above to be sure the file downloaded. Should be:
/tmp/zoneminder-1.30.4-bionic-amd64.deb (5686708)
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add settings to MySQL and PHP config files. 
Press enter to continue" nothing
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
echo "[mysqld]" >> /etc/mysql/my.cnf
echo "init_connect = 'SET @@sql_mode = CASE CURRENT_USER() WHEN \'zmuser@localhost\' THEN \'NO_ENGINE_SUBSTITUTION\' ELSE @@sql_mode END;'" >> /etc/mysql/my.cnf
systemctl restart mysql
clear
read -p "Now we will install, enable and start Zoneminder. 
Press enter to continue" nothing
apt-get -y install /tmp/zoneminder-1.30.4-bionic-amd64.deb
systemctl enable zoneminder
service zoneminder start
read -p "Now we will add settings to Apache and restart it. 
Press enter to continue" nothing
adduser www-data video
a2enmod cgi
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Open Zoneminder in a web browser (http://server-ip/zm). 
Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms 
Click the Save button. 
Press enter to continue" nothing
clear


Script for Ubuntu 18.04 - will install Apache, Mariadb, PHP and Zoneminder 1.30.4

#!/bin/sh
clear
read -p "This script installs Apache, Mariadb, PHP, and Zoneminder 1.30.4 on Ubuntu 18.04 AMD64
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 install Apache, Mariadb Server and PHP
Press Enter to continue or Ctrl + c to quit" nothing
apt update
apt -y install apache2 mariadb-server mariadb-client php7.2 libapache2-mod-php7.2 php7.2-common php7.2-mbstring php7.2-xmlrpc php7.2-soap php7.2-gd php7.2-xml php7.2-intl php7.2-mysql php7.2-cli php7.2-zip php7.2-curl
clear
read -p "Next secure mariadb server by entering requested information. Press enter to continue" nothing
mysql_secure_installation
read -p "Next we will download the Zoneminder install package. This may take a minute to connect
Press enter to continue" nothing
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1bZhVcBnlW46SwCnSnZ0sdZzwtOcCiisX' -O /tmp/zoneminder-1.30.4-bionic-amd64.deb
ls /tmp/zoneminder*
read -p "Check above to be sure the file downloaded. Should be:
/tmp/zoneminder-1.30.4-bionic-amd64.deb (5686708)
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add time zone to PHP config files. 
Press enter to continue" nothing
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
read -p "Now we will install, enable and start Zoneminder. 
Press enter to continue" nothing
apt-get -y install /tmp/zoneminder-1.30.4-bionic-amd64.deb
systemctl enable zoneminder
service zoneminder start
read -p "Now we will add settings to Apache and restart it. 
Press enter to continue" nothing
adduser www-data video
a2enmod cgi
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Open Zoneminder in a web browser (http://server-ip/zm). 
Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms 
Click the Save button. 
Press enter to continue" nothing
clear

Script to patch upgrade from Ubuntu 16.04 to 18.04. Works with MySQL or Mariadb (MySQL)

#!/bin/sh
clear
read -p "This script updates Zoneminder 1.30.4 on Ubuntu 18.04  with LAMP (MySQL) after an upgrade from Ubuntu 16.04...
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 download the Zoneminder install package. This may take a minute to connect
Press enter to continue" nothing
wget --no-check-certificate 'https://docs.google.com/uc?export=download&id=1bZhVcBnlW46SwCnSnZ0sdZzwtOcCiisX' -O /tmp/zoneminder-1.30.4-bionic-amd64.deb
ls /tmp/zoneminder*
read -p "Check above to be sure the file downloaded. Should be:
/tmp/zoneminder-1.30.4-bionic-amd64.deb (5686708)
Press Enter to continue or Ctrl + c to quit" nothing
clear
read -p "Next we will add settings to PHP config files. 
Press enter to continue" nothing
awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.2/apache2/php.ini
clear
read -p "Now we will upgrade, enable and start Zoneminder. 
Press enter to continue" nothing
apt-get -y --allow-downgrades install /tmp/zoneminder-1.30.4-bionic-amd64.deb
systemctl enable zoneminder
service zoneminder start
a2enmod php7.2 
a2enmod cgi
a2enconf zoneminder
a2enmod rewrite
chown -R www-data:www-data /usr/share/zoneminder/
service apache2 reload
clear
read -p "Open Zoneminder in a web browser (http://server-ip/zm). 
Click on Options - Paths and chech that PATH_ZMS is /zm/cgi-bin/nph-zms 
Click the Save button. 
Press enter to continue" nothing
clear