V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
gevin
V2EX  ›  程序员

GitHub 上的树莓派资源

  •  
  •   gevin ·
    flyhigher139 · 2014-04-21 12:59:31 +08:00 · 6576 次点击
    这是一个创建于 3982 天前的主题,其中的信息可能已经有所发展或是发生改变。
    内容还是来源于我之前的贴子中提到的我的那个repository

    https://github.com/flyhigher139/repo_starred

    这个是关于树莓派的资源的整理:

    GitHub Starred Projects | RaspberryPi
    =====================================

    this gist is a part of [repo_starred](https://github.com/flyhigher139/repo_starred)

    ##python

    [Adafruit-Raspberry-Pi-Python-Code](https://github.com/adafruit/Adafruit-Raspberry-Pi-Python-Code)
    - Adafruit library code for Raspberry Pi

    ##js
    [coder](https://github.com/googlecreativelab/coder)
    - A simple way to make web stuff on Raspberry Pi
    http://goo.gl/coder

    ##markdown

    [kongwu_pi_tips.md](

    折腾Pi,解决疑难杂症最好还是去官网论坛

    image http://www.raspberrypi.org/phpBB3/

    支持Apple TimeMachine,实现Mac备份

    在磁盘中创建备份目录 mkdir /media/usbdisk/mactimebak 推荐使用ext4分区(打开notime)

    安装nettalk

    修改配置文件: sudo vim /etc/netatalk/AppleVolumes.default

    配置如下

    # The line below sets some DEFAULT, starting with Netatalk 2.1.
    :DEFAULT: options:upriv,usedots
    # By default all users have access to their home directories.
    ~/                      "Home Directory"
    /media/usbdisk/mactimebak  "Time Machine" allow:pi cnidscheme:dbd options:usedots,upriv,tm
    

    如何在家庭宽带上实现动态域名,让pi成为一个真实的网站

    写在另外一个页面里了 [https://gist.github.com/kennyz/0afc809baabd8223fddf]

    给pi配置VPN

    有时候需要远程连接到pi上去用samba编辑本地代码,这该死的samba又死活只支持局域网,逼得我连vpn进来。 当然在pi上搞个VPN服务,还是有很多好处的,你懂的。

    步骤如下:

    1)安装pptpd

    运行 sudo modprobe ppp-compress-18 看内核是否支持,如果没有出错,可以继续。

    安装pptpd服务: sudo apt-get install pptpd

    然后开始配置

    sudo vim /etc/pptpd.conf

    localip 192.168.1.10
    remoteip 192.168.1.234-238,192.168.1.245
    

    sudo vim /etc/ppp/chap-secrets

    增加如下行:

    vpnuser pptpd vpnpwd *
    

    这里的vpnuser和vpnpwd改为你自己要设置的用户名密码。

    sudo vim /etc/ppp/pptpd-options 配置改为:

    ms-dns 8.8.8.8
    ms-dns 8.8.4.4
    noipx
    nodefaultroute
    mtu 1396
    mru 1396
    

    这个地方折腾了我很长时间,配置了各种DNS服务,都会出现有些网站无法访问的情况。最后用Google的DNS,一切就好了。 希望这个提示可以帮助大家少走些弯路。

    配置改好了,运行 sudo /etc/init.d/pptpd restart 启动服务

    2)配置网络

    /etc/sysctl.conf 修改 net.ipv4.ip_forward=1

    然后运行 sudo sysctl -p 使配置生效。

    在路由器上设置 1723 端口转发到pi上,如果pi有防火墙就打开这个端口。

    3)好了

    在客户端配置vpn(选择PPTP)就可以联通VPN了。

    实现微信控制Pi上的音乐播放

    稍微有点复杂,慢慢写...

    安装看门狗防止pi死机

    参考文章 Link

    在Pi上增加负载和CPU温度的监控

    将Pi的负载和温度显示在你自己的网站上,愿意自己绘图的可以自己动手,像我一样懒的可以通过COSM的API实时接收数据并且画出精美的监控图片。 比如这样的: image

    send_data.sh 的代码如下:

    cd /home/pi/bin/cosm/
    sed 's/\([0-9]*\.[0-9][0-9]\) \([0-9]*\.[0-9][0-9]\) \([0-9]*\.[0-9][0-9]\)\(.*\)/{"datastreams":[ {"id":"5min","current_value":"\1"},{"id":"10min","current_value":"\2"},{"id":"15min","current_value":"\3"} ]}/' /proc/loadavg > cosm-load.json
    curl --request PUT --data-binary @cosm-load.json --header "X-ApiKey: -APIKEY" http://api.cosm.com/v2/feeds/95397?timezone=+8
    
    VAL=`cat /sys/class/thermal/thermal_zone0/temp`
    STR=`awk 'BEGIN{printf "{\"datastreams\":[ {\"id\":\"temp\",\"current_value\":\"%.1f\"} ] } ",'$VAL'/1000}'`
    echo $STR > cosm_temp.json
    curl --request PUT --data-binary @cosm_temp.json --header "X-ApiKey: -APIKEY" http://api.cosm.com/v2/feeds/95397?timezone=+8
    

    更换了一个更加快速的源:

    pi的源列表: http://www.raspbian.org/RaspbianMirrors

    测试了之后发现这个源在国内更新最快

    http://mirror.devunt.kr/raspbian/raspbian/

    更换源:

    sudo vi /etc/apt/sources.list

    更换为以下代码: deb http://mirror.devunt.kr/raspbian/raspbian/ wheezy main contrib non-free rpi

    解决磁盘速度问题

    外接磁盘绝对不能使用NTFS格式分区!速度非常慢

    安装测试磁盘速度的软件: sudo apt-get install hdparm

    测试本地card的读写速度:

    hdparm -Tt /dev/mmcblk0

    pi@raspberrypi ~/downloads $ sudo hdparm -Tt /dev/mmcblk0

    /dev/mmcblk0:
     Timing cached reads: 210 MB in 2.02 seconds = 104.21 MB/sec
     Timing buffered disk reads: 54 MB in 3.09 seconds = 17.45 MB/sec
    pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=~/test.img
    50+0 records in
    50+0 records out
    52428800 bytes (52 MB) copied, 1.55218 s, 33.8 MB/s
    

    测试外接硬盘的读写速度:

    hdparm -Tt /dev/sda1

    pi@raspberrypi ~/downloads $ sudo hdparm -Tt /dev/sda1

    /dev/sda1:
     Timing cached reads: 316 MB in 2.01 seconds = 157.46 MB/sec
     Timing buffered disk reads: 62 MB in 3.03 seconds = 20.48 MB/sec
    

    pi@raspberrypi ~/downloads $ dd count=50 bs=1M if=/dev/zero of=/media/usbdisk/test.img

    50+0 records in
    50+0 records out
    52428800 bytes (52 MB) copied, 13.5962 s, 3.9 MB/s
    

    将external disk 格式化成ext4

    sudo mount -t ext4 /dev/sda1 /media/usbdisk

    pi@raspberrypi / $ sudo dd count=50 bs=1M if=/dev/zero of=/media/usbdisk/test.img

    50+0 records in
    50+0 records out
    52428800 bytes (52 MB) copied, 1.15549 s, 45.4 MB/s
    

    bingo!!

    解决初始安装时,键盘输入奇怪符号的问题

    比如输入|,则显示~

    主要原因是键盘默认使用GB(英国)键盘。

    打开 /etc/default/keyboard 修改 gb 为 us即可

    )
    - kongwu pi tips

    [home_of_robots.md]()
    - the list is far beyond just a board

    [raspberrypi.md](

    image 陆续分享一些攻略,参考...


    学习的最好的地方是raspberrypi官方论坛和elinux.org,有各种有意思的hacking,再加上google 搜索结合linux的应用就有各种有意思的创意思源,然后再实现之,也体现通过Raspberry Pi小而美的方式深入学习计算机知识.

    #安装系统 最小的基本硬件有Raspberry Pi单板、SD Card、Micro USB电源线,有网络接上RJ45网线就完全可以跑起来了,这些硬件都可以在官方指定代理商ickey里可以买到。

    • 下载系统

      在官方下载http://www.raspberrypi.org/downloadsRaspbian系统,更多支持的OS类型可参考link

    • 解压

    • linux使用dd命令把系统复制到SD卡

      sudo dd if=~/Downloads/2012-10-28-wheezy-raspbian/2012-12-16-wheezy-raspbian.img of=/dev/rdisk3 bs=4m
      

      文件名及SD卡设备名各自可能不同,注意查看。

    dd拷贝完成后连接电源,装上SD卡就可以用了,没接上显示器要控制raspberry,可以接上网线使用ssh远程控制。

    ssh网络连接,参考link

    SD卡各平台详细设置,参考link

    #PulseAudio跨网络传送音频

    手上没有外接音频设备,又想pi播放声音怎么办,可以使用PullseAudio C/S模型,Server播放音频,Client提供音源。

    以下是pi提供音源,在笔记本上播放声音,它们在同一局域网内:

    • pi和debian安装PulseAudio

      sudo apt-get install pulseaudio paprefs

    • Server笔记本配置

      vim /etc/pulse/default.pa 增加以下内容:

      load-module module-native-protocol-tcp listen=0.0.0.0 auth-anonymous=1

      配置好需要重启pulseaudio服务:

      $ pulseaudio --kill
      $ pulseaudio --start
      
    • Client pi配置

      vim /etc/pulse/client.conf,增加以下内容:

      default-server = tcp:192.168.1.105:4713

      然后安装mplayer使用测试音量了。

    #微博相关 越来越流行的社交媒体,开放的数据连接,以及物联网的流行,使得联网设备能实现一些非常有趣的玩法,可以利用定时发微博,可以获取特定微博的指定内容(命令)来控制联网设备的行为。 #External Links

    view raw raspberrypi.md hosted with ❤ by GitHub
    )
    - 陆续分享一些攻略,参考...

    [raspberry_pi.md](

    Flush img

    download img

    http://www.raspberrypi.org/downloads
    

    插入SD卡,用df命令查看当前已挂载的卷

    $ df -h
    Filesystem      Size   Used  Avail Capacity  iused    ifree %iused  Mounted on
    /dev/disk0s2    92Gi   33Gi   59Gi    36%  8609397 15410211   36%   /
    devfs          187Ki  187Ki    0Bi   100%      648        0  100%   /dev
    /dev/disk0s4   373Gi   71Gi  302Gi    19% 18594197 79281654   19%   /Volumes/d1
    map -hosts       0Bi    0Bi    0Bi   100%        0        0  100%   /net
    map auto_home    0Bi    0Bi    0Bi   100%        0        0  100%   /home
    /dev/disk1s1   7.4Gi  3.0Mi  7.4Gi     1%        0        0  100%   /Volumes/NO NAME
    

    使用diskutil unmount将这些分区卸载

    $ diskutil unmount /dev/disk1s1
    Volume NO NAME on disk1s1 unmounted
    

    通过diskutil list来确认设备

    $ diskutil list
    /dev/disk0
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:      GUID_partition_scheme                        *500.3 GB   disk0
       1:                        EFI EFI                     209.7 MB   disk0s1
       2:                  Apple_HFS Macintosh HD            98.4 GB    disk0s2
       3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
       4:                  Apple_HFS d1                      400.9 GB   disk0s4
    /dev/disk1
       #:                       TYPE NAME                    SIZE       IDENTIFIER
       0:     FDisk_partition_scheme                        *7.9 GB     disk1
       1:                 DOS_FAT_32 NO NAME                 7.9 GB     disk1s1
    

    使用dd命令将系统镜像写入。

    /dev/disk1s1是分区,/dev/disk1是块设备,/dev/rdisk1是原始字符设备。

    $ sudo dd bs=4m if=2014-01-07-wheezy-raspbian.img of=/dev/rdisk1
    706+1 records in
    706+1 records out
    2962227200 bytes transferred in 470.754370 secs (6292511 bytes/sec)
    

    diskutil unmountDisk卸载设备

    $ diskutil unmountDisk /dev/disk1
    Unmount of all volumes on disk1 was successful
    

    Raspberry Pi Source List

    sudo vi  /etc/apt/sources.list
    deb http://mirrors.ustc.edu.cn/raspbian/raspbian/   wheezy main contrib non-free rpi
    
    sudo apt-get update
    sudo apt-get install vim binutils-dev build-essential git zsh iptraf iftop screen
    

    设置IP

    sudo vim /etc/network/interfaces

    # 动态IP
    iface eth0 inet dhcp
    
    # 静态IP
    iface eth0 inet static
    address 10.0.1.145
    netmask 255.255.255.0
    gateway 10.0.1.1
    

    设置DNS: vi /etc/resolv.conf

    nameserver 8.8.8.8
    

    设置后保存,重启:sudo /etc/init.d/networking restart

    oh my zsh

    git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh
    cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
    chsh -s `which zsh`
    

    Install cgminer

    sudo apt-get install libusb-1.0-0-dev libusb-1.0-0 libcurl4-openssl-dev libncurses5-dev libudev-dev autoconf aptitude
    sudo aptitude install libtool
    
    mkdir -p ~/asic/cgminer
    cd ~/asic/cgminer
    git clone https://github.com/ckolivas/cgminer.git
    
    cd cgminer
    ./autogen.sh
    ./configure --enable-avalon --enable-icarus
    make
    sudo make install
    

    Install cmd

    # avalon
    cgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -u 1PDqnS6aC4xzUa9wPeJukbRMaJtttdm4Aj -p xxxx --avalon-options 115200:24:10:45:300 --avalon-temp 60 --avalon-cutoff 70 --api-allow "W:0/0" --api-listen --debug --syslog
    
    # icarus
    # cgminer -o stratum+tcp://stratum.mining.eligius.st:3334 -u 1PDqnS6aC4xzUa9wPeJukbRMaJtttdm4Aj -p xxxx --icarus-options 115200:1:1 --icarus-timing 3.0=100
    
    
    view raw raspberry_pi.md hosted with ❤ by GitHub
    )
    - None

    [rpi-todo.md]( )
    - A collection of resources, links, and todo items as I tinker with the amazing little Raspberry Pi

    [rpi.md]( )
    - Collection of useful Raspberry Pi resources.

    [Raspberry Pi setup](

    Raspberry Pi setup

    Just wanted a quick start guide for myself so that I wouldn't have to keep rooting through Google to remember all this stuff. Hopefully it helps other people.

    If you had other ideas or suggestions please leave a comment.

    Useful things to own before you buy a Pi

    The first time I bought a Pi I was enormously frustrated with myself because I didn't own all of this stuff. Kept having to order things off of Amazon and wait to get started... very irritating. This is all good stuff to have laying around anyway:

    • An extra keyboard and mouse.
    • An adapter for your monitor. I use this one
    • HDMI cable
    • Ethernet cable
    • An enclosure for the Pi, the Pibow is quite popular.
    • A USB hub

    Ratio for Pi to Purpose is 1:1.

    (unqualified opinion coming up, warning)

    Come up with a project and set up your Pi for that. Don't try to make the Pi into another workstation for yourself - it's a nice idea but you'll forget how to set everything up.

    I suppose you could make a disk image (see below) if you wanted, but I find it easier to plow ahead with a single Pi dedicated to a specific goal. That way I know when I turn that Pi on it'll always do what I wanted it to... and nothing else.

    In other words don't try to use one Pi for everything. If you don't need Processing and openFrameworks then don't install them both!

    What size Flash drive to buy?

    If you're doing anything besides running startx on the machine I'd go with an 8GB class 10 SDHC drive. Class 10 will run a tinsy bit faster I've read, though I'm betting the performance gain is negligible. Thanks to Stacey for the advice on this... just wish I had asked BEFORE I purchased myself. :)

    If you don't feel like learning how to flash the drive yourself you can buy one off of these guys pre-loaded for you.

    IMPORTANT :: If you're going to use the Pi for openFrameworks dev you want to make sure you're using the Raspbian "wheezy" distro. Again, either buy your flash drive with it pre-installed or download it here.

    Setting up the SD Card yourself

    Assumes you're on a Mac.

    Download the version of the distro you're into from Raspberry Pi's download page. Unzip it that and you should have a .img file.

    Pop your SD card into your Mac and then in Terminal do the following:

    diskutil list
    

    Remember the identifier of your SD card (should be something like disk1 or disk4 or along those lines).

    diskutil unmountDisk /dev/IDENTIFIER
    sudo dd bs=16m if=/path/to/your/downloaded/distro.img of=/dev/IDENTIFIER
    

    Type in your password and wait awhile. Insert SD card in your Pi and you're ready to go.

    Courtesy the RPI Easy SD Card Setup Guide

    Every time I boot up

    Just to make sure all my stuff stays latest/greatest.

    sudo apt-get clean
    sudo apt-get update
    sudo apt-get upgrade
    

    WARNING :: Updating and upgrading can take awhile. It also requires a connection to the Internet. I'd recommend a physical connection for the initial setup of your Pi for your initial install so that you don't encounter issues setting up the wireless stuff later.

    RPI Update

    Way easier for managing updates to the lower level stuff on the Pi.

    sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
    sudo rpi-update
    sudo reboot
    

    WARNING :: rpi-update can take a long time to do it's magic.

    The Basics

    sudo apt-get install git-core binutils git libnss-mdns netatalk tightvncserver
    

    Briefly:

    • git-core :: not sure why I need this but the openFrameworks walkthrough recommended.
    • binutils :: same as above
    • git :: for version control
    • libnss-mdns :: so I can use raspberrypi.local instead of the IP address
    • netatalk :: so I can use afp:// to connect on my Mac
    • tightvncserver :: VNC Client, so I can remote in from my laptop.

    Setting up Wifi

    I used an Edimax EW-7811Un. Basically a tiny USB wireless adapter. Plug it in to your Pi, then...

    nano /etc/network/interfaces
    

    Add this to the bottom:

    auto wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa.conf
    

    Save and quit (Ctrl+X). Now to create that wpa.conf:

    nano /etc/wpa.conf
    

    Write into that:

    network={
    ssid="NETWORK_SSID"
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk="NETWORK_PASSWORD"
    }
    

    Change NETWORK_SSID and NETWORK_PASSWORD to your wifi's network name and password respectively, save and quit.

    Set it to connect to Wifi on boot with:

    nano /etc/network/interfaces
    

    My file looks like this:

    auto lo
    
    iface lo inet loopback
    iface eth0 inet dbhcp
    
    auto wlan0
    iface wlan0 inet dhcp
    wpa-conf /etc/wpa.conf
    

    I believe you only need to add the last line but I can't recall and wanted to make sure to post my complete configuration to compare.

    Save. Reboot. The edimax should glow blue when it's working.

    sudo reboot
    

    Thanks to this tutorial for the assist.

    VNC Server

    We already installed Tight VNC so we can remote in if you followed the basics. I like to have it automatically start on boot up so I can just use it.

    sudo nano /etc/init.d/tightvncserver
    

    Then in the subsequent editor:

    export USER='pi'
    
    eval cd ~$USER
    
    case "$1" in
      start)
        su $USER -c '/usr/bin/vncserver :1 -geometry 1280x800 -depth 16 -pixelformat rgb565'
        echo "Starting vncserver for $USER "
        ;;
      stop)
        pkill Xtightvnc
        echo "vncserver stopped"
        ;;
      *)
        echo "Usage: /etc/init.d/vncserver {start|stop}"
        exit 1
        ;;
    esac
    exit 0
    

    Ctrl+X to exit. Y to save. Enter to keep the same filename.

    sudo chmod 755 /etc/init.d/tightvncserver
    sudo update-rc.d tightvncserver defaults
    

    Reboot and test. You should be able to share screen off of OSX or type in the IP address in your VNC client and see the Pi. If you need a port number to connect I believe it's 5900 but if that's wrong someone tell me in a comment and I'll update.

    Thanks to the tutorial here and for more detailed information check out eLinux.org's post.

    Git

    ssh-keygen -t rsa
    cat ~/.ssh/id_rsa.pub
    

    Whatever it prints out is your SSH Key. Feel free to add that to your Github settings so you can pull.

    openFrameworks

    Wanted my openFrameworks stuff set up separate from anything else I might do on the Pi. I put it in [user directory/Programming/openFrameworks.

    Here's how I do it:

    cd ~
    mkdir Programming
    cd Programming
    git clone https://github.com/openFrameworks-RaspberryPi/openFrameworks/
    cd openFrameworks/scripts/linux/debian_armv6l
    sudo ./install_codecs.sh
    sudo ./install_dependencies.sh
    cd ~/Programming/openFrameworks/libs/openFrameworksCompiled/project
    make
    

    You can also type make Debug instead of make here. Release vs. Debug configurations. Up to you.

    WARNING :: This takes a long time to compile. Brace yourself.

    Once all that's done:

    cd ~/Programming/openFrameworks/scripts/linux/template/linuxarmv6l
    cp Makefile ~/
    cd ~/Programming/openFrameworks/apps/devApps/raspberrypi_hello_world
    cp ~/Makefile ./
    make clean
    make
    

    Once compiled it'll tell you how to run the application, most likely by typing "make run". Quit the application with Ctrl+C.

    At this point I typically switch over to my Mac and either ssh in or mount the Pi as a remote volume. I copy and paste the raspberrypi_hello_world project for re-use, much like I would the emptyExample on a OSX development.

    How'd I learn this? The oF-Pi getting started guide.

    Arduino

    sudo apt-get install arduino
    startx
    

    You should see Arduino in your Start Menu -> Programming Folder. You'll likely need to switch from COM0 to /dev/ttyACM0

    Want to test?

    sudo apt-get install python-serial
    

    Then follow this tutorial. You'll already have pySerial installed.

    Processing

    sudo apt-get install librxtx-java openjdk-6-jdk
    wget http://processing.googlecode.com/files/processing-1.5.1-linux.tgz -O /home/pi/processing-1.5.1-linux.tgz
    tar -xzvf /home/pi/processing-1.5.1-linux.tgz
    rm /home/pi/processing-1.5.1-linux.tgz
    cd /home/pi/processing-1.5.1
    sudo rm -rf java    
    sudo ln -s /usr/lib/jvm/java-6-openjdk-armhf java
    sudo rm modes/java/libraries/serial/library/RXTXcomm.jar
    cp /usr/share/java/RXTXcomm.jar modes/java/libraries/serial/library/
    

    Should be able to fire up Processing from there by simply typing:

    /home/pi/processing-1.5.1/processing
    

    or cd /home/pi/processing-1.5.1 ./processing

    Also helps to use startx and then LXTerminal to run this. Adapted from this tutorial graciously sent to me by Jenn Kaye.

    Creating Disk Images

    Once I'm happy with something I may actually want to this from one Pi to the next.

    To do that, turn the Pi off and remove the SD card. Connect that card to your Mac. From Terminal:

    dd if=/dev/sd-card of=/path/to/save/image bs=16m
    

    /dev/sd-card is the path to your SD Card. /path/to/save/image is the path you want to save the image to.

    Unplug your SD card, grab a new one and run this:

    dd if=/path/to/save/image of=/dev/sd-card bs=16m
    

    Should be pretty obvious what is what in this restore command.

    Steps to to that courtesy this StackExchange post.

    view raw gistfile1.md hosted with ❤ by GitHub
    )
    - Raspberry Pi setup

    [raspberrypi_server.md](

    Setting up a Home Server with Raspberry Pi

    Downloading and Installing Wheezy Raspbian

    Download the latest wheezy raspbian raw image and install onto a 4GB+ SD card following the RPi Easy SD Card Setup instructions.

    Server Setup

    1. Insert the SD Card. Attach a keyboard, mouse, and monitor to your Raspberry Pi before booting it up.

    2. The Raspberry Pi has a nice "raspi-config" screen that you'll see on first boot. For a home server, the following selections will be useful:

      • expand_rootfs: resizes the default 2GB OS image to fill the rest of the Flash card.
      • change_pass: the default password is "raspberry", but something more secure than that would be better.
      • Set your locale and timezone.
      • memory_split: assign the minimum amount possible (16) to the GPU to leave as much room as possible for services.
      • SSH: don't forget to enable the SSH server.
      • boot_behaviour: turn off boot to desktop (again, to save memory for your services).
    3. When finished, you'll be at the pi@raspberrypi prompt. The setup script can be re-run at any time via sudo raspi-config.

    Network Configuration

    A static IP makes everything easier, so switch the network settings for eth0:

    sudo vi /etc/network/interfaces

    Change the eth0 line iface eth0 inet dhcp to the following (modify to meet your home network setup):

    ======/etc/network/interfaces======
    ...
    iface eth0 inet static
    address 192.168.1.10
    netmask 255.255.255.0
    gateway 192.168.1.254
    ...
    ======/etc/network/interfaces======

    Adding a User

    Create a local user, and put it in the users and sudo group:

    sudo adduser YOURUSERIDHERE
    sudo usermod -a -G users YOURUSERIDHERE
    sudo usermod -a -G sudo YOURUSERIDHERE

    Rebooting

    Update the system to ensure that it has the latest and greatest copies of all the libraries:

    sudo apt-get update; sudo apt-get upgrade

    At this point, you're ready to go headless! Shut down the Raspberry Pi:

    sudo /sbin/shutdown -h now

    Once it's down (monitor the green status LEDs on the Raspberry Pi circuit board to know when it has finished shutting down), unplug the monitor, keyboard, mouse and power cord. Attach the USB storage, then restart the Raspberry Pi by plugging the power back in.

    Once the Raspberry Pi starts up (again, those green LEDs are the clue to its state), you can ssh in to the RPi from any other machine on the network and finish all the configuration remotely from here on out (modify the following for your static IP):

    ssh YOURUSERIDHERE@192.168.1.10 
    )
    - Setting up a Home Server with Raspberry Pi

    [Raspberry Pi setup routine](

    Raspberry Pi setup routine

    Note I've started to transform my setup guide to Ansible playbooks at thpani/pi.

    Headless boot to SSH over WiFi

    /etc/network/interfaces

    auto lo
    auto eth0
    allow-hotplug wlan0
    
    iface lo inet loopback
    
    iface eth0 inet dhcp
    
    iface wlan0 inet dhcp
    wpa-ssid pani
    wpa-psk "********"
    
    iface default inet dhcp
    

    Disable power saving on the 8192CU (Edimax WiFi dongle)

    /etc/modprobe.d/8192cu.conf

    options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
    

    User setup

    $ passwd
    $ sudo useradd -m -G sudo,audio,video,users thomas
    $ sudo passwd thomas
    

    Software

    $ sudo aptitude install vim tmux zsh
    $ chsh -s /bin/zsh
    

    Time Machine

    $ sudo aptitude install netatalk exfat
    $ sudo blkid
    $ sudo mkdir /mnt/tm
    

    /etc/fstab

    proc            /proc           proc    defaults          0       0
    /dev/mmcblk0p1  /boot           vfat    defaults          0       2
    /dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
    UUID="4D02-8E53" /mnt/tm exfat defaults,nofail,gid=100,dmask=0002,fmask=0113 0 2
    

    Air Print

    $ sudo aptitude install avahi-daemon cups cups-pdf python-cups
    

    /etc/cups/cupsd.conf

    [...]
    Listen *:631
    [...]
    Allow from @LOCAL
    [...]
    
    $ sudo service cups restart
    $ sudo adduser thomas lpadmin
    
    • Browse to https://raspberrypi:631/admin, add the printer and share it.
    • For HP printers, choose the hpcups driver.
    view raw rpi.md hosted with ❤ by GitHub
    )
    - My Raspberry Pi setup routine

    [Node.js for Raspberry Pi](

    Node.js for Raspberry Pi

    Pre-built binaries

    Recent releases have been pre-built using cross-compilers and this script and are downloadable below.

    If you have found these packages useful, give me a shout out on twitter: @adammw

    The .tar.gz file is an archive, including npm and man pages, that can be extracted and used directly:

    cd ~/node/ # or /usr/local if you're feeling brave
    tar xzvf /path/to/binary.tar.gz --strip=1
    

    The .bin file is just the node.js executable.

    Raspbian (hard-float)

    STABLE: v0.10.24 (joyent/node@v0.10.24-release)

    UNSTABLE: v0.11.9 (joyent/node@v0.11.9-release)

    MAINTENANCE: v0.8.25 (joyent/node@v0.8.25-release)

    Raspberry Pi Soft Float Systems

    v0.8.9-pre (TooTallNate/node@???)

    Compiling Node.js

    This gist is now rather old gist, as such it details a lot of problems which are not present in recent releases and patches required. Patches may not work nor be correct anymore. Use everything at your own risk.

    Tips

    Cross-compiling on Linux

    1. Install or download a cross-compiler. The pre-compiled cross-compilers from raspberrypi/tools may work for you, however please ensure you get the correct one for your system (e.g. use the hardfp version for Raspbian) and install the compilers in your PATH by editing your .profile file, ensuring to add the /tools/arm-bcm2708/arm-bcm2708-linux-gnueabi/bin directory.
    2. Download this cross-compile helper script.
    3. Download the version of node.js source code you want or clone the git repository.
    4. If you are compiling Node.js 0.8.10 or lower, apply either this newer set of patches or this patch, but not both.
    5. Run the cross-compiler helper script to get a shell with the correct variables. If compiling for a soft float system or using a different toolchain besides the default (which is arm-bcm2708hardfp-linux-gnueabi), use the HOST envrionmental variable to set the correct HOST prefix, e.g. :
    HOST=arm-bcm2708-linux-gnueabi ~/crosscompile.sh
    

    otherwise:

    ~/crosscompile.sh
    
    1. It seems that the arm ld doesn't work with the makefile arguments, so set the following export:
    export LD="$CXX"
    
    1. If you are compiling Node.js 0.8.4 or lower, set the following exports:
    export GYP_DEFINES="armv7=0"
    export CCFLAGS='-march=armv6'
    export CXXFLAGS='-march=armv6'
    
    1. Run configure:
    ./configure --without-snapshot
    
    1. Run make
    make
    

    Using --jobs=8 to parallelize the build may speed things up if you have a multi-core processor, but is completely untested.

    1. Copy the node executable to the Raspberry Pi using scp
    scp node raspbian:~/bin/node
    

    Native Compile

    Be warned: this will take forever for little gain.

    1. Download the version of node.js source code you want or clone the git repository.
    2. If you are compiling Node.js 0.8.10 or lower, apply this newer set of patches or this patch, but not both.
    3. Run configure:
    ./configure --without-snapshot
    
    1. Run make and make install
    make
    make install
    
    view raw README.md hosted with ❤ by GitHub
    This file has been truncated, but you can view the full file.
    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    view raw node.bin hosted with ❤ by GitHub
    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    view raw node_g.bin hosted with ❤ by GitHub
    View raw

    (Sorry about that, but we can’t show files that are this big right now.)

    view raw node_ssl.bin hosted with ❤ by GitHub
    )
    - Node.js for Raspberry Pi



    ##other

    [hugozhu/blog](https://github.com/hugozhu/blog)
    - a blog with raspberry pi topic

    [rpi-update](https://github.com/Hexxeh/rpi-update)
    - An easier way to update the firmware of your Raspberry Pi


    ##Product
    [WALL-E](https://github.com/miclle/WALL-E)
    - WELL·E Robot. A Raspberry Pi, Arduino Robot, Using Ruby control
    4 条回复    1970-01-01 08:00:00 +08:00
    gevin
        1
    gevin  
    OP
       2014-04-21 13:05:56 +08:00
    怎么上面成那个样子了……

    https://gist.github.com/flyhigher139/11132757
    XDA
        2
    XDA  
       2014-04-21 13:10:55 +08:00
    好蛋疼的排版,收藏手动点赞!
    yy1984
        3
    yy1984  
       2014-04-22 08:16:28 +08:00
    这排版太丧心病狂了
    gamexg
        4
    gamexg  
       2014-04-23 10:59:40 +08:00
    我怎么找不到收藏按钮了...
    我买了个 Cubieboard ,被坑了,资料少得可怜,很多都的参考树莓派。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2618 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 11:07 · PVG 19:07 · LAX 04:07 · JFK 07:07
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.