Rasbian is based on Debian, which attaches great importance to stable and secure operation. Especially because Raspbian is extremely stable, this Linux distribution is particularly suitable if you want to run Raspberry Pi as a server. Unfortunately, Raspbian already brings so many packages that you do not need.

If you want to run Raspberry Pi as a server, you can not help worrying about uninstalling a large number of packages at first. This applies in particular to the software packages that are supplied with the graphical window interface and are useless in server operation.
Task
- Uninstall all packages related to the graphical window interface.
Solution: Create minimal Raspbian
The following solution provides a way to disconnect from unnecessary packages of the standard Raspbian distribution. For example, if you want to operate Raspberry Pi as a server.
For a minimal Raspbian, there are some more online tutorials on how to purge a Raspbian for unused packages. Many of them are very extensive and thorough. But also associated with more time. This solution is a suggestion that does not do anything but removes most of it so that a Raspbian also fits on a 2GB SD memory card.
Note: It is recommended to clean up unnecessary packages before performing the server configurations. If you want to do it, if you have already set up everything, then you can shoot a painstaking and expensive configuration.
First we check the current memory usage of the SD memory card.
df -h
Then we will arrange for an update of the package sources.
sudo apt-get update
Then we start with the uninstallation of packages.
sudo apt-get remove lxde
sudo apt-get remove gnome
sudo apt-get remove xfce
sudo apt-get remove python3
sudo apt-get remove midori omxplayer scratch tungsten engine sonic-pi dillo netsurf-common netsurf-gtk
Once these packages have been removed, there are still some packages left, which are now superfluous. We also remove these “corpses”.
sudo apt-get autoremove
sudo apt-get clean
Thereafter, still drive around configuration files whose packages are already uninstalled. You can delete them as follows:
sudo dpkg -P `dpkg -l | grep "^ rc" | awk -F "" '{print $ 2}' `
Finally, we recommend a restart of Raspberry Pi.
sudo reboot
After the restart, we check the memory usage of the SD memory card.
df -h
After that you should come in any case under 2 GB.
Switch off swapping
Removing the swap service can save more space.
Alternatively: Download the finished minimal image
If the memory usage is still too large, you have to try to uninstall other packages or look for alternatives that already offer ready-made images for download.
Leave a Reply