Lightweight Ubuntu Zesty Server

When installing or upgrading to a lightweight zesty (17.04) ubuntu server I use this /etc/apt/sources.list example below which I manage via the edpkg alias from the NetServa SH (shell scripts) Githb repo.

Note: this still applies to the later artful and bionic releases, just ctrl-\ search and replace “zesty” for “artful”, “bionic” or any later version, in the nano editor.

deb http://archive.ubuntu.com/ubuntu zesty main universe
deb http://archive.ubuntu.com/ubuntu zesty-updates main universe
deb http://archive.ubuntu.com/ubuntu zesty-backports main universe
deb http://security.ubuntu.com/ubuntu zesty-security main universe

The first 2 lines are commented reminders of some common extra options I sometimes need. The first one is to manually add a PPA key when python-based tools are not available and the second one is helpful when some server packages insist on installing X based packages (via font, gfx dependencies).

Now we can remove some mostly unneeded packages for a super lean system and then update and fully upgrade the server (some of these are for a typical DigitalOcean 16.04+ install)…

apt remove --purge --auto-remove *python* *golang* cloud* ttf-* man* vi* \
  sasl2-bin xinetd rpcbind rsyslog at lxcfs open-iscsi accountsservice
apt update
apt -y full-upgrade

WARNING: Once the cloud-init package is removed then the eth0/eth1 interfaces listed in /etc/network/interfaces.d/50-cloud-init.cfg may change so do a ifconfig -a and note the available network interfaces then manually edit 50-cloud-init.cfg accordingly.

This is just an optional intermediate step I find convenient. Set debconf to “Readline” and “high”, set dash to “no” so bash is the default shell and set your timezone to whatever you want…

dpkg-reconfigure debconf
dpkg-reconfigure dash
dpkg-reconfigure tzdata

And now here is the SQLite based package list for a super lightweight LESP server (linux nginx sqlite php) as opposed to a typical but heavier LAMP (linx apache mysql php) server.

apt install --no-install-recommends \
  postfix-sqlite postfix-policyd-spf-perl opendkim opendkim-tools \
  dovecot-imapd dovecot-lmtpd dovecot-sqlite dovecot-managesieved spamprobe \
  nginx-light php7.0-fpm php7.0-sqlite3 php7.0-curl php7.0-intl php7.0-imap \
  php7.0-gd php7.0-xml pdns-backend-sqlite3

Blending all this together so it actually works as a coherent Web/Mail/DNS hosting service is another post for another day. After a reboot you will find that this particular set of services will take up about 60Mb of real RSS ram (even less without PowerDNS running) so a $5/month 512Mb DO Droplet or even a $32/year 256Mb VPS can host a dozen or so light to medium sized virtual domains.