Welcome. Actually XAMPP is not needed on Ubuntu, you can get all those same packages through the repository instead by adding a single package:
(Note the caret ^ )
sudo apt-get update
sudo apt-get install lamp-server^
Or you can use Synaptic instead of apt-get.
That will install everything in the right places except for Perl which is already there because it is built into Ubuntu. After that, you can safely delete what you put under /opt. Using the package manager has several advantages. One is that security and performance updates can be managed automatically, as will the related notifications. Another is that everything will be in the right place (as opposed to the wrong places for XAMPP) which will make it easier to troubleshoot or have other people help you. XAMPP is a fine crutch for people still on Windows, but it is the next hardest way to do things in the Linux world. In the Linux world we rather let as much as possible be taken care of automatically.