Note: This post is part of a series. Each post builds on the previous ones. If you are just trying to add one thing to an existing system that was not built following this series, then I cannot promise that these instructions will work for you, although they probably will. If you’ve started from something other than a non-NOOBS Raspbian image, then you’ll probably need to adjust for that.
Please refer to the series Introduction for a list of all the different posts in the series.
Self-Promotion: I have recorded this series as a screencast for Pluralsight:
If you have a Pluralsight subscription, please consider watching it. Reading the instructions is one thing, but watching it done demystifies the whole process.
Raspbian comes with a lot of applications pre-installed that make it ideal for its intended educational purpose, but are not needed for a server. This isn’t so much about space. All told, these packages don’t really take up that much room, but they do clog up the update/upgrade pipeline. You can just leave this stuff there, but eventually a large package like Wolfram or LibreOffice will have an update, and you’ll get stuck waiting longer than you’d like for an “apt-get upgrade” to complete. We can remove some of the items which will never be used on the server by using apt-get to remove the unneeded packages.
Note: You can pick and choose from the following items to remove one at a time, or you can cram them all together in one line. Skip ahead to the “everything” section near the end for an example.
Wolfram / Mathematica
sudo apt-get purge wolfram-engine
This one might take a little while, so be patient.
LibreOffice actually consists of several different packages; Base, Calc, Draw, Impress, Math, and Writer. Fortunately, apt-get supports wildcards. Remove all of LibreOffice like this.
sudo apt-get purge libreoffice*
sudo apt-get purge minecraft-pi
If you’re not planning to use them, sonic-pi and scratch can go as well.
sudo apt-get purge sonic-pi scratch
If you want to get rid of all of these packages at once, all you need to do is add them one after another onto the end of the remove command. The following example is all one line, although it’s probably going to wrap on-screen.
sudo apt-get purge wolfram-engine libreoffice* minecraft-pi sonic-pi scratch
Now that we’ve uninstalled unneeded packages, we can tell apt to remove the downloaded packages. I know it seems like the same thing, but it’s not. The downloaded packages are basically the installers. Not only don’t we want these packages, but we don’t want to keep their installers around, taking up space either.
sudo apt-get clean sudo apt-get autoremove
Clean gets rid of the extra top-level packages, the ones you actually ask for when you say “apt get install foo”, and autoremove gets rid of their dependencies which are the supporting packages that you didn’t explicitly ask for, but were needed to support something that you did install.
Fixing the Menu
Now that some of these programs are gone, we’re left with “dead” icons in the menu bar, and within the menu itself. We’ll need to clean them up. Fortunately this is a lot easier than it was in the past. The Pixel desktop release of Raspbian seems to have learned to self-prune dead icons, so all you have to do is
That’s certainly a lot better than the last time I tried this.