sudo apt-get install checkinstall
Download the source file, such as
foo.tar.gz and extract it.
tar -xzvf foo.tar.gz
After that, the package will be installed automatically and a deb is also generated. You can uninstall package as usual.
checkinstall usage, please man it.