Skip to content

Instantly share code, notes, and snippets.

@byllc
Last active December 5, 2015 00:39
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save byllc/8892599 to your computer and use it in GitHub Desktop.
Save byllc/8892599 to your computer and use it in GitHub Desktop.
Some initial configurations for Headless Raspberry Pi

###IF you are using Raspian many of these tasks are unescessary. With Raspbian:

  • SSH is ready to go out of the box
  • default runlevel is 3
  • many items can be configured with raspi-config tool

###Adding more swap for high memory use concerns

  sudo dd if=/dev/zero of=/swap bs=1M count=1024
  sudo mkswap /swap
  sudo swapon /swap

###Switch Runlevel to 3 so you can run headless without GUI loading

[root@raspi ~] ln -sf /usr/lib/systemd/system/multi-user.target /etc/systemd/system/default.target
[root@raspi ~] ll /etc/systemd/system/default.target

###Switch back to Runlevel 5 to boot to GUI

[root@raspi ~] ln -sf /usr/lib/systemd/system/graphical.target /etc/systemd/system/default.target
[root@raspi ~] ll /etc/systemd/system/default.target

###Options for memory and processor overclocking management

#FILE: /boot/config.txt

#Processor Management
arm_freq=1000
arm_freq_min=700
force_turbo=0 #allows the OS to dynamically adjust processor frequency possible not on all OS
core_freq=500
sdram_freq=500
over_voltage=6
force_turbo=0

#Memory Management
gpu_mem=16 #set to the amount of memory  you would like the gpu to consume

set threshold for dynamic overclocking (60% utilization in example)

60 > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold

###Make sure SSH is running (Pidora and others)

systemctl enable sshd.service
systemctl start sshd.service
systemctl status sshd.service
systemctl enable sshd.service #makes it run on bootup

##Headless Mode (Pidora) In order to run in headless mode right out of the gate you need to create a file called 'headless' on the SD card before you insert into the Pi. If you want get an ip address from dchp use an empty file, otherwise use something like the options below

IPADDR=192.168.1.105
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
RESIZE
SWAP=512

##Write Image to SD Card

diskutil list #to find the volume of the card
diskutil unmountdisk /dev/diskN
sudo dd bs=4M if=/path/to/image of=/dev/diskN

####bs=4M needed to be changed to 4m on some cards , not sure why

##Backing up sd card once you get it setup

Find the disc you want to backup

diskutil list

Copy to an image on the desktop

sudo dd if=/dev/<disk choice> of=~/Desktop/backup.dmg

Run command on raspian startup

 sudo nano /etc/rc.local 

Setup Ethernet as DHCP to allow connection over ethernet cable

[details](http://forums.debian.net/viewtopic.php?f=5&t=1096250

  sudo apt-get install isc-dhcp-server

##Wireless Client Debian Tutorial [Raspberry Pi Website] (http://www.raspberrypi.org/forums/viewtopic.php?f=27&t=7592)

Check for Available Networks

iwlist scan

###Edit /etc/network/interfaces

# my wifi device
auto wlan0
iface wlan0 inet dhcp
        wireless-essid [ESSID]
        wireless-key   [KEY]
        wireless-mode [MODE] 

More details with man interfaces, man wireless and /usr/share/doc/wireless-tools/README.Debian.

##Get Realtek Drivers working with HOSTAPD Drivers

sudo unzip RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911.zip
cd RTL8188C_8192C_USB_linux_v4.0.2_9000.20130911
cd wpa_supplicant_hostapd
sudo tar -xvf wpa_supplicant_hostapd-0.8_rtw_r7475.20130812.tar.gz
cd wpa_supplicant_hostapd-0.8_rtw_r7475.20130812
cd hostapd
sudo make
sudo make install

sudo mv hostapd /usr/sbin/hostapd
sudo chown root.root /usr/sbin/hostapd
sudo chmod 755 /usr/sbin/hostapd

##Wireless WICD

###Useful Links Extend Partition to Fill SD Card

Edimax Wireless access pint

##NGINX, Passenger and Sinatra Helpful Blog Post why is it installed in /opt and how to start it

sudo apt-get install rubygems libcurl4-openssl-dev libssl-dev libmysqlclient-dev libpq-dev libmagickcore-dev libmagickwand-dev libsqlite3-dev bundler
sudo gem install passenger
sudo passenger-install-nginx-module

###REmove Apache

sudo apt-get remove apache2.2-common
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment