MotionEye is a popular software that is used to turn your raspberry pi into a CCTV.
The easiest way to install it is using a dedicated raspbian image - instructions here
However, there are times where you would like to install motioneye on an existing raspbian image.
I created a script to do just that (needs Buster):
curl -L http://bit.ly/38eG7gz|sudo -E bash -