Skip to content

Instantly share code, notes, and snippets.

@stefanfoulis
Last active June 10, 2021 03:18
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stefanfoulis/5cc50aac62dbe820d78d to your computer and use it in GitHub Desktop.
Save stefanfoulis/5cc50aac62dbe820d78d to your computer and use it in GitHub Desktop.
raspberry pi setup

my raspberry pi setup

  • basic setup
  • auto-login on startup
  • chromium
  • shared user with google sync for bookmarks in chromium
  • auto-start chromium with shared bookmark in fullscreen mode (
  • setup synergy
  • setup ssh tunnel for synergy (with restricted rights) (client: ssh -f -N -L 24800:server-hostname:24800 server-hostname)
  • share ssh with zeroconf
  • setup vnc (see http://richddean.com/post/36677503186/raspberry-pi-setup)
  • share vnc service with zeroconf
  • find easy way to "clone" sd card for distribution
  • find automatic/easy way to set hostname when distributing
  • network boot?

copy raspbian to a sd card and boot it

enable vertical screen mode

add in /boot/config.txt

display_rotate=1

set the hostname

change it in /etc/hostname and /etc/hosts and reboot.

update the system

sudo apt-get update && sudo apt-get upgrade
sudo apt-get dist-update
sudo reboot

install some basic useful tools

sudo apt-get install tmux htop iotop

set some x options in ~/.xinitrc

setxkbmap us  # to set the correct keyboard layout
xset s off         # don't activate screensaver
xset -dpms         # disable DPMS (Energy Star) features.
xset s noblank     # don't blank the video device
# continue with the default xinitrc
. /etc/X11/xinit/xinitrc

autostart x

sudo raspi-config

and select the autostart option from there

no screen sleep on console

edit /etc/kbd/config and set:

BLANK_TIME=0
POWERDOWN_TIME=0

and reboot.

install synergy

derived from https://learn.adafruit.com/synergy-on-raspberry-pi/compiling-synergy-for-raspbian and see http://synergy-project.org/download/?list for latest download url::

cd
mkdir build
cd build
sudo wget -O synergy-1.5.0-r2278-Source.tar.gz http://synergy-project.org/files/packages/synergy-1.5.0-r2278-Source.tar.gz
sudo tar -xzf synergy-1.5.0-r2278-Source.tar.gz

sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y gcc cmake libx11-dev libxtst-dev curl libcurl4-openssl-dev

cd synergy-1.5.0-Source/
vi CMakeList.txt
# replace the line 
# set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/local/include")
# with
# set(CMAKE_INCLUDE_PATH "${CMAKE_INCLUDE_PATH}:/usr/include")

sudo unzip ./ext/cryptopp562.zip -d ./ext/cryptopp562
sudo unzip ./ext/gmock-1.6.0.zip -d ./ext/gmock-1.6.0
sudo unzip ./ext/gtest-1.6.0.zip -d ./ext/gtest-1.6.0

sudo cmake .
sudo make
# make some pizza. eat it. have a coffee
sudo cp -a ./bin/. /usr/bin

auto-start synergyc:

sudo mkdir -p ~/.config/lxsession/LXDE
sudo touch ~/.config/lxsession/LXDE/autostart
sudo vi ~/.config/lxsession/LXDE/autostart

add this in autostart:

~/.startsynergy.sh

and edit ~/.startsynergy.sh to contain:

#!/bin/bash
killall synergyc
sleep 2
synergyc --name $HOSTNAME my-synergy-server.local
exit 0

and make it executable:

sudo chmod 777 ~/.startsynergy.sh

setup zeroconf for ssh and vnc

derived from http://richddean.com/post/36677503186/raspberry-pi-setup

sudo apt-get install -y avahi-daemon
sudo insserv avahi-daemon

add this to /etc/avahi/services/multiple.service:

<?xml version="1.0" standalone='no'?>
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
    <name replace-wildcards="yes">%h</name>
    <service>
        <type>_device-info._tcp</type>
        <port>0</port>
        <txt-record>model=RackMac</txt-record>
    </service>
    <service>
        <type>_ssh._tcp</type>
        <port>22</port>
    </service>
    <service>
        <type>_rfb._tcp</type><port>5901</port>
    </service>
</service-group>

and restart service avahi-daemon restart

setup vnc

sudo apt-get install -y tightvncserver
tightvncserver
# follow instructions

make a backup of the sd card (and restore)

in osx to make the backup:

sudo dd if=/dev/rdiskX bs=1m | gzip > /path/to/backup.gz

to restore it:

gzip -dc /path/to/backup.gz | sudo dd of=/dev/rdiskX bs=1m
@jameswood
Copy link

Thanks for this, it saved me heaps of time. To get Synergy (1.7.5) to build, I had to add libssl-dev to the list of packages to install.

@dylanparker
Copy link

Thanks for the libssl-dev comment... that saved me some synergy head-scratching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment