So, for sure you want to remove the biggest software package installed on the server to recover back the space.
The question is, how do you list all packages installed and sort it by size?
I found the answer from this website: http://www.pixelbeat.org/docs/packaging.html
The command that you should use is:
For RPM:
rpm -q -a --qf '%10{SIZE}\t%{NAME}\n' | sort -k1,1n
For DEB:
dpkg-query -W --showformat='${Installed-Size;10}\t${Package}\n' | sort -k1,1n
That's all. Remove the package by using Yum or Aptitude so that they can automatically find the correct dependencies for the removed package.