From b2d1d688ccd0c0e22de4c5d662467cfecf49ceeb Mon Sep 17 00:00:00 2001 From: Steve Gilvarry Date: Sun, 3 Jul 2016 20:21:13 +1000 Subject: [PATCH 1/4] Updates to Ubuntu and Debian install guides --- docs/installationguide/debian.rst | 157 ++++++++++-- docs/installationguide/ubuntu.rst | 398 ++++++++++++++++-------------- docs/userguide/options.rst | 1 + 3 files changed, 350 insertions(+), 206 deletions(-) diff --git a/docs/installationguide/debian.rst b/docs/installationguide/debian.rst index 9294ebeb6..e253c130e 100644 --- a/docs/installationguide/debian.rst +++ b/docs/installationguide/debian.rst @@ -1,37 +1,154 @@ Debian ====== -A fresh build based on master branch running Debian 7 (wheezy)\: +.. contents:: + +Easy Way: Debian Jessie +----------------------- + +**Step 1**: Setup Sudo + +By default Debian does not come with sudo. Log in as root or use su command. +N.B. The instructions below are for setting up sudo for your current account, you can +do this as root if you prefer. + +:: + + aptitude update + aptitude install sudo + usermod -a -G sudo + exit + +Logout or try ``newgrp`` to reload user groups + +**Step 2**: Run sudo and update + +Now run session using sudo and ensure system is updated. :: - root@host:~# aptitude install -y apache2 mysql-server php5 php5-mysql build-essential libmysqlclient-dev libssl-dev libbz2-dev libpcre3-dev libdbi-perl libarchive-zip-perl libdate-manip-perl libdevice-serialport-perl libmime-perl libpcre3 libwww-perl libdbd-mysql-perl libsys-mmap-perl yasm automake autoconf libjpeg8-dev libjpeg8 apache2-mpm-prefork libapache2-mod-php5 php5-cli libphp-serialization-perl libgnutls-dev libjpeg8-dev libavcodec-dev libavformat-dev libswscale-dev libavutil-dev libv4l-dev libtool ffmpeg libnetpbm10-dev libavdevice-dev libmime-lite-perl dh-autoreconf dpatch; + sudo -i + aptitude safe-upgrade - root@host:~# git clone https://github.com/ZoneMinder/ZoneMinder.git zoneminder; - root@host:~# cd zoneminder; - root@host:~# ln -s distros/debian; - root@host:~# dpkg-checkbuilddeps; - root@host:~# dpkg-buildpackage; +**Step 3**: Install Apache and MySQL + +These are not dependencies for the package as they could +be installed elsewhere. -One level above you'll now find a deb package matching the architecture of the build host: :: - root@host:~# ls -1 ~/zoneminder*; - /root/zoneminder_1.26.4-1_amd64.changes - /root/zoneminder_1.26.4-1_amd64.deb - /root/zoneminder_1.26.4-1.dsc - /root/zoneminder_1.26.4-1.tar.gz + aptitude install apache2 mysql-server -The dpkg command itself does not resolve dependencies. That's what high-level interfaces like aptitude and apt-get are normally for. Unfortunately, unlike RPM, there's no easy way to install a separate deb package not contained with any repository. +**Step 4**: Edit sources.list to add jessie-backports -To overcome this "limitation" we'll use dpkg only to install the zoneminder package and apt-get to fetch all needed dependencies afterwards. Running dpkg-reconfigure in the end will ensure that the setup scripts e.g. for database provisioning were executed. :: - root@host:~# dpkg -i /root/zoneminder_1.26.4-1_amd64.deb; apt-get install -f; - root@host:~# dpkg-reconfigure zoneminder; + nano /etc/apt/sources.list + +Add the following to the bottom of the file -Alternatively you may also use gdebi to automatically resolve dependencies during installation: :: - root@host:~# aptitude install -y gdebi; - root@host:~# gdebi /root/zoneminder_1.26.4-1_amd64.deb; + # Backports repository + deb http://httpredir.debian.org/debian jessie-backports main contrib non-free +CTRL+o and to save +CTRL+x to exit + +**Step 5**: Install ZoneMinder + +:: + + aptitude update + aptitude install zoneminder + +**Step 6**: Read the Readme + +The rest of the install process is covered in the README.Debian, so feel free to have +a read. + +:: + + gunzip /usr/share/doc/zoneminder/README.Debian.gz + cat /usr/share/doc/zoneminder/README.Debian + +**Step 7**: Setup Database + +Install the zm database and setup the user account. Refer to Hints in Ubuntu install +should you choose to change default database user and password. + +:: + + cat /usr/share/zoneminder/db/zm_create.sql | sudo mysql --defaults-file=/etc/mysql/debian.cnf + echo 'grant lock tables,alter,create,select,insert,update,delete,index on zm.* to 'zmuser'@localhost identified by "zmpass";' | sudo mysql --defaults-file=/etc/mysql/debian.cnf mysql + +** Step 8**: zm.conf Permissions + +Adjust permissions to the zm.conf file to allow web account to access it. + +:: + + chgrp -c www-data /etc/zm/zm.conf + +**Step 9**: Setup ZoneMinder service + +:: + + systemctl enable zoneminder.service + +**Step 10**: Configure Apache + +The following commands will setup the default /zm virtual directory and configure +required apache modules. + +:: + + a2enconf zoneminder + a2enmod cgi + a2enmod rewrite + +**Step 11**: Edit Timezone in PHP + +:: + + nano /etc/php5/apache2/php.ini + +Search for [Date] (Ctrl + w then type Date and press Enter) and change +date.timezone for your time zone. **Don't forget to remove the ; from in 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 then [Enter] to save + +CTRL+x to exit + +**Step 12**: Start ZoneMinder + +Reload Apache to enable your changes and then start ZoneMinder. + +:: + + service apache2 reload + service zoneminder start + +**Step 13**: Making sure ZoneMinder works + +1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console + +2. (Optional API Check)Open up a tab in the same browser and go to ``http://hostname_or_ip/zm/api/host/getVersion.json`` + + If it is working correctly you should get version information similar to the example below: + + :: + + { + "version": "1.29.0", + "apiversion": "1.29.0.1" + } + +**Congratulations** Your installation is complete diff --git a/docs/installationguide/ubuntu.rst b/docs/installationguide/ubuntu.rst index 80cb27552..0111b5509 100644 --- a/docs/installationguide/ubuntu.rst +++ b/docs/installationguide/ubuntu.rst @@ -1,227 +1,227 @@ -Ubuntu Instruction -=================== +Ubuntu +====== .. contents:: -Easy Way: Install ZoneMinder from a package (Ubuntu 15.x+) ------------------------------------------------------------ -These instructions are for a brand new ubuntu 15.04 system which does not have ZM installed. +Easy Way: Ubuntu 16.04 +---------------------- +These instructions are for a brand new ubuntu 16.04 system which does not have ZM +installed. -**Step 1**: Make sure we add the correct packages + +It is recommended that you use an Ubuntu Server install and select the LAMP option +during install to install Apache, MySQL and PHP. If you failed to do this you can +achieve the same result by running: + +:: + + tasksel install lamp-server + +During installation it will ask you to set up a master/root password for the MySQL. + +**Step 1**: Either run commands in this install using sudo or use the below to become root +:: + + sudo -i + +**Step 2**: Update Repos + +.. topic :: Latest Release + + ZoneMinder 1.29.0 is now part of the current standard Ubuntu repository. But + if you wish to install the later releases of ZoneMinder you will need + to add the iconnor/zoneminder PPA. + + :: + + add-apt-repository ppa:iconnor/zoneminder + +Update repo and upgrade. + +:: + + apt-get update + apt-get upgrade + apt-get dist-upgrade + +**Step 3**: Configure MySQL + +.. sidebar :: Note + + The MySQL default configuration file (/etc/mysql/mysql.cnf)is read through + several symbolic links beginning with /etc/mysql/my.cnf as follows: + + | /etc/mysql/my.cnf -> /etc/alternatives/my.cnf + | /etc/alternatives/my.cnf -> /etc/mysql/mysql.cnf + | /etc/mysql/mysql.cnf is a basic file + +Certain new defaults in MySQL 5.7 are currently causing some issues with ZoneMinder, +the workaround is to modify the sql_mode setting of MySQL. + +To better manage the MySQL server it is recommended to copy the sample config file and +replace the default my.cnf symbolic link. + +:: + + rm /etc/mysql/my.cnf (this removes the current symbolic link) + 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 then [Enter] to save + +CTRL+x to exit + +Restart MySQL + +:: + + systemctl restart mysql + + +**Step 4**: Install ZoneMinder :: - sudo add-apt-repository ppa:iconnor/zoneminder - sudo apt-get update + apt-get install zoneminder -if you don't have mysql already installed: +**Step 5**: Configure the ZoneMinder Database :: - sudo apt-get install mysql-server - -This will ask you to set up a master password for the DB (you are asked for the mysql root password when installing mysql server). - -**Step 2**: Install ZoneMinder - -:: - - sudo apt-get install zoneminder - -**Step 3**: Configure the Database - -:: - - sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql + mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" -You don't really need this, but no harm (needed if you are upgrading) + +**Step 6**: Set permissions + +Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content :: - sudo /usr/bin/zmupdate.pl + chmod 740 /etc/zm/zm.conf + chown root:www-data /etc/zm/zm.conf + chown -R www-data:www-data /usr/share/zoneminder/ -**Step 4**: Configure systemd to recognize ZoneMinder and configure Apache correctly: +**Step 7**: Configure Apache correctly: :: - sudo systemctl enable zoneminder - sudo a2enconf zoneminder - sudo a2enmod cgi - sudo chown -R www-data:www-data /usr/share/zoneminder/ + a2enconf zoneminder + a2enmod cgi + a2enmod rewrite - -We need this for API routing to work: +**Step 8**: Enable and start Zoneminder :: - sudo a2enmod rewrite + systemctl enable zoneminder + service zoneminder start -This is probably a bug with iconnor's PPA as of Oct 3, 2015 with package 1.28.107. After installing, ``zm.conf`` does not have the right read permissions, so we need to fix that. This may go away in future PPA releases: + +**Step 9**: Edit Timezone in PHP :: - sudo chown www-data:www-data /etc/zm/zm.conf + nano /etc/php/7.0/apache2/php.ini -We also need to install php5-gd (as of 1.28.107, this is not installed) +Search for [Date] (Ctrl + w then type Date and press Enter) and change +date.timezone for your time zone. **Don't forget to remove the ; from in front +of date.timezone** :: - sudo apt-get install php5-gd + [Date] + ; Defines the default timezone used by the date functions + ; http://php.net/date.timezone + date.timezone = America/New_York -**Step 5**: Edit Timezone in PHP +CTRL+o then [Enter] to save + +CTRL+x to exit + +**Step 10**: Restart Apache service :: - vi /etc/php5/apache2/php.ini + service apache2 reload -Look for [Date] and inside it you will see a date.timezone -that is commented. remove the comment and specific your timezone. -Please make sure the timezone is valid (see this: http://php.net/manual/en/timezones.php) +**Step 11**: Making sure ZoneMinder works -In my case: +1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console -:: +2. (Optional API Check)Open up a tab in the same browser and go to ``http://hostname_or_ip/zm/api/host/getVersion.json`` - date.timezone = America/New_York + If it is working correctly you should get version information similar to the example below: -**Step 6**: Restart services + :: -:: + { + "version": "1.29.0", + "apiversion": "1.29.0.1" + } - sudo service apache2 reload - sudo systemctl restart zoneminder +**Congratulations** Your installation is complete +PPA install may need some tweaking of ZMS_PATH in ZoneMinder options. `Socket_sendto or no live streaming`_ -**Step 7: make sure live streaming works**: Make sure you can view Monitor streams: - -startup ZM console in your browser, go to ``Options->Path`` and make sure ``PATH_ZMS`` is set to ``/zm/cgi-bin/nph-zms`` and restart ZM (you should not need to do this for packages, as this should automatically work) - - -**Step 8**: If you have changed your DB login/password from zmuser/zmpass, the API won't know about it - -If you changed the DB password **after** installing ZM, the APIs will not be able to connect to the DB. - -If you have, go to ``zoneminder/www/api/app/Config`` & Edit ``database.php`` - -There is a class there called ``DATABASE_CONFIG`` - change the ``$default`` array to reflect your new details. Example: - -:: - - public $default = array( - 'datasource' => 'Database/Mysql', - 'persistent' => false, - 'host' => 'localhost', - 'login' => 'mynewDBusername', - 'password' => 'mynewDBpassword' - 'database' => 'zm', - 'prefix' => '', - //'encoding' => 'utf8', - ); - - -You are done. Lets proceed to make sure everything works: - -Making sure ZM and APIs work: - -1. open up a browser and go to ``http://localhost/zm`` - should bring up ZM -2. (OPTIONAL - just for peace of mind) open up a tab and go to ``http://localhost/zm/api`` - should bring up a screen showing CakePHP version with some green color boxes. Green is good. If you see red, or you don't see green, there may be a problem (should not happen). Ignore any warnings in yellow saying "DebugKit" not installed. You don't need it -3. open up a tab in the same browser and go to ``http://localhost/zm/api/host/getVersion.json`` - -If it responds with something like: - -:: - - { - "version": "1.28.107", - "apiversion": "1.28.107.1" - } - - -**Then your APIs are working** - -Make sure ZM and APIs work with security: -1. Enable OPT_AUTH in ZM -2. Log out of ZM in browser -3. Open a NEW tab in the SAME BROWSER (important) and go to ``http://localhost/zm/api/host/getVersion.json`` - should give you "Unauthorized" along with a lot more of text -4. Go to another tab in the SAME BROWSER (important) and log into ZM -5. Repeat step 3 and it should give you the ZM and API version - -**Congrats** your installation is complete - - -Easy Way: Install ZoneMinder from a package (Ubuntu 14.x) +Easy Way: Ubuntu 14.x ----------------------------------------------------------- **These instructions are for a brand new ubuntu 14.x system which does not have ZM installed.** -**Step 1:** Install ZoneMinder +**Step 1**: Either run commands in this install using sudo or use the below to become root +:: + + sudo -i + +**Step 2:** Install ZoneMinder :: - sudo add-apt-repository ppa:iconnor/zoneminder - sudo apt-get update - sudo apt-get install zoneminder + add-apt-repository ppa:iconnor/zoneminder + apt-get update + apt-get install zoneminder (just press OK for the prompts you get) -**Step 2:** Set up DB +**Step 3:** Set up DB :: - sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql + mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" -**Step 3:** Set up Apache +**Step 4:** Set up Apache :: - sudo a2enconf zoneminder - sudo a2enmod rewrite - sudo a2enmod cgi + a2enconf zoneminder + a2enmod rewrite + a2enmod cgi -**Step 4:**:Some tweaks that will be needed: +**Step 5:**:Some tweaks that will be needed: Edit ``/etc/init.d/zoneminder``: add a ``sleep 10`` right after line 25 that reads ``echo -n "Starting $prog:"`` (The reason we need this sleep is to make sure ZM starts after mysqld starts) -As of Oct 3 2015, zm.conf is not readable by ZM. This is likely a bug and will go away in the next package - +Make zm.conf readable by web user. :: sudo chown www-data:www-data /etc/zm/zm.conf - -**Step 5**: If you have changed your DB login/password - -If you changed the DB password **after** installing ZM, the APIs will not be able to connect to the DB. - -If you have, go to ``/usr/share/zoneminder/www/api/app/Config`` & Edit ``database.php`` - -There is a class there called ``DATABASE_CONFIG`` - change the ``$default`` array to reflect your new details. Example: - -:: - - public $default = array( - 'datasource' => 'Database/Mysql', - 'persistent' => false, - 'host' => 'localhost', - 'login' => 'mynewDBusername', - 'password' => 'mynewDBpassword' - 'database' => 'zm', - 'prefix' => '', - //'encoding' => 'utf8',` - ); - -We also need to install php5-gd (as of 1.28.107, this is not installed) - -:: - - sudo apt-get install php5-gd - - **Step 6**: Edit Timezone in PHP ``sudo vi /etc/php5/apache2/php.ini`` @@ -236,54 +236,31 @@ In my case: date.timezone = America/New_York -**Step 7: make sure live streaming works**: Make sure you can view Monitor streams: - -startup ZM console in your browser, go to ``Options->Path`` and make sure ``PATH_ZMS`` is set to ``/zm/cgi-bin/nph-zms`` and restart ZM (you should not need to do this for packages, as this should automatically work) - - - -restart: +**Step 7**: Restart Apache service :: - sudo service apache2 restart - sudo service zoneminder restart + service apache2 reload -**Step 8**: Making sure ZM and APIs work: (optional - only if you need APIs) +**Step 8**: Making sure ZoneMinder works -1. open up a browser and go to ``http://localhost/zm`` - should bring up ZM -2. (OPTIONAL - just for peace of mind) open up a tab and go to ``http://localhost/zm/api`` - should bring up a screen showing CakePHP version with some green color boxes. Green is good. If you see red, or you don't see green, there may be a problem (should not happen). Ignore any warnings in yellow saying "DebugKit" not installed. You don't need it -3. open up a tab in the same browser and go to ``http://localhost/zm/api/host/getVersion.json`` +1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console -If it responds with something like: +2. (Optional API Check)Open up a tab in the same browser and go to ``http://hostname_or_ip/zm/api/host/getVersion.json`` -:: - - { - "version": "1.28.107", - "apiversion": "1.28.107.1" - } - -Then your APIs are working - -Make sure you can view Monitor View: -1. Open up ZM, configure your monitors and verify you can view Monitor feeds. -2. If not, open up ZM console in your browser, go to ``Options->Path`` and make sure ``PATH_ZMS`` is set to ``/zm/cgi-bin/nph-zms`` and restart ZM (you should not need to do this for packages, as this should automatically work) - -Make sure ZM and APIs work with security: -1. Enable OPT_AUTH in ZM -2. Log out of ZM in browser -3. Open a NEW tab in the SAME BROWSER (important) and go to ``http://localhost/zm/api/host/getVersion.json`` - should give you "Unauthorized" along with a lot more of text -4. Go to another tab in the SAME BROWSER (important) and log into ZM -5. Repeat step 3 and it should give you the ZM and API version - -**Congrats** Your installation is complete + If it is working correctly you should get version information similar to the example below: + :: + { + "version": "1.29.0", + "apiversion": "1.29.0.1" + } +**Congratulations** Your installation is complete Harder Way: Build Package From Source -------------------------------------------- +------------------------------------- (These instructions assume installation from source on a ubuntu 15.x+ system) **Step 1:** Grab the package installer script @@ -388,4 +365,53 @@ open up ZM console in your browser, go to Options->Path and make sure ``PATH_ZMS * point your browser to http://yourzmip/zm/api/host/getVersion.json - you should see an API version * Configure your monitors and make sure its all a-ok +Hints +----- +Make sure ZoneMinder and APIs work with security +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1. Enable OPT_AUTH in ZoneMinder +2. Log out of ZoneMinder in browser +3. Open a new tab in the *same browser* (important) and go to ``http://localhost/zm/api/host/getVersion.json`` - should give you "Unauthorized" along with a lot more of text +4. Go to another tab in the SAME BROWSER (important) and log into ZM +5. Repeat step 3 and it should give you the ZM and API version + +Socket_sendto or no live streaming +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +After you have setup your camera make sure you can view Monitor streams, if not +check some of the common causes: + +* Check Apache cgi module is enabled. +* Check Apache /etc/apache2/conf-enabled/zoneminder.conf ScriptAlias matches PATH_ZMS. + + ScriptAlias **/zm/cgi-bin** /usr/lib/zoneminder/cgi-bin + + From console go to ``Options->Path`` and make sure PATH_ZMS is set to **/zm/cgi-bin/**\ nph-zms. + + +Changed Default DB User +^^^^^^^^^^^^^^^^^^^^^^^ + +If you have changed your DB login/password from zmuser/zmpass, you need to +update these values in zm.conf and the API's database.php file. + +1. Edit zm.conf to change ZM_DB_USER and ZM_DB_PASS to the values you used. + +2. Edit databse.php which can be found in the web server folder zoneminder/www/api/app/Config + +There is a class there called DATABASE_CONFIG - +change the $default array to reflect your new details. Example: + +:: + + public $default = array( + 'datasource' => 'Database/Mysql', + 'persistent' => false, + 'host' => 'localhost', + 'login' => 'mynewDBusername', + 'password' => 'mynewDBpassword' + 'database' => 'zm', + 'prefix' => '', + //'encoding' => 'utf8', + ); \ No newline at end of file diff --git a/docs/userguide/options.rst b/docs/userguide/options.rst index 8186d8b6a..873002a0d 100644 --- a/docs/userguide/options.rst +++ b/docs/userguide/options.rst @@ -10,6 +10,7 @@ If you have changed the value of an option you should then ‘save’ it. A numb options/options_display options/options_system options/options_config + options/options_servers options/options_paths options/options_web options/options_images From 219289ee20a17e2b102960cef2ca207ccd1d985a Mon Sep 17 00:00:00 2001 From: Steve Gilvarry Date: Tue, 5 Jul 2016 07:15:01 +1000 Subject: [PATCH 2/4] Consistency changes --- docs/installationguide/debian.rst | 30 +++---- docs/installationguide/ubuntu.rst | 126 ++++++++++-------------------- 2 files changed, 55 insertions(+), 101 deletions(-) diff --git a/docs/installationguide/debian.rst b/docs/installationguide/debian.rst index e253c130e..5c152d7e0 100644 --- a/docs/installationguide/debian.rst +++ b/docs/installationguide/debian.rst @@ -6,7 +6,7 @@ Debian Easy Way: Debian Jessie ----------------------- -**Step 1**: Setup Sudo +**Step 1:** Setup Sudo By default Debian does not come with sudo. Log in as root or use su command. N.B. The instructions below are for setting up sudo for your current account, you can @@ -21,7 +21,7 @@ do this as root if you prefer. Logout or try ``newgrp`` to reload user groups -**Step 2**: Run sudo and update +**Step 2:** Run sudo and update Now run session using sudo and ensure system is updated. :: @@ -29,7 +29,7 @@ Now run session using sudo and ensure system is updated. sudo -i aptitude safe-upgrade -**Step 3**: Install Apache and MySQL +**Step 3:** Install Apache and MySQL These are not dependencies for the package as they could be installed elsewhere. @@ -38,7 +38,7 @@ be installed elsewhere. aptitude install apache2 mysql-server -**Step 4**: Edit sources.list to add jessie-backports +**Step 4:** Edit sources.list to add jessie-backports :: @@ -54,14 +54,14 @@ Add the following to the bottom of the file CTRL+o and to save CTRL+x to exit -**Step 5**: Install ZoneMinder +**Step 5:** Install ZoneMinder :: aptitude update aptitude install zoneminder -**Step 6**: Read the Readme +**Step 6:** Read the Readme The rest of the install process is covered in the README.Debian, so feel free to have a read. @@ -71,7 +71,7 @@ a read. gunzip /usr/share/doc/zoneminder/README.Debian.gz cat /usr/share/doc/zoneminder/README.Debian -**Step 7**: Setup Database +**Step 7:** Setup Database Install the zm database and setup the user account. Refer to Hints in Ubuntu install should you choose to change default database user and password. @@ -81,7 +81,7 @@ should you choose to change default database user and password. cat /usr/share/zoneminder/db/zm_create.sql | sudo mysql --defaults-file=/etc/mysql/debian.cnf echo 'grant lock tables,alter,create,select,insert,update,delete,index on zm.* to 'zmuser'@localhost identified by "zmpass";' | sudo mysql --defaults-file=/etc/mysql/debian.cnf mysql -** Step 8**: zm.conf Permissions +** Step 8:** zm.conf Permissions Adjust permissions to the zm.conf file to allow web account to access it. @@ -89,13 +89,13 @@ Adjust permissions to the zm.conf file to allow web account to access it. chgrp -c www-data /etc/zm/zm.conf -**Step 9**: Setup ZoneMinder service +**Step 9:** Setup ZoneMinder service :: systemctl enable zoneminder.service -**Step 10**: Configure Apache +**Step 10:** Configure Apache The following commands will setup the default /zm virtual directory and configure required apache modules. @@ -106,7 +106,7 @@ required apache modules. a2enmod cgi a2enmod rewrite -**Step 11**: Edit Timezone in PHP +**Step 11:** Edit Timezone in PHP :: @@ -127,16 +127,16 @@ CTRL+o then [Enter] to save CTRL+x to exit -**Step 12**: Start ZoneMinder +**Step 12:** Start ZoneMinder Reload Apache to enable your changes and then start ZoneMinder. :: - service apache2 reload - service zoneminder start + systemctl reload apache2 + systemctl start zoneminder -**Step 13**: Making sure ZoneMinder works +**Step 13:** Making sure ZoneMinder works 1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console diff --git a/docs/installationguide/ubuntu.rst b/docs/installationguide/ubuntu.rst index 0111b5509..813ca95db 100644 --- a/docs/installationguide/ubuntu.rst +++ b/docs/installationguide/ubuntu.rst @@ -19,12 +19,12 @@ achieve the same result by running: During installation it will ask you to set up a master/root password for the MySQL. -**Step 1**: Either run commands in this install using sudo or use the below to become root +**Step 1:** Either run commands in this install using sudo or use the below to become root :: sudo -i -**Step 2**: Update Repos +**Step 2:** Update Repos .. topic :: Latest Release @@ -44,7 +44,7 @@ Update repo and upgrade. apt-get upgrade apt-get dist-upgrade -**Step 3**: Configure MySQL +**Step 3:** Configure MySQL .. sidebar :: Note @@ -89,13 +89,13 @@ Restart MySQL systemctl restart mysql -**Step 4**: Install ZoneMinder +**Step 4:** Install ZoneMinder :: apt-get install zoneminder -**Step 5**: Configure the ZoneMinder Database +**Step 5:** Configure the ZoneMinder Database :: @@ -103,7 +103,7 @@ Restart MySQL mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" -**Step 6**: Set permissions +**Step 6:** Set permissions Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content @@ -113,7 +113,7 @@ Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content chown root:www-data /etc/zm/zm.conf chown -R www-data:www-data /usr/share/zoneminder/ -**Step 7**: Configure Apache correctly: +**Step 7:** Configure Apache correctly: :: @@ -121,23 +121,23 @@ Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content a2enmod cgi a2enmod rewrite -**Step 8**: Enable and start Zoneminder +**Step 8:** Enable and start Zoneminder :: systemctl enable zoneminder - service zoneminder start + systemctl start zoneminder -**Step 9**: Edit Timezone in PHP +**Step 9:** Edit Timezone in PHP :: nano /etc/php/7.0/apache2/php.ini Search for [Date] (Ctrl + w then type Date and press Enter) and change -date.timezone for your time zone. **Don't forget to remove the ; from in front -of date.timezone** +date.timezone for your time zone, see [this](http://php.net/manual/en/timezones.php). +**Don't forget to remove the ; from in front of date.timezone** :: @@ -150,13 +150,13 @@ CTRL+o then [Enter] to save CTRL+x to exit -**Step 10**: Restart Apache service +**Step 10:** Reload Apache service :: - service apache2 reload + systemctl reload apache2 -**Step 11**: Making sure ZoneMinder works +**Step 11:** Making sure ZoneMinder works 1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console @@ -179,7 +179,8 @@ Easy Way: Ubuntu 14.x ----------------------------------------------------------- **These instructions are for a brand new ubuntu 14.x system which does not have ZM installed.** -**Step 1**: Either run commands in this install using sudo or use the below to become root +**Step 1:** Either run commands in this install using sudo or use the below to become root + :: sudo -i @@ -209,40 +210,43 @@ Easy Way: Ubuntu 14.x a2enmod rewrite a2enmod cgi -**Step 5:**:Some tweaks that will be needed: +**Step 5:** Make zm.conf readable by web user. -Edit ``/etc/init.d/zoneminder``: - -add a ``sleep 10`` right after line 25 that reads ``echo -n "Starting $prog:"`` -(The reason we need this sleep is to make sure ZM starts after mysqld starts) - -Make zm.conf readable by web user. :: sudo chown www-data:www-data /etc/zm/zm.conf -**Step 6**: Edit Timezone in PHP - -``sudo vi /etc/php5/apache2/php.ini`` -Look for [Date] and inside it you will see a date.timezone -that is commented. remove the comment and specific your timezone. -Please make sure the timezone is valid (see [this](http://php.net/manual/en/timezones.php)) - -In my case: +**Step 6:** Edit Timezone in PHP :: - date.timezone = America/New_York + nano /etc/php/7.0/apache2/php.ini +Search for [Date] (Ctrl + w then type Date and press Enter) and change +date.timezone for your time zone, see [this](http://php.net/manual/en/timezones.php). +**Don't forget to remove the ; from in front of date.timezone** -**Step 7**: Restart Apache service +:: + + [Date] + ; Defines the default timezone used by the date functions + ; http://php.net/date.timezone + date.timezone = America/New_York + +CTRL+o then [Enter] to save + +CTRL+x to exit + +**Step 7:** Restart Apache service and start ZoneMinder :: service apache2 reload + service zoneminder start -**Step 8**: Making sure ZoneMinder works + +**Step 8:** Making sure ZoneMinder works 1. Open up a browser and go to ``http://hostname_or_ip/zm`` - should bring up ZoneMinder Console @@ -312,58 +316,8 @@ This should now create a bunch of .deb files **Step 5:** Post install configuration -:: - - sudo mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql - mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" - - sudo a2enmod cgi rewrite - sudo a2enconf zoneminder - - - -**Step 6:** Fix PHP TimeZone - -``sudo vi /etc/php5/apache2/php.ini`` - -Look for [Date] and inside it you will see a date.timezone that is commented. remove the comment and specific your timezone. Please make sure the timezone is valid (see http://php.net/manual/en/timezones.php) - -Example: - -``date.timezone = America/New_York`` - -**Step 7:** Fix some key permission issues and make sure API works - -:: - - sudo chown www-data /etc/zm/zm.conf - sudo chown -R www-data /usr/share/zoneminder/www/api/ - - -**Step 8:** Restart all services - -:: - - sudo service apache2 restart - sudo service zoneminder restart - -Check if ZM is running properly - -:: - - sudo service zoneminder status - - -**Step 9:** Make sure streaming works - set PATH_ZMS - -open up ZM console in your browser, go to Options->Path and make sure ``PATH_ZMS`` is set to ``/zm/cgi-bin/nph-zms`` and restart ZM - - -**Step 10:** Make sure everything works - -* point your browser to http://yourzmip/zm - you should see ZM console running -* point your browser to http://yourzmip/zm/api/host/getVersion.json - you should see an API version -* Configure your monitors and make sure its all a-ok +Now that you have installed from your own package you can resume following the +standard install guide for your version, start at the step after Install Zoneminder. Hints ----- From 3a40f39d8333307724ec1a1f7b265ad45e6c996b Mon Sep 17 00:00:00 2001 From: Steve Gilvarry Date: Tue, 5 Jul 2016 07:52:37 +1000 Subject: [PATCH 3/4] Fix 14.04 php.ini location and some more formatting issues --- docs/installationguide/ubuntu.rst | 52 ++++++++++++++++++------------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/docs/installationguide/ubuntu.rst b/docs/installationguide/ubuntu.rst index 813ca95db..6e7ac45e4 100644 --- a/docs/installationguide/ubuntu.rst +++ b/docs/installationguide/ubuntu.rst @@ -14,7 +14,7 @@ during install to install Apache, MySQL and PHP. If you failed to do this you ca achieve the same result by running: :: - + tasksel install lamp-server During installation it will ask you to set up a master/root password for the MySQL. @@ -33,13 +33,13 @@ During installation it will ask you to set up a master/root password for the MyS to add the iconnor/zoneminder PPA. :: - + add-apt-repository ppa:iconnor/zoneminder Update repo and upgrade. :: - + apt-get update apt-get upgrade apt-get dist-upgrade @@ -51,7 +51,7 @@ Update repo and upgrade. The MySQL default configuration file (/etc/mysql/mysql.cnf)is read through several symbolic links beginning with /etc/mysql/my.cnf as follows: - | /etc/mysql/my.cnf -> /etc/alternatives/my.cnf + | /etc/mysql/my.cnf -> /etc/alternatives/my.cnf | /etc/alternatives/my.cnf -> /etc/mysql/mysql.cnf | /etc/mysql/mysql.cnf is a basic file @@ -62,20 +62,20 @@ To better manage the MySQL server it is recommended to copy the sample config fi replace the default my.cnf symbolic link. :: - + rm /etc/mysql/my.cnf (this removes the current symbolic link) 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 then [Enter] to save @@ -85,7 +85,7 @@ CTRL+x to exit Restart MySQL :: - + systemctl restart mysql @@ -103,7 +103,7 @@ Restart MySQL mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" -**Step 6:** Set permissions +**Step 6:** Set permissions Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content @@ -128,14 +128,13 @@ Set /etc/zm/zm.conf to root:www-data 740 and www-data access to content systemctl enable zoneminder systemctl start zoneminder - **Step 9:** Edit Timezone in PHP :: nano /etc/php/7.0/apache2/php.ini -Search for [Date] (Ctrl + w then type Date and press Enter) and change +Search for [Date] (Ctrl + w then type Date and press Enter) and change date.timezone for your time zone, see [this](http://php.net/manual/en/timezones.php). **Don't forget to remove the ; from in front of date.timezone** @@ -176,7 +175,7 @@ CTRL+x to exit PPA install may need some tweaking of ZMS_PATH in ZoneMinder options. `Socket_sendto or no live streaming`_ Easy Way: Ubuntu 14.x ------------------------------------------------------------ +--------------------- **These instructions are for a brand new ubuntu 14.x system which does not have ZM installed.** **Step 1:** Either run commands in this install using sudo or use the below to become root @@ -202,7 +201,7 @@ Easy Way: Ubuntu 14.x mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';" -**Step 4:** Set up Apache +**Step 4:** Set up Apache :: @@ -221,9 +220,9 @@ Easy Way: Ubuntu 14.x :: - nano /etc/php/7.0/apache2/php.ini + nano /etc/php5/apache2/php.ini -Search for [Date] (Ctrl + w then type Date and press Enter) and change +Search for [Date] (Ctrl + w then type Date and press Enter) and change date.timezone for your time zone, see [this](http://php.net/manual/en/timezones.php). **Don't forget to remove the ; from in front of date.timezone** @@ -295,12 +294,21 @@ To build the latest stable release: :: - ./do_debian_package.sh `lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'` `date +%Y%m%d`01 local stable + ./do_debian_package.sh `lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'` `date +%Y%m%d`01 local stable -Note that the ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`` part simply extracts your distribution name - like "vivid", "trusty" etc. You can always replace it by your distro name if you know it. As far as the script goes, it checks if your distro is "trusty" in which case it pulls in pre-systemd release configurations and if its not "trusty" it assumes its based on systemd and pulls in systemd related config files. +Note that the ``lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`` +part simply extracts your distribution name - like "vivid", "trusty" etc. You +can always replace it by your distro name if you know it. As far as the script +goes, it checks if your distro is "trusty" in which case it pulls in pre-systemd +release configurations and if its not "trusty" it assumes its based on systemd +and pulls in systemd related config files. -(At the end the script will ask if you want to retain the checked out version of zoneminder. If you are a developer and are making local changes, make sure you select "y" so that the next time you do the build process mentioned here, it keeps your changes. Selecting any other value than "y" or "Y" will delete the checked out code and only retain the package) +(At the end the script will ask if you want to retain the checked out version of +ZoneMinder. If you are a developer and are making local changes, make sure you +select "y" so that the next time you do the build process mentioned here, it +keeps your changes. Selecting any other value than "y" or "Y" will delete the +checked out code and only retain the package) This should now create a bunch of .deb files @@ -316,7 +324,7 @@ This should now create a bunch of .deb files **Step 5:** Post install configuration -Now that you have installed from your own package you can resume following the +Now that you have installed from your own package you can resume following the standard install guide for your version, start at the step after Install Zoneminder. Hints @@ -326,7 +334,9 @@ Make sure ZoneMinder and APIs work with security 1. Enable OPT_AUTH in ZoneMinder 2. Log out of ZoneMinder in browser -3. Open a new tab in the *same browser* (important) and go to ``http://localhost/zm/api/host/getVersion.json`` - should give you "Unauthorized" along with a lot more of text +3. Open a new tab in the *same browser* (important) and go to + ``http://localhost/zm/api/host/getVersion.json`` - should give you "Unauthorized" + along with a lot more of text 4. Go to another tab in the SAME BROWSER (important) and log into ZM 5. Repeat step 3 and it should give you the ZM and API version @@ -354,7 +364,7 @@ update these values in zm.conf and the API's database.php file. 2. Edit databse.php which can be found in the web server folder zoneminder/www/api/app/Config -There is a class there called DATABASE_CONFIG - +There is a class there called DATABASE_CONFIG - change the $default array to reflect your new details. Example: :: From 5811ba7edae6be81806d0776e5ca2c7ca2a7146b Mon Sep 17 00:00:00 2001 From: Steve Gilvarry Date: Tue, 5 Jul 2016 23:10:03 +1000 Subject: [PATCH 4/4] Swap to apt-get for debian --- docs/installationguide/debian.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/installationguide/debian.rst b/docs/installationguide/debian.rst index 5c152d7e0..0b926435f 100644 --- a/docs/installationguide/debian.rst +++ b/docs/installationguide/debian.rst @@ -13,9 +13,9 @@ N.B. The instructions below are for setting up sudo for your current account, yo do this as root if you prefer. :: - - aptitude update - aptitude install sudo + + apt-get update + apt-get install sudo usermod -a -G sudo exit @@ -27,7 +27,7 @@ Now run session using sudo and ensure system is updated. :: sudo -i - aptitude safe-upgrade + apt-get upgrade **Step 3:** Install Apache and MySQL @@ -36,7 +36,7 @@ be installed elsewhere. :: - aptitude install apache2 mysql-server + apt-get install apache2 mysql-server **Step 4:** Edit sources.list to add jessie-backports @@ -58,8 +58,8 @@ CTRL+x to exit :: - aptitude update - aptitude install zoneminder + apt-get update + apt-get install zoneminder **Step 6:** Read the Readme @@ -112,7 +112,7 @@ required apache modules. nano /etc/php5/apache2/php.ini -Search for [Date] (Ctrl + w then type Date and press Enter) and change +Search for [Date] (Ctrl + w then type Date and press Enter) and change date.timezone for your time zone. **Don't forget to remove the ; from in front of date.timezone**