|
|
(63 intermediate revisions by 5 users not shown) |
Line 1: |
Line 1: |
| '''Zoneminder 1.30.0 on Ubuntu 16.04 Server '''
| | [[Ubuntu|<Home]] |
|
| |
|
| __TOC__
| | ===Temporary install for Zoneminder 1.30.4 on Ubuntu 16.04 64 bit only=== |
|
| |
|
| ===Ubuntu 16.04 with LAMP===
| | The following is a shell script to install Zoneminder 1.30.4 on Ubuntu 16.04 64 bit. |
|
| |
|
| This procedure can be used to install Zoneminder on a basic Ubuntu install, a server install or a desktop install.
| | ==Note: if you had Zoneminder installed you can omit the following two commands from the script== |
|
| |
|
| Ubuntu basic install can be done from the net install CD (https://www.ubuntu.com/download/alternative-downloads) This is creates a CD from the file mini.iso. When prompted (tasksel) install standard system utilities, OpenSSH Server, and LAMP Server. This is the minimum that is required to set up and run Zoneminder and does not load other apps that are not needed.
| | This entry appends the timezone to the php.ini |
|
| |
|
| Ubuntu Server Install: When prompted by Tasksel install OpenSSH Server, and LAMP Server.
| | awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.0/apache2/php.ini |
|
| |
|
| Ubuntu Desktop: You will have to install tasksel in a terminal (sudo apt-get install tasksel) then run tasksel to install OpenSSH Server, and LAMP Server.
| | These add entries to the my.cnf |
|
| |
|
| If you get a blank screen after installing Ubuntu 16.04 minimal install or server, press Alt + F1 to open a console.
| | 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 |
|
| |
|
| Log in then become root:
| | Create a file: |
|
| |
|
| sudo su | | nano install-zm |
|
| |
|
| Make sure you are up to date
| | Copy and paste the following contents into the file |
| | |
| apt update
| |
| apt upgrade
| |
| apt dist-upgrade
| |
| | |
| At this point you should have Ubuntu 16.04 installed with LAMP which includes the default MySQL 5.7. You have the option to use Mariadb Server 10.0 which will replace MySQL 5.7 (Click on Options link in Contents above) or continue with MySQL 5.7..
| |
| | |
| You may want to set the system swap file usage. See: https://wiki.zoneminder.com/Common_Issues_with_Zoneminder_Installation_on_Ubuntu#Ubuntu_Swap_File
| |
| | |
| You will need to make a settings change to MySQL as follows:
| |
| | |
| 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
| |
| | |
| To better manage the MySQL server I recommend you 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 Enter to save
| |
| | |
| CTRL+x to exit
| |
| | |
| Restart MySQL
| |
|
| |
|
| | #!/bin/sh |
| | clear |
| | read -p "This script installs Zoneminder 1.30.4 on Ubuntu 16.04 AMD64 with LAMP (MySQL) installed. This uses install packages that were downloaded from the Zoneminder PPA... |
| | 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 packages, configure MySQL and PHP and install the downloaded packages. |
| | Press enter to continue" nothing |
| | wget -O /tmp/php-apcu-bc_1.0.3-2xenial2_amd64.deb --no-check-certificate "https://onedrive.live.com/download?cid=DECAED2A9DCA1993&resid=DECAED2A9DCA1993%2127787&authkey=AML1-kdHyW9j_w8" |
| | wget -O /tmp/zoneminder-doc-1.30.4-xenial1_all.deb --no-check-certificate "https://onedrive.live.com/download?cid=DECAED2A9DCA1993&resid=DECAED2A9DCA1993%2127784&authkey=AIIVT2bHDwSLpnw" |
| | wget -O /tmp/zoneminder_1.30.4-xenial1_amd64.deb --no-check-certificate "https://onedrive.live.com/download?cid=DECAED2A9DCA1993&resid=DECAED2A9DCA1993%2127786&authkey=AMbVEzwGUotopLg" |
| | clear |
| | awk '$0="date.timezone = "$0' /etc/timezone >> /etc/php/7.0/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 | | systemctl restart mysql |
| | | apt-get -y install /tmp/php-apcu-bc_1.0.3-2xenial2_amd64.deb |
| Recommended: Secure MySQL.
| | apt-get -y install /tmp/zoneminder-doc_1.30.4-xenial1_all.deb |
| | | apt-get -y install /tmp/zoneminder_1.30.4-xenial1_amd64.deb |
| WARNING: Do _NOT_ setup the VALIDATE PASSWORD plugin during the following step or it will cause the creation of the 'admin' account in the 'zm' MySQL database to fail. If needed, please enable this plugin _after_ you manually change the 'admin' password in a running instance of Zoneminder from the web interface. Be sure that the new 'admin' password will satisfy the plugin strength level that you chose at the time you enabled it!
| | systemctl enable zoneminder |
| | | service zoneminder start |
| mysql_secure_installation
| |
| | |
| | |
| Optional: A tool that you may want to install is mysqltuner. This is handy to see what database parameters need to be adjusted as your ZM system builds up events.
| |
| | |
| apt install mysqltuner | |
| | |
| Once installed, run mysqltuner from a command prompt as root (sudo). Review recommended changes. Edit the configuration file (my.cnf) and make the recommended changes. Stop zoneminder, restart the database server then start zoneminder.
| |
| | |
| ===Install Zoneminder 1.30.0===
| |
| | |
| 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 | |
| | |
| Update Sources
| |
| | |
| apt update
| |
| | |
| Install Zoneminder and PHP-GD
| |
| | |
| apt install zoneminder php-gd
| |
| | |
| Create Zoneminder database in MySQL (Note: this also creates the default Zoneminder user and permissions in MySQL)
| |
| | |
| mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
| |
| | |
| mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
| |
| | |
| mysqladmin -uroot -p reload | |
| | |
| Set permissions of /etc/zm/zm.conf to root:www-data 740
| |
| | |
| chmod 740 /etc/zm/zm.conf | |
| | |
| chown root:www-data /etc/zm/zm.conf | |
| | |
| Create a new user
| |
| | |
| adduser www-data video | | adduser www-data video |
|
| |
| Enable CGI, Zoneminder and rewrite configuration in Apache.
| |
|
| |
| a2enmod cgi | | a2enmod cgi |
|
| |
| a2enconf zoneminder | | a2enconf zoneminder |
|
| |
| a2enmod rewrite | | a2enmod rewrite |
|
| |
| Fix Permissions
| |
|
| |
| chown -R www-data:www-data /usr/share/zoneminder/ | | chown -R www-data:www-data /usr/share/zoneminder/ |
|
| |
| Edit zoneminder.conf
| |
| Note: The following changes may be in the file.
| |
|
| |
| nano /etc/apache2/conf-available/zoneminder.conf
| |
|
| |
| Add a - before Indexes and a + before FollowSymLinks as shown
| |
|
| |
| <Directory /usr/share/zoneminder/www>
| |
| Options -Indexes +FollowSymLinks
| |
|
| |
| Make sure the following is at the bottom of the file
| |
|
| |
| <Directory /usr/share/zoneminder/www/api>
| |
| AllowOverride All
| |
| </Directory>
| |
|
| |
| Ctrl+o Enter to save
| |
|
| |
| CTRL+x to exit
| |
|
| |
| Restart Apache
| |
|
| |
| service apache2 reload
| |
|
| |
| http://ip-addr/zm/events should now give you a Forbidden 403 error
| |
|
| |
|
| |
|
| |
| Enable and start Zoneminder
| |
|
| |
| systemctl enable zoneminder
| |
|
| |
| service zoneminder start
| |
|
| |
| Add timezone to PHP
| |
|
| |
| nano /etc/php/7.0/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 | | 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 |
|
| |
|
| | Save the file |
| | ctrl + o |
| | ctrl + x |
|
| |
|
| '''IMPORTANT FINAL STEP:''' open Zoneminder in a web browser (http://server-ip/zm). Click on Options - Paths and change '''PATH_ZMS''' to
| | Chmod permissions |
| | | |
| /zm/cgi-bin/nph-zms | | chmod 755 install-zm |
| | |
| Click the '''SAVE''' button
| |
| | |
| | |
| | |
| | |
| ---------------------------------------------------------------------------------------
| |
| | |
| ---------------------------------------------------------------------------------------
| |
| | |
| ===Optional Upgrade to MariaDB Server 10.0. before installing Zoneminder===
| |
| | |
| MariaDB has some enhanced features which do not exist in MySQL and thus migration back to MySQL might not always work.
| |
| | |
| '''Note: This procedure is to upgrade to Mariadb before installing Zoneminder!'''
| |
| | |
| Upgrade the LAMP installed MySQL 5.7 to Mariadb with the command:
| |
| | |
| apt-get install mariadb-server | |
| | |
| Secure Mariadb, create root password et. al.
| |
| | |
| mysql_secure_installation
| |
| | |
| Note: The MySQL/MariaDB configuration file is located at: /etc/mysql/mysql.conf.d/mysqld.cnf To better manage the MariaDB server I recommend you move the config file and replace the default my.cnf symbolic link (this also works for MySQL 5.6).
| |
| | |
| rm /etc/mysql/my.cnf (this removes the current symbolic link)
| |
| | |
| cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/my.cnf
| |
| | |
| To change Mariadb settings:
| |
| | |
| nano /etc/mysql/my.cnf
| |
| | |
| Ctrl+o Enter to save
| |
| | |
| CTRL+x to exit
| |
| | |
| A tool that you may want to install is mysqltuner. This is handy to see what database paramaters need to be adjusted as your ZM system builds up events.
| |
| | |
| apt-get install mysqltuner
| |
| | |
| Continue installing Zoneminder: https://wiki.zoneminder.com/Ubuntu_Server_16.04_64-bit_with_Zoneminder_1.30.0_the_easy_way#Install_Zoneminder_1.30.0
| |
| | |
| | |
| Here is a link to manually install LAMP with Mariadb server [[Install MariaDB Server 10.0]]
| |
| | |
| ----------------------------------------------------------------------------------------
| |
| | |
| ===Optional Upgrade to MariaDB Server 10.0. with Zoneminder (or other databases) installed===
| |
| | |
| Note: This procedure is concerned with backing up and recreating the Zoneminder database. You can use the same commands, with other database names, if your system has other databases running in MySQL.
| |
| | |
| Stop Zoneminder
| |
| | |
| service zoneminder stop
| |
| | |
| Backup Zoneminder database (or other databases)
| |
| | |
| mysqldump -uroot -p zm > zm.sql
| |
| | |
| Upgrade the LAMP installed MySQL 5.7 to Mariadb with the command:
| |
| | |
| apt-get install mariadb-server
| |
| | |
| Secure Mariadb, create root password et. al.
| |
| | |
| mysql_secure_installation
| |
| | |
| Note: The MySQL/MariaDB configuration file is located at: /etc/mysql/mysql.conf.d/mysqld.cnf To better manage the MariaDB server I recommend you move the config file and replace the default my.cnf symbolic link.
| |
| | |
| Remove the current symbolic link
| |
| | |
| rm /etc/mysql/my.cnf
| |
| | |
| Create new my.cnf
| |
| | |
| cp /etc/mysql/mariadb.conf.d/50-server.cnf /etc/mysql/my.cnf
| |
| | |
| To change Mariadb settings:
| |
| | |
| nano /etc/mysql/my.cnf
| |
| | |
| Ctrl+o Enter to save
| |
| | |
| CTRL+x to exit
| |
| | |
| Create new empty zm database
| |
| | |
| mysql -uroot -p
| |
| | |
| You are now in the Mariadb console
| |
| | |
| CREATE DATABASE zm;
| |
| | |
| Quit Mariadb console
| |
| | |
| \q
| |
| | |
| Restore zm database from backup
| |
| | |
| mysql -uroot -p zm < zm.sql
| |
| | |
| Set permissions
| |
| | |
| mysql -uroot -p -e "grant all on zm.* to 'zmuser'@localhost identified by 'zmpass';"
| |
| | |
| Start Zoneminder
| |
| | |
| service zoneminder start
| |
| | |
| You should now be running Mariadb server!
| |
| | |
| ===Install Zoneminder 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 to download the file from:
| |
| | |
| https://drive.google.com/open?id=0BwH00-h4hi0LbEtzY0g2ZVFmc2M
| |
| | |
| or view the file contents here:
| |
| | |
| [[Shell script zm_install]]
| |
| | |
| I have tested this on budgie-remix 16.04-1 desktop x64 and Ubuntu 16.04-1 server x64. This shell script should work on and Ubuntu 16.04 desktop (Mint, Lubuntu et. al.).
| |
| You do not have to have LAMP, Apache or MySQL installed to run this. The script will install everything Zoneminder needs to function and set up Zoneminder!
| |
| | |
| '''WARNING! This script installs Mariadb Server and Client and will replace MySQL if it is installed!!!'''
| |
| | |
| Copy the file, zm_install, to your home directory.
| |
| | |
| Open a terminal and run:
| |
| | |
| chmod 755 zm_install
| |
| | |
| Start the script by entering:
| |
| | |
| ./zm_install
| |
| | |
| Follow the prompts. Things are pretty simple till you get to adding the timezone to PHP then you will need to know how to operate Nano. As a help you can see how it is done in the procedure above.
| |
| | |
| I did not include the fix for the API in this script but it is an edit to apache2.conf which is shown on above procedure.
| |
| | |
| '''WARNING! This script installs Mariadb Server and Client and will replace MySQL if it is installed!!!'''
| |
|
| |
|
| Good Luck!
| | run the file |
|
| |
|
| While this script worked for me I can't be responsible if you loose data when you run this. It is intended for a new install not an upgrade.
| | ./install-zm |