RasPi lighttpd and server tweaks

Free-up some memory

Replacing bash shell with dash will increase performance and save +1MB RAM.

$ sudo dpkg-reconfigure dash

Removing the extra tty / getty’s will save about +3.5 MB RAM. In /etc/inittab, comment the respective lines:

1:2345:respawn:/sbin/getty --noclear 38400 tty1 
#2:23:respawn:/sbin/getty 38400 tty2
#3:23:respawn:/sbin/getty 38400 tty3
#4:23:respawn:/sbin/getty 38400 tty4
#5:23:respawn:/sbin/getty 38400 tty5
#6:23:respawn:/sbin/getty 38400 tty6
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3
#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100

Replace sshd with dropbear

Shut-down sshd. Since you are still connected via ssh, you won’t lose your connection. However, do not log-out until you’ve successfully started dropbear!

$ sudo apt-get install dropbear openssh-client
$ sudo service ssh stop

Enable dropbear at boot time by setting NO_START=0 in /etc/default/dropbear. To prevent root login set DROPBEAR_EXTRA_ARGS=”-w -g”. Then,  enable dropbear service with:

$ sudo update-rc.d dropbear enable

and start it with:

$ sudo service dropbear start

Use another terminal to test whether you are able to log-in.

Replace rsyslogd with inetutils-syslogd and remove useless logs

Reduce memory and cpu usage. We just need a simple vanilla syslogd. Also there is no need to log so many files. Just dump them into /var/log/(cron/mail/messages).

First we remove rsyslogd:
$ sudo apt-get -y remove --purge rsyslog
 Then, install syslogd:
$ sudo apt-get -y install inetutils-syslogd
 Now, create a vanilla syslogd setup:
$ sudo service inetutils-syslogd stop

Remove old log files with:

$ for file in /var/log/*.log /var/log/mail.* /var/log/debug /var/log/syslog; do [ -f "$file" ] && sudo rm -f "$file"; done

$ for dir in fsck news; do [ -d "/var/log/$dir" ] && sudo rm -rf "/var/log/$dir"; done
Backup your original /etc/syslog.conf and replace it with:
*.*;mail.none;cron.none  -/var/log/messages
cron.*   -/var/log/cron
mail.*   -/var/log/mail
Backup the original /etc/logrotate.d/inetutils-syslogd and replace it with:
/var/log/cron
/var/log/mail
/var/log/messages {
        rotate 4
        weekly
        missingok
        notifempty
        compress
        sharedscripts
        postrotate
        /etc/init.d/inetutils-syslogd reload >/dev/null
        endscript
}
Then, enable and start the syslogd with:
$ sudo update-rc.d inetutils-syslogd enable
$ sudo service inetutils-syslogd start
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments