First of all, much depends upon how you manage your source codes. I make a directory like
~/sources and put every program in it's subdirectories, while others will create a new directory for every program.
Similarly some like me, create a new sub-sub-directory for every new version, and remove older versions only when it's ensured that there are no significant bugs in new version that would stop my work.
There is no single way to do this, but whichever way you choose, choose a way that would be easiest for you to manage.
I would suggest creating a
rem_dep.sh script which would look like this.
sudo apt-get remove dep1 dep2 ... depn
dep1, dep2, depn are dependencies.
Clean & easy upgrade
if you get source code from a automated versioning system like
bazaar or if the links are predictable you can create a shell script which will
#1 make a backup of earlier version
#2 get new source
#3 configure, build/make the source
#5 if make went correctly, remove earlier version.
#6 make install new version, update dependencies if required.
In other cases too, you can create such scripts with manual work to some extent.
- The best way is to use the
--prefix option while install softwares and there dependencies.
- Other important thing is to keep your system updated so as to minimize conflicts.
NOTE: If you find yourself compiling more software than you should(set a
max_limit for yourself, like 5 or 10 or 100) it's best you leave Ubuntu and move to Arch Linux.