This is an interesting question. Let us discuss a few ways this could be attempted.
Method#1 : Manipulating location during apt-get installation
Using apt-get, it would not be possible to do so. If you're installing using
.deb files, again it is not possible. The reason is simply that the location for installation is hard-coded into these packages.
To manipulate the installation location, you will have to compile
sage from source and modify its
makefile before installing it. This will come with a burden of managing the dependencies.
However, there have been discussions regarding this. Perhaps, people have done it. Maybe they have somehow manipulated the installation location. See here and here. If you find some way to do this, please add a comment.
Method#2 : Changing the location of the /usr folder
You could change the location of the
/usr folder itself and transfer it to your external card. Usually this would be discouraged, but since you are saying that you always keep it inserted, so it should be fine.
To do this, there are 2 ways:
(Preferable) Create a partition in your external card and transfer all of the content in the current
/usr folder to that partition. Then, modify your
/etc/fstab to mount that partition as the
/usr folder, and remove the old
/usr folder altogether. To do all of this, you will need to boot from some rescue disc or some live CD/USB.
In this method also, first boot from some rescue disc or live CD/USB and then move the
/usr folder to the external card and then create a symlink to the new
This is an interesting question, something about which I've been thinking lately as my hard-disk was getting full. I will try some of these things and update my answer. Comments are welcome to criticize some of these methods.
Also see @gilles answer. His suggestion is better. Instead of moving all of
/usr folder to the external card, just move the
/usr/lib/sagemath to the external card because it occupies about 3.1GB of your installation. So, in Method#2, you could move this folder instead of