Difference between revisions of "Ubuntu Server 16.04 64-bit with Zoneminder 1.29.0 the easy way"

From ZoneMinder Wiki
Jump to navigationJump to search
(Undo revision 7589 by Bbunge (talk))
 
(34 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Ubuntu 16.04 is scheduled for release on April 21, 2016. As of this, March 25, 2016, the final beta has been released and it contains Zoneminder 1.29.0! The following procedures were run on the final Beta 16.04. Things could change in the next couple of weeks!
[[Ubuntu|<Home]]


If you are interested in upgrading your current Ubuntu/Zoneminder to Ubuntu 16.04, see here: https://wiki.zoneminder.com/Common_Issues_with_Zoneminder_Installation_on_Ubuntu#Ubuntu_16.04_-_ZM_1.29.0_Upgrade I would remind you that these are preliminary procedures and may not always work!
'''Ubuntu 16.04 is released and I have verified the Zoneminder install with the default LAMP!'''
__TOC__


I would advise you not upgrade a working "production" Zoneminder server until I've had a chance to do some testing. If you must test yourself PLEASE use a VM or a PC you can afford to wipe and start over with!
===Ubuntu 16.04 with LAMP===


This procedure can be used to install Zoneminder on a basic Ubuntu install, a server install or a desktop install.  
'''08APR 16 - With MySQL update to 5.7 doing the procedure to switch to Mariadb 10.0 fails. I will keep working on this and post updates/fixes. As for now, if you install 16.04 final beta server and want Mariadb, do not upgrade your install before you switch to Mariadb.''' (Mariadb can be installed to replace MySQL. See Option below.)


Thanks,
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.


bb
Ubuntu Server Install: When prompted by Tasksel install OpenSSH Server, and LAMP Server.


---------------------------------------------------------------------------------------
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.
 
'''Optional:''' Install MariaDB Server 10.0. 
Note: as of 09APR16 you will need to start with a Ubuntu 16.04 basic server install without LAMP. You should be able to replace MySQL 5.7 with Mariadb 10.0 once the final release comes out.
 
MariaDB has some enhanced features which do not exist in MySQL and thus migration back to MySQL might not always work.


Click here for instructions to[[Install MariaDB Server 10.0]]
If you get a blank screen after installing Ubuntu 16.04 minimal install or server, press Alt + F1 to open a console.
 
----------------------------------------------------------------------------------------
 
Zoneminder 1.29.0 on Ubuntu 16.04
 
Install Basic Server (if you used the mini.iso), OpenSSH Server, and LAMP Server (This procedure uses the default MySQL 5.7.)


Log in then become root:
Log in then become root:
Line 36: Line 25:
  apt-get upgrade
  apt-get upgrade
  apt-get dist-upgrade
  apt-get 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:
You will need to make a settings change to MySQL as follows:
Note: The MySQL configuration file is located at: /etc/mysql/mysql.conf.d/mysqld.cnf To better manage the MySQL server I recommend you move the config file and replace the default my.cnf symbolic link.
 
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)
  rm /etc/mysql/my.cnf  (this removes the current symbolic link)
Line 44: Line 44:
  cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf
  cp /etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/my.cnf


To change Mariadb settings:
To change MySQL settings:


  nano /etc/mysql/my.cnf
  nano /etc/mysql/my.cnf


Underneath [mysql] add the following
In the [mysqld] section add the following


  sql_mode = NO_ENGINE_SUBSTITUTION
  sql_mode = NO_ENGINE_SUBSTITUTION
Line 58: Line 58:
Restart MySQL
Restart MySQL


  service mysql reload
  systemctl restart mysql
 
Recommended: Secure MySQL.


  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.
  mysql_secure_installation


apt-get install mysqltuner


Once installed, run mysqltuner from a command prompt as root (sudo). Edit the configuration file and make the recommended changes. Stop zoneminder, restart the database server then start zoneminder.  
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-get 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
===Install Zoneminder===


  apt-get install zoneminder php-gd
  apt-get install zoneminder php-gd
Line 102: Line 105:
  chown -R www-data:www-data /usr/share/zoneminder/
  chown -R www-data:www-data /usr/share/zoneminder/


Fix to allow API to work
Edit zoneminder.conf


  nano /etc/apache2/apache2.conf
  nano /etc/apache2/conf-available/zoneminder.conf


Change None to All two places as shown below
Add a - before Indexes and a + before FollowSymLinks


  <Directory /usr/share>
  <Directory /usr/share/zoneminder/www>
        AllowOverride All
  Options -Indexes +FollowSymLinks
        Require all granted
 
</Directory>
Make sure the following is at the bottom of the file


  <Directory /var/www/>
  <Directory /usr/share/zoneminder/www/api>
        Options Indexes FollowSymLinks
    AllowOverride All
        AllowOverride All
        Require all granted
  </Directory>
  </Directory>


Ctrl+o Enter to save
Ctrl+o Enter to save


CTRL+x to exit
CTRL+x to exit  


Enable and start Zoneminder
Enable and start Zoneminder
Line 133: Line 134:
  nano /etc/php/7.0/apache2/php.ini
  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
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]
  [Date]
Line 149: Line 151:


Open Zoneminder in a web browser (http://server-ip/zm).
Open Zoneminder in a web browser (http://server-ip/zm).
---------------------------------------------------------------------------------------
===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.29.0_the_easy_way#Install_Zoneminder
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!

Latest revision as of 17:14, 18 March 2019

<Home

Ubuntu 16.04 is released and I have verified the Zoneminder install with the default LAMP!

Ubuntu 16.04 with LAMP

This procedure can be used to install Zoneminder on a basic Ubuntu install, a server install or a desktop install.

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.

Ubuntu Server Install: When prompted by Tasksel install OpenSSH Server, and LAMP Server.

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.

If you get a blank screen after installing Ubuntu 16.04 minimal install or server, press Alt + F1 to open a console.

Log in then become root:

sudo su

Make sure you are up to date

apt-get update
apt-get upgrade
apt-get 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

systemctl restart mysql

Recommended: Secure MySQL.

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-get 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

apt-get 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

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/

Edit zoneminder.conf

nano /etc/apache2/conf-available/zoneminder.conf

Add a - before Indexes and a + before FollowSymLinks

<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

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

Open Zoneminder in a web browser (http://server-ip/zm).


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.29.0_the_easy_way#Install_Zoneminder


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!