{"id":148,"date":"2020-06-13T11:05:40","date_gmt":"2020-06-13T18:05:40","guid":{"rendered":"https:\/\/my.apolonio.tech\/?p=148"},"modified":"2020-06-13T11:19:36","modified_gmt":"2020-06-13T18:19:36","slug":"zoneminder-on-minimal-centos-7-install","status":"publish","type":"post","link":"https:\/\/my.apolonio.tech\/?p=148","title":{"rendered":"Zoneminder on Minimal CentOS 7 Install"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">I have said Zoneminder is easy to install, hard to configure, lets go through that<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Say you did a minimal install of CentOS 7 and you wanted to install  Zoneminder on it, here are the minimal steps you need in order to get it working.  Simply log in as root and paste the following script.  I do have a couple of concerns with these steps, see below, but this will get you started.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Just the Script<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>#!\/bin\/bash\nyum -y install mariadb mariadb-server mod_ssl php-mbstring php php-mysql httpd wget\nyum -y install epel-release\nwget https:\/\/download1.rpmfusion.org\/free\/el\/rpmfusion-free-release-7.noarch.rpm\nyum -y install rpmfusion-free-release-7.noarch.rpm\nyum -y install zoneminder\nsetenforce 0\nsed -i --follow-symlinks 's\/^SELINUX=.*\/SELINUX=disabled\/g' \/etc\/sysconfig\/selinux\nsystemctl start mariadb\nmysql &lt; \/usr\/share\/zoneminder\/db\/zm_create.sql\nmysql -e \"GRANT ALL ON zm.* to 'zmuser'@localhost identified by 'zmpass';\"\nmysql -e \"FLUSH PRIVILEGES;\"\npushd \/etc\/httpd\/conf.d\nln -s \/etc\/zm\/www\/zoneminder.httpd.conf\nsed -i --follow-symlinks 's\/;date.timezone =\/date.timezone = America\\\/Los_Angeles\/g' \/etc\/php.ini\npopd\nfirewall-cmd --zone=public --add-port=80\/tcp --permanent\nfirewall-cmd --zone=public --add-port=443\/tcp --permanent\nfirewall-cmd --reload\nyum -y update\nsystemctl enable mariadb\nsystemctl enable httpd\nsystemctl enable zoneminder<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Quick tip &#8211; If you are logged in on the console and need the IP address the command &#8220;ip a&#8221; will tell you what it is so you can remotely access it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Detailed Explanation<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The first line<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>#!\/bin\/bash<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Is needed if you are pasting this into a script to run, it just defines the interpreter to use.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>yum -y install mariadb mariadb-server mod_ssl php-mbstring php php-mysql httpd wget<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command installs some packages you need from CentOS itself<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>yum -y install epel-release<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command enables access to the EPEL third party repository<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>wget https:\/\/download1.rpmfusion.org\/free\/el\/rpmfusion-free-release-7.noarch.rpm<br>yum -y install rpmfusion-free-release-7.noarch.rpm<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These two commands downloads the rpm needed to enable the rpmfusion repository<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>yum -y install zoneminder<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command installs zoneminder packages<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">But we want you to get to a state where you can actually access Zoneminder, so read on<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>setenforce 0<br>sed -i --follow-symlinks 's\/^SELINUX=.*\/SELINUX=disabled\/g' \/etc\/sysconfig\/selinux<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These the first of these two commands is needed to temporarily disables selinux by putting it in to permissive mode which can be problematic for Zoneminder, the second command changes \/etc\/sysconfig\/selinux so that on reboot selinux is truly disabled.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>systemctl start mariadb<br>mysql &lt; \/usr\/share\/zoneminder\/db\/zm_create.sql<br>mysql -e \"GRANT ALL ON zm.* to 'zmuser'@localhost identified by 'zmpass';\"<br>mysql -e \"FLUSH PRIVILEGES;\"<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These series of commands starts the database server, creates the database and adds the default user &#8220;zmuser&#8221; with the default password &#8220;zmpass&#8221; that zoneminder is configured to use (see below regarding my concerns)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>pushd \/etc\/httpd\/conf.d<br>ln -s \/etc\/zm\/www\/zoneminder.httpd.conf<br>sed -i --follow-symlinks 's\/;date.timezone =\/date.timezone = America\\\/Los_Angeles\/g' \/etc\/php.ini<br>popd<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These commands configures apache to access zoneminder, the pushd command is similar to cd (Change Directory) but allows easy return to the current directory you were in when you run the popd command, the \/etc\/zm\/www\/zoneminder.httpd.conf is the config file for zoneminder in apache, you could cp (copy) the file, but an ln (Link) command may be more appropriate if zoneminder packages need to change it.  The sed command is probably not needed anymore, but configures php to the Los Angeles Time Zone, I considered removing that command from this documentation, but leaving it in just in case.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>firewall-cmd --zone=public --add-port=80\/tcp --permanent<br>firewall-cmd --zone=public --add-port=443\/tcp --permanent<br>firewall-cmd --reload<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">CentOS has a host based firewall, these commands open up the http and https ports so your client can communicate with apache.  Alternatively you can disable the firewall on reboot using the command systemctl disable firewalld<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>yum -y update<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This command updates your box, not required but is recommended<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>systemctl enable mariadb<br>systemctl enable httpd<br>systemctl enable zoneminder<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">These three commands make sure the database, webserver, and zoneminder itself are started on reboot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>reboot<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This reboots your ZM box, after which you can connect with a web browser using https:\/\/ipaddress\/zm<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Concerns<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">#1 Minimal Build\/I did not fully test<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">I don&#8217;t usually just do a minimum install when I build a CentOS server, I do have a base linux install that I follow<\/p>\n\n\n\n<figure class=\"wp-block-embed-wordpress wp-block-embed is-type-wp-embed is-provider-my-apolonio-tech\"><div class=\"wp-block-embed__wrapper\">\n<blockquote class=\"wp-embedded-content\" data-secret=\"mN1A48gBdt\"><a href=\"https:\/\/my.apolonio.tech\/?p=78\">Base Linux Install<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Base Linux Install&#8221; &#8212; My Apolonio Tech\" src=\"https:\/\/my.apolonio.tech\/?p=78&#038;embed=true#?secret=GBRiXIgUHq#?secret=mN1A48gBdt\" data-secret=\"mN1A48gBdt\" width=\"500\" height=\"282\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\n<\/div><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">So I did not fully test these install procedures.  But they do seem to work and should work if you already have other things installed.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">#2 Insecure Database<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Notice I used the default zmuser account and password for the database.  You really should create your own are at a minimum change the entries in \/etc\/zm\/zm.conf to whatever you set it at.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Also run the mysql_secure_installation script to secure your database by doing things like set the root password, disallow remote root access, especially of you decide to disable the firewall.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">#3 Certificate Error<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Couple years ago I would not care if my web applications had a cert error like this one<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"925\" height=\"293\" src=\"https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image.png\" alt=\"\" class=\"wp-image-149\" srcset=\"https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image.png 925w, https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-300x95.png 300w, https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-768x243.png 768w\" sizes=\"auto, (max-width: 925px) 100vw, 925px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">But you really should have proper DNS and Certificates on your network.  Here is an easy way to set up a Certificate Authority<\/p>\n\n\n\n<figure class=\"wp-block-embed-youtube wp-block-embed is-type-video is-provider-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<div class=\"video-container\"><iframe loading=\"lazy\" title=\"Create A CertAuthority Final\" width=\"500\" height=\"281\" src=\"https:\/\/www.youtube.com\/embed\/FJdxCoC1c4w?start=657&#038;feature=oembed&#038;wmode=opaque\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/div>\n<\/div><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These steps just gets you started, when you log in for the first time you will have to decide if you want to submit telemetry or not, and after that, the hard part comes up, configuring zoneminder, because there really is nothing there at this point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"256\" src=\"https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-1-1024x256.png\" alt=\"\" class=\"wp-image-150\" srcset=\"https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-1-1024x256.png 1024w, https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-1-300x75.png 300w, https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-1-768x192.png 768w, https:\/\/my.apolonio.tech\/wp-content\/uploads\/2020\/06\/image-1.png 1123w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I have said Zoneminder is easy to install, hard to configure, lets go through that Say you did a minimal install of CentOS 7 and you wanted to install Zoneminder on it, here are&#46;&#46;&#46;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[6,7],"tags":[],"class_list":["post-148","post","type-post","status-publish","format-standard","hentry","category-linux-server","category-zoneminder"],"_links":{"self":[{"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=\/wp\/v2\/posts\/148","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=148"}],"version-history":[{"count":2,"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions"}],"predecessor-version":[{"id":153,"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=\/wp\/v2\/posts\/148\/revisions\/153"}],"wp:attachment":[{"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=148"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=148"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/my.apolonio.tech\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=148"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}