Difference between revisions of "Ubuntu Server 17.10 64-bit with Zoneminder 1.30.4 the easy way"
Line 1: | Line 1: | ||
__TOC__ | |||
===Ubuntu 17.10 with LAMP=== | |||
This is an interim procedure to install Zoneminder 1.30.4 on Ubuntu 17.10 | This is an interim procedure to install Zoneminder 1.30.4 on Ubuntu 17.10 | ||
Line 82: | Line 86: | ||
service apache2 reload | service apache2 reload | ||
IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms | |||
===Ubuntu 17.10 with LEMP (NGINX, Mariadb and PHP)=== | |||
Ubuntu 17.10 Nginx Mariadb PHP Zoneminder 1.30.4 | |||
Start with an install of Ubuntu 17.10, server, desktop or bare bones basic. Do not install LAMP! | |||
Become root | |||
sudo su | |||
Install Nginx and Mariadb | |||
apt install nginx | |||
apt install mariadb-server | |||
Secure Mariadb | |||
mysql_secure_installation | |||
Remove the symbolic link for Mariadb | |||
rm /etc/mysql/my.cnf | |||
Copy a basic config file to replace the symbolic link | |||
cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/my.cnf | |||
Edit the Mariadb config file | |||
nano /etc/mysql/my.cnf | |||
Locate entries like the following and replace them | |||
character-set-server = latin1 | |||
collation-server = latin1_swedish_ci | |||
Note: The above settings are actually the Mariadb default. Changing back to default is necessary to avoid errors when logging into Zoneminder. This was added on 01APR17 but is not an April Fool! It may be necessary to align these settings with your regional language. | |||
Ctrl+o Enter to save | |||
CTRL+x to exit | |||
Restart Mariadb | |||
systemctl restart mysql | |||
Install PHP components | |||
apt install php-fpm php-mysql fcgiwrap | |||
Edit the PHP ini file | |||
nano /etc/php/7.1/fpm/php.ini | |||
Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to | |||
cgi.fix_pathinfo=0 | |||
Also fix date. Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Make sure to remove the ; from the front of date.timezone | |||
[Date] | |||
; Defines the default timezone used by the date functions | |||
; http://php.net/date.timezone | |||
date.timezone = America/New_York | |||
Ctrl+o Enter to save | |||
CTRL+x to exit | |||
Restart php-fm | |||
systemctl restart php7.1-fpm | |||
Download the Zoneminder .deb file from the iconnor repository | |||
wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder/+build/12557069/+files/zoneminder_1.30.4-zesty1_amd64.deb | |||
Install Zoneminder. Change (user) as shown below to your user name on your Ubuntu install | |||
apt install vlc-plugin-base /home/(user)/zoneminder_1.30.4-zesty1_amd64.deb | |||
Add a user to enable local cameras | |||
adduser www-data video | |||
Change permissions | |||
chown -R www-data:www-data /usr/share/zoneminder/ | |||
Enable and start Zoneminder | |||
systemctl enable zoneminder | |||
service zoneminder start | |||
Edit the Nginx default config file | |||
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; | |||
Ctrl+o Enter to save | |||
Somewhere in the "server" section add | |||
include /etc/nginx/zoneminder.conf; | |||
Ctrl+o Enter to save | |||
CTRL+x to exit | |||
Create a Zoneminder config file | |||
nano /etc/nginx/zoneminder.conf | |||
Copy the following into it | |||
location /zm/cgi-bin { | |||
gzip off; | |||
alias /usr/lib/zoneminder/cgi-bin; | |||
include /etc/nginx/fastcgi_params; | |||
fastcgi_param SCRIPT_FILENAME $request_filename; | |||
fastcgi_pass unix:/var/run/fcgiwrap.socket; | |||
} | |||
location /zm { | |||
# if ($scheme ~ ^http:){ | |||
# rewrite ^(.*)$ https://$host$1 permanent; | |||
# } | |||
gzip off; | |||
alias /usr/share/zoneminder/www; | |||
index index.php; | |||
location ~ \.php$ { | |||
if (!-f $request_filename) { return 404; } | |||
expires epoch; | |||
include /etc/nginx/fastcgi_params; | |||
fastcgi_param SCRIPT_FILENAME $request_filename; | |||
fastcgi_index index.php; | |||
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; | |||
} | |||
location ~ \.(jpg|jpeg|gif|png|ico)$ { | |||
access_log off; | |||
expires 33d; | |||
} | |||
location /zm/api/ { | |||
alias /usr/share/zoneminder/www/api; | |||
rewrite ^/zm/api(.+)$ /zm/api/index.php?p=$1 last; | |||
} | |||
} | |||
Ctrl+o Enter to save | |||
CTRL+x to exit | |||
Restart Nginx | |||
service nginx restart | |||
IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms | IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms |
Revision as of 21:00, 25 November 2017
Ubuntu 17.10 with LAMP
This is an interim procedure to install Zoneminder 1.30.4 on Ubuntu 17.10
Note: There have been several reports of things, like the API, not working with Zoneminder and Ubuntu 17.10. You are better off to use Ubuntu 16.04!
There are some issues with the Zoneminder package provided with Ubuntu 17.10. This is an alternate install procedure that uses the install package from the iconnor PPA for Zesty (Ubuntu 17.04)
This assumes you have installed Ubuntu 17.10 with LAMP.
You will need to make a settings change to MySQL as follows:
This removes the current symbolic link
rm /etc/mysql/my.cnf
This moves the MYSQL Configuration file
cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
To change MySQL settings:
nano /etc/mysql/my.cnf
In the [mysqld] section add the following
sql_mode = NO_ENGINE_SUBSTITUTION
Ctrl+o Enter to save
CTRL+x to exit
Restart MySQL
systemctl restart mysql
Download the Zoneminder install package from the iconnor PPA. Note this is for the 64 bit version.
wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder/+build/12557069/+files/zoneminder_1.30.4-zesty1_amd64.deb
Install Zoneminder - Note: Change (user) to the user in the home directory on your system
apt install vlc-plugin-base /home/(user)/zoneminder_1.30.4-zesty1_amd64.deb
Create a new user
adduser www-data video
Enable CGI, Zoneminder and rewrite configuration in Apache.
a2enmod cgi
a2enconf zoneminder
a2enmod rewrite
Fix Permissions
chown -R www-data:www-data /usr/share/zoneminder/
Enable and start Zoneminder
systemctl enable zoneminder
service zoneminder start
Add timezone to PHP
nano /etc/php/7.1/apache2/php.ini
Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Make sure to remove the ; from the front of date.timezone
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = America/New_York
Ctrl+o Enter to save
CTRL+x to exit
Restart Apache
service apache2 reload
IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms
Ubuntu 17.10 with LEMP (NGINX, Mariadb and PHP)
Ubuntu 17.10 Nginx Mariadb PHP Zoneminder 1.30.4
Start with an install of Ubuntu 17.10, server, desktop or bare bones basic. Do not install LAMP!
Become root
sudo su
Install Nginx and Mariadb
apt install nginx
apt install mariadb-server
Secure Mariadb
mysql_secure_installation
Remove the symbolic link for Mariadb
rm /etc/mysql/my.cnf
Copy a basic config file to replace the symbolic link
cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/my.cnf
Edit the Mariadb config file
nano /etc/mysql/my.cnf
Locate entries like the following and replace them
character-set-server = latin1 collation-server = latin1_swedish_ci
Note: The above settings are actually the Mariadb default. Changing back to default is necessary to avoid errors when logging into Zoneminder. This was added on 01APR17 but is not an April Fool! It may be necessary to align these settings with your regional language.
Ctrl+o Enter to save
CTRL+x to exit
Restart Mariadb
systemctl restart mysql
Install PHP components
apt install php-fpm php-mysql fcgiwrap
Edit the PHP ini file
nano /etc/php/7.1/fpm/php.ini
Locate (Ctrl+w) cgi.fix_pathinfo=1 and change to
cgi.fix_pathinfo=0
Also fix date. Search for [Date] (Ctrl + w then type Date and press Enter) and make changes as follows for your time zone. Make sure to remove the ; from the front of date.timezone
[Date] ; Defines the default timezone used by the date functions ; http://php.net/date.timezone date.timezone = America/New_York
Ctrl+o Enter to save
CTRL+x to exit
Restart php-fm
systemctl restart php7.1-fpm
Download the Zoneminder .deb file from the iconnor repository
wget https://launchpad.net/~iconnor/+archive/ubuntu/zoneminder/+build/12557069/+files/zoneminder_1.30.4-zesty1_amd64.deb
Install Zoneminder. Change (user) as shown below to your user name on your Ubuntu install
apt install vlc-plugin-base /home/(user)/zoneminder_1.30.4-zesty1_amd64.deb
Add a user to enable local cameras
adduser www-data video
Change permissions
chown -R www-data:www-data /usr/share/zoneminder/
Enable and start Zoneminder
systemctl enable zoneminder service zoneminder start
Edit the Nginx default config file
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;
Ctrl+o Enter to save
Somewhere in the "server" section add
include /etc/nginx/zoneminder.conf;
Ctrl+o Enter to save
CTRL+x to exit
Create a Zoneminder config file
nano /etc/nginx/zoneminder.conf
Copy the following into it
location /zm/cgi-bin { gzip off; alias /usr/lib/zoneminder/cgi-bin; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_pass unix:/var/run/fcgiwrap.socket; } location /zm { # if ($scheme ~ ^http:){ # rewrite ^(.*)$ https://$host$1 permanent; # } gzip off; alias /usr/share/zoneminder/www; index index.php; location ~ \.php$ { if (!-f $request_filename) { return 404; } expires epoch; include /etc/nginx/fastcgi_params; fastcgi_param SCRIPT_FILENAME $request_filename; fastcgi_index index.php; fastcgi_pass unix:/var/run/php/php7.1-fpm.sock; } location ~ \.(jpg|jpeg|gif|png|ico)$ { access_log off; expires 33d; } location /zm/api/ { alias /usr/share/zoneminder/www/api; rewrite ^/zm/api(.+)$ /zm/api/index.php?p=$1 last; } }
Ctrl+o Enter to save
CTRL+x to exit
Restart Nginx
service nginx restart
IMPORTANT FINAL STEP: Open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change PATH_ZMS to /zm/cgi-bin/nph-zms