RaspberryPi Raspbian Minimal/Server Install


Written by

I’ve been trying to make a smaller install of the RaspberryPi‘s distro Raspbian for use as a headless server/base as a minimal install. The default image contains a full desktop environment, development tools aimed at general users and firmware for most common WiFi chipsets which are entirely unessesary for a headless server for web and dhcp services.

I’ve decided to document what I did to save me time next time I reimage my Pi.

Re-activate Root

pi@rpi:$ [login as pi]
sudo su
passwd
[new root password]
exit

Remove the user Pi

root@rpi:$ [login as root]
deluser pi
rm -R /home/pi
rm -R /home/Desktop

Update the repo and install screen and dropbear

root@rpi:$ apt-get update
apt-get -y install screen dropbear
nano /etc/default/dropbear
[change NO_START=1 to NO_START=0]

Remove uneeded packages

root@rpi:$ apt-get -y purge aspell aspell-en blt cifs-utils cups-bsd cups-client cups-common dbus-x11 dconf-gsettings-backend:armhf dconf-service desktop-base desktop-file-utils dillo ed fbset firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek fontconfig fonts-droid fonts-freefont-ttf g++ g++-4.6 galculator gconf-service gconf2 gconf2-common gdb gdbserver gettext-base ghostscript gksu glib-networking:armhf glib-networking-common glib-networking-services gnome-icon-theme gnome-themes-standard gpicview gsettings-desktop-schemas gsfonts gsfonts-x11 gstreamer0.10-pulseaudio:armhf gtk2-engines:armhf gvfs:armhf gvfs-backends gvfs-common gvfs-daemons gvfs-fuse gvfs-libs:armhf hardlink hicolor-icon-theme icelib idle idle-python2.7 idle-python3.2 idle3 ifplugd kmod krb5-locales leafpad lesstif2:armhf lightdm lightdm-gtk-greeter lua5.1 luajit lxappearance lxde lxde-common lxde-core lxde-icon-theme lxinput lxmenu-data lxpanel lxpolkit lxrandr lxsession lxsession-edit lxshortcut lxtask lxterminal man-db manpages manpages-dev menu menu-xdg midori ncdu netcat-openbsd netsurf-common netsurf-gtk obconf omxplayer openbox parted pcmanfm penguinspuzzle pistore pkg-config plymouth policykit-1 poppler-data poppler-utils pulseaudio pulseaudio-esound-compat pulseaudio-module-x11 pulseaudio-utils qdbus raspberrypi-artwork rpcbind rtkit samba-common scratch shared-mime-info smartsim smbclient squeak-plugins-scratch squeak-vm strace sudo tcl8.5 tk8.5 triggerhappy tsconf ttf-dejavu-core ttf-freefont udisks unzip usbmuxd wireless-tools wpagui wpasupplicant x11-common x11-utils x11-xkb-utils xarchiver xfonts-encodings xfonts-utils xinit xpdf xdg-utils xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-evdev xserver-xorg-input-synaptics xserver-xorg-video-fbdev zenity zenity-common
apt-get -y purge libfontconfig1 libqt4-network libqt4-xml libqtcore4 libqtdbus4 ttf-bitstream-vera libwrap0 ncurses-term tcpd openssh-server openssh-blacklist openssh-blacklist-extra openssh-client
apt-get -y autoremove

Refix networking

root@rpi:$ nano /etc/network/interfaces
[remove all references to wlan0 and add eth0 as an auto up device]

Minimise Logs

root@rpi:$ nano /etc/logrotate.conf
# Keep 1 week of logs
rotate 1
compress

Reboot

root@rpi:$ reboot

These are all the edits I’ve made and now my Raspbian images is down from 2GB to 675MB

Original Article Date: 18th Feb 2013
Last Edited: 22nd Feb 2013