Suppose I installed a Debian package using the Ubuntu Software Center, and then suppose I wish to install the same program by compiling it from source. Then can I simply proceed by installing the same program compiling from source? Will this replace the previous version installed via deb package?
Debian packages generally install the binaries and libraries in /usr/bin/ and /usr/lib directories. Whereas when you compile the softwares from source, you are able to specify the prefix for the directories in which you want to install it. In general, the /usr/local/bin/ and /usr/local/lib directories are default in standard gnu softwares / foss (sort of de-facto standard). You can compile the softwares by specifying the prefix while running configure command. e.g. Say you want to install the software in /usr/local/ prefix, you should run these commands:
You can specify --prefix to be any directory e.g. it can be ~/.local/ or any other directory for that matter.