Advertisement
Guest User

zoneminder.install

a guest
Sep 15th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.46 KB | None | 0 0
  1. post_install() {
  2.  
  3.     echo
  4.    
  5.     mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
  6.     systemctl enable --now mariadb
  7.    
  8.     echo
  9.     echo Please wait a while...
  10.     echo
  11.     echo Whenever the prompt \"Enter password:\" appears, if you have already set a password for MariaDB\'s root user enter it, otherwise just press \'enter\'.
  12.     echo
  13.    
  14.     # Create ZoneMinder's database
  15.    
  16.     mysql -uroot -p < /usr/share/zoneminder/db/zm_create.sql
  17.     mysql -uroot -p -e "grant select,insert,update,delete,create,alter,index,lock tables on zm.* to 'zmuser'@localhost identified by 'zmpass';"
  18.  
  19.    
  20.     # Set local timezone in /etc/php/conf.d/zoneminder.ini
  21.    
  22.     sed -i 's|UTC|'`timedatectl | grep "Time zone" | tr -s ' ' | cut -f4 -d ' '`'|g' /etc/php/conf.d/zoneminder.ini
  23.     systemctl enable --now php-fpm
  24.    
  25.    
  26.     # Configure Nginx with the folder structure used in Debian-based distributions
  27.    
  28.     sed -i 's|http {|http {\'$'\n    include       sites-enabled/*.conf;|g' /etc/nginx/nginx.conf
  29.     systemctl enable --now nginx
  30.     systemctl enable --now fcgiwrap.socket
  31.    
  32.    
  33.     # Start and enable ZoneMinder
  34.    
  35.     systemctl enable --now zoneminder
  36.    
  37.     echo All done!
  38.     echo
  39.     echo -------------
  40.     echo
  41.     echo If this is a fresh installation of either Nginx, MariaDB and/or PHP-FPM, you should take the time to set them up properly. At the very least you should consider running \'mysql_secure_installation\' in order to set a secure password for MariaDB\'s root user \(among other useful things\).
  42.     echo
  43.     echo If this is not a fresh installation of one or more of these applications \(e.g. we\'re already on a LEMP server\), take care to ensure that this install script hasn\'t messed up with any of your existing settings.
  44.     echo
  45.     echo -------------
  46.     echo
  47.     echo You can now go to http://localhost:8095 and start using ZoneMinder.
  48.     echo
  49. }
  50.  
  51. post_upgrade() {
  52.     post_install
  53.     # Don't know if '-f /dev/null' is still needed or not...
  54.     /usr/bin/zmupdate.pl -f /dev/null
  55. }
  56.  
  57. post_remove() {
  58.  
  59.     echo
  60.     echo
  61.     echo The ZoneMinder database has been left intact. You can either delete \'/var/lib/mysql\' manually or, if you still need MariaDB installed, remove the ZoneMinder database and user by running the following commands:
  62.     echo
  63.     echo mysql -uroot -p -e \"drop database zm\;\"
  64.     echo mysql -uroot -p -e \"drop user \'zmuser\'@localhost\;\"
  65.     echo
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement