Beaglebone black installing more software


I have a beaglebone black with 2gb with internal flash. After installing Debian I have 50mb left. That isn’t enough for installing Gambas3.
I have tryed to remove gcc, and apache2 but it is only 1 or 2 MB that isn’t enough.
So my question:

how do I remove apache with all the attached libraries?
Or how do I install software on the external flash.

Hope jou can help.