# Installing ZoneMinder on Linux

1. Log into the Debian device
2. Run the following commands in a terminal:
   # update repositories
   sudo apt update
   # install any available software updates
   sudo apt upgrade
   # install prerequisites
   sudo apt install apt-transport-https gnupg libvlccore-dev libvlc-dev -y
   # add zoneminder gpg key
   wget -O - https://zmrepo.zoneminder.com/debian/archive-keyring.gpg | sudo apt-key add -
   # install Apache HTTPD and MySQL
   sudo apt install apache2 mariadb-server mariadb-client -y
   # install PHP components
   sudo apt install php7.3 libapache2-mod-php7.3 php7.3-mysql -y
   # add ZoneMinder apt repository
   sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://zmrepo.zoneminder.com/debian/release-1.36 $(lsb_release -cs)/"
   # configure the MySQL database
   sudo su
   mysql_secure_installation
3. Press Enter to login as root
4. Type Y and press Enter to set a root password, type the password twice to confirm
5. Type Y and press Enter to remove anonymous users
6. Type Y and press Enter to disallow root login remotely
7. Type Y and press Enter to remove the test database
8. Type Y and press Enter to reload privilege tables
9. Continue with the following commands in terminal:
   # update software repositories
   sudo apt update
   # install zoneminder
   sudo apt install zoneminder -y
   # create video user
   sudo adduser www-data video
   # enable and auto-start ZoneMinder service
   sudo systemctl enable zoneminder.service && sudo systemctl start zoneminder
   # enable ZoneMinder apache conf
   sudo a2enconf zoneminder
   sudo a2enmod rewrite
   # restart apache service
   sudo systemctl restart apache2
10. Open a web browser and navigate to http://DNSorIP/zm
11. Select whether to share usage data with the developers > Click Apply
12. Click Options in the top navigation bar
13. Select Users from the left navigation menu
14. Click on the admin* username link
15. Type a secure password in the New Password and Confirm Password fields and click Save
16. To add a camera click Console in the top navigation bar and then click the Add button and fill out the form