Where do software get installed on Linux? What is the difference between /opt and /usr?

Solution 1:

/opt/ is used for 3rd party applications that provide a tar ball to extract. Generally the software is provided completely setup with correct permissions and you get an instruction to copy a service over to the system to activate it. Mysql, Apache, Jasperserver all provide alternative installs.

/opt/ is never used by the system itself as to avoid conflicts.

When software is installed in /opt/ you tend to install it with a version number in the directory name so you can install more than 1 version and use a symlink for the active one. That way you can install Mysql v8 on a system that still uses v5, test your application before committing to the next Ubuntu release.

/usr/ is part of a default Linux and is used to store parts of an install through the package manager of that system. To avoid duplicates (something windows was plagued with in older versions) Linux software in directories a large group of creators agreed on. Another benefit is that software can be smaller as you do not need to provide libraries with your software.