Last active
August 16, 2016 19:15
-
-
Save bapril/4bd7f74dadde84f62d2fb12a86787303 to your computer and use it in GitHub Desktop.
Build a raspberry pi with read-only SD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some of this is mine, other elements came from: http://petr.io/2015/11/09/read-only-raspberry-pi-with-jessie/ | |
- Install raspbian | |
- Boot-login | |
- apt-get update | |
- apt-get dist-upgrae | |
- apt-get remove --auto-remove --purge 'libx11-.*' | |
- apt-get remove --auto-remove --purge 'libav.*' | |
- apt-get remove --auto-remove --purge 'build-essential' | |
- apt-get remove --auto-remove --purge 'libreoffice-common' | |
- apt-get remove --auto-remove --purge 'java-common' | |
- apt-get upgrade | |
- apt-get autoremove --purge | |
- apt-get install busybox-syslogd; dpkg --purge rsyslog | |
- Add "fastboot noswap ro" to the end of the config line in /boot/cmdline.txt | |
- rm -rf /var/spool/ | |
- ln -s /tmp /var/spool | |
-vim /etc/ssh/sshd_config | |
... | |
UsePrivilegeSeparation no | |
... | |
- cat /etc/fstab #Update fstab | |
proc /proc proc defaults 0 0 | |
/dev/### /boot vfat defaults,ro 0 2 | |
/dev/### / ext4 defaults,noatime,ro 0 1 | |
# a swapfile is not a swap partition, no line here | |
# use dphys-swapfile swap[on|off] for that | |
tmpfs /var/log tmpfs nodev,nosuid 0 0 | |
tmpfs /var/tmp tmpfs nodev,nosuid 0 0 | |
tmpfs /tmp tmpfs nodev,nosuid 0 0 | |
-#Add to /etc/bash.bashrc | |
# set variable identifying the filesystem you work in (used in the prompt below) | |
fs_mode=$(mount | sed -n -e "s/^\/dev\/root on \/ .*(\(r[w|o]\).*/\1/p") | |
alias ro='mount -o remount,ro / ; fs_mode=$(mount | sed -n -e "s/^\/dev\/root on \/ .*(\(r[w|o]\).*/\1/p")' | |
alias rw='mount -o remount,rw / ; fs_mode=$(mount | sed -n -e "s/^\/dev\/root on \/ .*(\(r[w|o]\).*/\1/p")' | |
# setup fancy prompt | |
export PS1='\[\033[01;32m\]\u@\h${fs_mode:+($fs_mode)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment