To compile programs (note: this might not work with non-GNU Programs), first install the package build-essential.
sudo apt-get update && sudo apt-get install build-essential tar
Now that you have the required packages, download the source of the program.
mkdir -p ~/sources && cd ~/sources && wget <compressed source location>
Now, to uncompress the file, type:
tar xf <file.tar.gz/xz/bz2>
Change your directory to the source directory. Now type:
./configure <your arguments> && sudo make -j$(nproc) && sudo make install
--prefix=<DESTDIR>, if you need to set the installation directory (remember to replace with your own destination directory)
That’s it . Your program should be compiled and installed by now.