A good starting point can be
this sticky thread. Regarding the installation you've tried, maybe you encountered an unmet dependency, that is when installing from source the code you're trying to compile need some other code (e.g. libraries and include files) or need some other software already installed on your system to properly run. In general these informations are available on the README or the INSTALL file or - even better - in the web site of the project developing that particular piece of software. You have to go through one step at a time. If something doesn't work on the
step, you should investigate what is missing on your system. When the configuration is successfully completed you should go through the
step, that is the actual compilation and see if there is any complaint about missing header files or libraries or any other kind of error. After a little of experience you will be able to recognize where the problem resides and look for a solution. If you want, you can post the relevant issues about the installation you're coming through and see if someone can help to figure it out.