I’ve been using a Raspberry Pi Model B as a file server and backup in my studio for the past 3 years. It’s connected to an old 1TB harddrive and ran btsync (I now switched to Syncthing) and is basically my replacement for Dropbox – except unlike Dropbox I own all the computers my data is on. No NSA backdoors, and cheap!
I found I use my ol’ Raspberry Pi so much stuff that I could take advantage of the upgrades in the Raspberry Pi 2. Unfortunately simply swapping the SD card didn’t work, so I had to install fresh.
Here’s how I got started, before installing Syncthing (I may post about that later). This is how I setup a Raspberry Pi. You don’t have to do this, this is just what I do.
Get Raspbian on an SD Card
I use MakeMyPi for this. It’s fast and includes stuff I like, such as git, ssh keys, and wireless configuration.
Upgrade the install
sudo rpi-update && sudo apt-get -y update && sudo apt-get dist-upgrade -y
sudo shutdown -r now
Install tmux and htop
Very handy stuff. Check it out if you’re not already using it regularly.
sudo apt-get install tmux htop
Install bash-it
Go home
cd ~/
Clone the bash-it files. (You’ll need to have installed Git already of course)
git clone https://github.com/Bash-it/bash-it.git
mv bash-it/ .bash_it/
~/.bash_it/install.sh
These are the bash-it completions, aliases, and plugins I use, or aspire to.
bash-it enable completion git
bash-it enable completion dirs
bash-it enable completion defaults
bash-it enable alias general
bash-it enable plugin history
bash-it enable plugin dirs
bash-it enable plugin extract
bash-it enable plugin base
bash-it enable plugin git
Also, I like fasd, but barely understand it. And it really bogged down the old Pi. I may reinstall it on the Pi2 and give it another shot.
Add my own bash stuff
cd ~/.bash_it/custom/
touch mine.bash
nano mine.bash
Paste in the following, as you like
## GREPS
function hgrep()
{
builtin history | grep "$*"
}
function lgrep()
{
ls -alh | grep "$*"
}
Note: bash-it has some similar ls+grep alias, but this is what I remember
## ALIASES
alias lsss='ls -lht | less'
alias cdslvr='cd /media/silver'
alias cdsync='cd /media/silver/st'
The last two are really specific to me, but may inspire you.
## UPDATE
function update()
{
sudo rpi-update && sudo apt-get -y update && sudo apt-get dist-upgrade -y
}
I don’t know why I wrote the above and below as a function – it probably could be an alias. Maybe I had some future plan I forgot.
# Shutdown
function restart()
{
sudo shutdown -rF now
}
The -F
flag forces fsck
which is used to “check and repair a Linux filesystem”. That’s good for that 1TB drive I have attached.
# History
# all via http://www.eriwen.com/bash/effective-shorthand/
# Don't put duplicate lines in the history
export HISTCONTROL=ignoredups
# Store a lot history entries in a file for grep-age
shopt -s histappend
export HISTFILE=~/long_history
export HISTFILESIZE=50000
# No reason not to save a bunch in history
# Takes up several more MBs of RAM now, oOOOooh
export HISTSIZE=9999
# Ignore dupe commands and other ones you don't care about
export HISTIGNORE="&:[ ]*:exit"
Note: bash-it adds some good history search stuff as well.
Decrease GPU Ram
I don’t use the gui of this RPi, though I may connect it someday. Or I may remove it entirely. In the meantime, I decreased the GPU Ram to give it back to the CPU.
sudo nano /boot/config.txt
Added this to the bottom
# Decreasing GPU Ram, to increase general Ram.
# source: https://raspberrypi.stackexchange.com/questions/673/what-is-the-optimum-split-of-$
# The value can be 16, 64, 128 or 256
# 16MB = almost zero graphical power. Enough GPU memory to render the screen, not much else
gpu_mem=16
Then I go from there. Hopefully this is useful to you.