It is much more difficult to install LAMP stack & OpenEMR separately than it is to install the Package.
It is not necessary to have the stack installed to use the Package cited above, because Apache, MySQL & PHP are parts of the Ubuntu Debian Package.
If you reinstall the stack, you must delete it.
If you encounter an error installing only the Package, the most likely reason is that there has been an incomplete deletion of OE from the first attempt. See this.
Occasionally the user is forced to reinstall the OS (nuclear option) to get rid of every last bit of OE.
Probably easier to bypass the package method and just do a straight install of OpenEMR, after installing all the necessary prerequisites via the OS package management tools provided. Also avoids future danger of OS package upgrades stomping all over OpenEMR.