/var/opt/ vs /var/lib

Solution 1:

If you want to strictly follow the FHS, then /var/opt/<appname> for the data of apps installed in /opt is the right place to go. Stuff installed in /usr/local typically just used /var/lib/<appname>.

Of course, in practice I think there is little difference unless you have some overlap between your opt/local apps and the ones that come packaged with your distro. I tend to just put everything in to /var/lib since that's the first place myself or anyone would look. Most people are not familiar with or not expecting to find things in /var/opt

Solution 2:

The difference between /var/opt and /var/lib (or similarly between /opt and /lib) is usually whether any particular package comes from the standard OS repository or manually downloaded and installed/compiled by the administrator. Again usually what ends up in opt folders is purchased non-free programs and 3rd party software not installed by the OS package manager. Those programs and software usually have their own way of self-management, e.g. satisfying library dependencies, un-installation, etc.