Differences between revisions 34 and 35
Revision 34 as of 2015-02-01 23:40:40
Size: 4912
Editor: SamatJain
Comment: Move chrony to optional install; install other vim addon packages
Revision 35 as of 2015-02-21 03:29:49
Size: 4978
Editor: SamatJain
Comment: Delete default 'pi' user
Deletions are marked like this. Additions are marked like this.
Line 158: Line 158:
# Delete default 'pi' user
sudo deluser --remove-all-files pi

Chris Lamb has a good Debian installation checklist, from which I stole most of this list.

   1 # Configure sudo, adding my user to the sudo group so I don't get password prompts
   2 aptitude install sudo
   3 adduser xjjk sudo
   4 echo '%sudo ALL=NOPASSWD: ALL' > /etc/sudoers.d/No-Passwords-for-sudo-Group
   5 chmod 0440 /etc/sudoers.d/No-Passwords-for-sudo-Group
   6 
   7 # Disable installation of recommended packages
   8 echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/90recommends
   9 
  10 # Configure locales to prevent harassment about it later
  11 aptitude install locales
  12 dpkg-reconfigure -plow locales
  13 # …or install all locales so they don't need to be configured/reinstalled
  14 aptitude install locales-all
  15 
  16 # Enable log compression with date suffixed extension
  17 cat /etc/logrotate.conf | sed "s/#compress/compress\ndateext/" > /etc/logrotate.conf.tmp
  18 mv /etc/logrotate.conf.tmp /etc/logrotate.conf
  19 
  20 # Disable root login—public key access only!
  21 cat /etc/ssh/sshd_config | sed "s/PermitRootLogin yes/PermitRootLogin without-password/" > /etc/ssh/sshd_config.tmp
  22 mv /etc/ssh/sshd_config.tmp /etc/ssh/sshd_config
  23 service ssh restart
  24 
  25 # Prevent PAM from allowing easily-crackable passwords
  26 aptitude install libpam-cracklib
  27 
  28 # Install essential utilities
  29 sudo aptitude install \
  30 openssh-server screen \
  31 rsync \
  32 atool lzma rzip xz-utils \
  33 htop dstat iotop \
  34 manpages manpages-dev \
  35 strace tcpdump lsof \
  36 less moreutils \
  37 mosh \
  38 dnsutils \
  39 vim vim-pathogen vim-addon-manager vim-scripts \
  40 bash-completion \
  41 sysfsutils procps \
  42 vnstat \
  43 unattended-upgrades \
  44 ncurses-term \
  45 molly-guard
  46 
  47 # Optional stuff…
  48 # Install essential utilities
  49 chrony \
  50 cpufrequtils powertop
  51 
  52 
  53 # Enable automatic security updates (careful!)
  54 sudo DEBIAN_FRONTEND=noninteractive dpkg-reconfigure -plow unattended-upgrades
  55 
  56 # HDD Temperature/SMART monitoring utilities
  57 aptitude install hddtemp smartmontools
  58 sed -i 's/^#start_smartd=yes/start_smartd=yes/' /etc/default/smartmontools
  59 /etc/init.d/smartmontools start
  60 
  61 # Configure rsyslog for daily archival logging
  62 cat << EOF > /etc/rsyslog.d/51-cron.conf
  63 # Enable cron logging
  64 cron.* /var/log/cron.log
  65 EOF
  66 cat << EOF > /etc/rsyslog.d/99-archive.conf
  67 \$template DailyLogs,"/var/log/archive/%\$YEAR%%\$MONTH%/%\$YEAR%%\$MONTH%%\$DAY%.log"
  68 # Archive logging
  69 *.* -?DailyLogs
  70 EOF
  71 cat << EOF > /etc/cron.daily/rsyslog-archive
  72 #!/bin/sh
  73 # Compress *.log-files not changed in more than 24 hours
  74 find /var/log/archive -type f -mtime +1 -name "*.log" -exec xz '{}' \;
  75 EOF
  76 chmod +x /etc/cron.daily/rsyslog-archive
  77 
  78 # Async logging for rsync (commit every 30m)
  79 cat << EOF > /etc/rsyslog.d/98-async.conf
  80 \$OMFileFlushInterval 1800
  81 \$OMFileASyncWriting on
  82 EOF
  83 
  84 # Use tmpfs for /var/run and /var/lock (may break some buggy packages), like Ubuntu
  85 cat << EOF >> /etc/default/rcS
  86 RAMRUN=yes
  87 RAMLOCK=yes
  88 EOF
  89 
  90 # Allow running X11 apps remotely
  91 sudo aptitude install xbase-clients
  92 
  93 # Add noatime,commit=900 to entries in /etc/fstab
  94 
  95 # Enable SATA ALPM
  96 echo SATA_ALPM_ENABLE=true | sudo tee /etc/pm/config.d/sata_alpm
  97 
  98 # Switch to systemd
  99 sudo aptitude install systemd-sysv libpam-systemd

New account setup

Remote

   1 # Quiet login
   2 touch .hushlogin
   3 cd ~
   4 mkdir -p .ssh/controls
   5 mkdir -p .vim/tmp
   6 chmod -R 755 .ssh
   7 chmod 644 .ssh/authorized_keys

Locally

   1 # Setup dot files
   2 mkdir -p ~/src/git.other/
   3 cd ~/src/git.other/
   4 git clone https://github.com/samatjain/dotfiles.git
   5 cd dotfiles
   6 source init-dots
   7 dots groups set base # Set addtl groups as necessary
   8 dots install

Raspberry Pi stuff

   1 # Switch from wheezy to testing
   2 cd /etc/apt/
   3 sed -i 's/wheezy/testing/g' /etc/apt/sources.list
   4 #sudo find . -type f -exec sed -i 's/wheezy/testing/g' {} \;
   5 
   6 # Disable tty2–tty6
   7 sed -i '/[2-6]:23:respawn:\/sbin\/getty 38400 tty[2-6]/s%^%#%g' /etc/inittab
   8 # Disable tty on serial line
   9 sed -i '/T0:23:respawn:\/sbin\/getty -L ttyAMA0 115200 vt100/s%^%#%g' /etc/inittab
  10 
  11 # Optimize mounts
  12 sed -i 's/defaults,noatime/defaults,noatime,nodiratime/g' /etc/fstab
  13 
  14 # Overclock to 800 Mhz (no overvolting required). Overclocking not forced, but keep it on for the first 2 min during boot
  15 echo -e "arm_freq=800\nsdram_freq=400\ncore_freq=300\nforce_turbo=0\ninitial_turbo=120" >> /boot/config.txt
  16 
  17 # Use only 16 MiB for GPU (only run after updating firmware!)
  18 echo -e "gpu_mem=16" >> /boot/config.txt
  19 
  20 # Enable IPv6 for Avahi
  21 sudo sed -i 's/mdns4_minimal/mdns_minimal/g' /etc/nsswitch.conf
  22 
  23 # Delete default 'pi' user
  24 sudo deluser --remove-all-files pi

Some of these are from Raspberry Pi Raspbian tuning / optimising / optimizing for reduced memory usage

SamatsWiki: DebianChecklist (last edited 2019-10-18 23:01:36 by SamatJain)