This is an old revision of the document!


Raspberry Pi 2

$ lscpu
Architecture:          armv7l
Byte Order:            Little Endian
CPU(s):                4
On-line CPU(s) list:   0-3
Thread(s) per core:    1
Core(s) per socket:    4
Socket(s):             1
Model name:            ARMv7 Processor rev 5 (v7l)
CPU max MHz:           900,0000
CPU min MHz:           600,0000

Installation

$ sudo dd bs=4M if=2015-09-24-raspbian-jessie.img of=/dev/sdX

Initial Configuration

  1. Edit /boot/config.txt.
    $ sudo nano /boot/config.txt
    disable_overscan=1
    hdmi_force_hotplug=1
    hdmi_group=2
    hdmi_mode=48
    hdmi_drive=2
    config_hdmi_boost=4
    start_x=0
    gpu_mem=8
    dtparam=spi=off
    dtparam=i2c_arm=off
    max_usb_current=1 # maximum current for usb
  2. Run raspi-config.
    $ sudo raspi-config

    Please select each option that you interested in to config.

    • Expand Filesystem.
    • Change User Password.
    • Boot Options: B1 Console.
    • Internationalisation Options: Change Locale and Change Timezone.
    • Advanced Options: A2 Hostname, A3 Memory Split, A6 SPI, A7 I2C, A8 Serial.

Updating and Upgrading

  1. Update packages index from official repository.
    $ sudo apt-get update
  2. Upgrade installed packages.
    $ apt-get upgrade

Package Management

  1. List installed packages and save it to a file.
    $ dpkg-query --show -f '${Package}\n' > pkgs.list
  2. Edit the file and let the names of packages which you want to remove in it, i.e. graphical environment, applications and friends.
  3. Install vrms
  4. apt-get remove –purge firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink oracle-java8-jdk pistore wolfram-engine, # apt-get remove –purge lxde* gnome*# apt-get autoremove, # apt-get install screen, mariadb-server

Custom Configuration

# update-rc.d -f triggerhappy remove # update-rc.d -f thd remove # update-rc.d -f triggerhappy remove # nano /etc/ssh/sshd_config

PasswordAuthentication no

# nano /etc/bash.bashrc (PS1). I got it somewhere on the Internet. I will find the exact source.

PS1="\u@\h:\W \A \`if [ \$? == 0 ]; then echo \:\); else echo \:\(; fi\` "

# nano $HOME/.bashrc

PS1="\[\033[01;32m\]\u@\h\[\033[00m\]:\W \[\033[01;34m\]\A \[\033[00m\]\`if [ \$? == 0 ]; then echo \:\); else echo '\[\033[0;31m\]:('; fi\`\[\033[00m\] "

# nano /etc/rc.local $ ssh-keygen $ ssh-copy-id user@host

Pagekite

$ wget -c https://pagekite.net/pk/pagekite.py $ chmod +x pagekite.py $ nano .pagekite.rc $ ./pagekite.py $ screen -S pagekite

When you upgrade the Raspbian to jessie, you will get an error message:

Traceback (most recent call last):
  File "tmp/scr/pagekite.py", line 249, in <module>
    exec __FILES[".SELF/sockschain/__init__.py"] in sys.modules["sockschain"].__dict__
  File "<string>", line 130, in <module>
  File "<string>", line 132, in SSL
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

Install python-openssl

  • Error
    debug2: ssh_connect: needpriv 0
    debug1: Connecting to somesite.pagekite.me [XXX.YYY.ZZZ.22] port 22.
    debug1: Connection established.
    debug1: SELinux support disabled
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_rsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_rsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_dsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_dsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_ecdsa type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_ecdsa-cert type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_ed25519 type -1
    debug1: key_load_public: No such file or directory
    debug1: identity file /home/stwn/.ssh/id_ed25519-cert type -1
    debug1: Enabling compatibility mode for protocol 2.0
    debug1: Local version string SSH-2.0-OpenSSH_6.7p1 Debian-3
    ssh_exchange_identification: Connection closed by remote host
  • Debug with /usr/sbin/sshd -ddd -p 22 and try to connect to it.
  • Install corkscrew and add .ssh/config:
    Host *.pagekite.me
    CheckHostIP no
    ProxyCommand /usr/bin/corkscrew %h 443 %h %p
  • prun.sh

Syncthing

$ wget -c https://github.com/syncthing/syncthing/releases/download/v0.10.29/syncthing-linux-arm-v0.10.29.tar.gz $ wget -c https://github.com/syncthing/syncthing/releases/download/v0.10.29/sha1sum.txt.asc $ cat sha1sum.txt.asc |grep arm $ sha1sum syncthing-linux-arm-v0.10.29.tar.gz &gt; syncthing-linux-arm-v0.10.29.tar.gz.sha1 $ tar zxvf syncthing-linux-arm-v0.10.29.tar.gz $ mv syncthing-linux-arm-v0.10.29 syncthing $ syncthing/syncthing $ cd .config/syncthing/ $ nano config.xml $ screen -S syncthing

Debmirror

  • $ sudo apt-get install debmirror
  • $ nano debmirror-jessie
  • You can find the Debian and Raspbian archive keyrings on their official repository respectively
  • $ gpg –keyring debian-archive-keyring.gpg –export|gpg –no-default-keyring –keyring trustedkeys.gpg –import
  • $ gpg –keyring raspbian.public.key –export|gpg –no-default-keyring –keyring trustedkeys.gpg –import
  • gpg –list-keys –with-colons
  • $ debmirror-raspbian
  • $ nano /etc/cron.d/debmirror or /etc/crontab
  • $ sudo systemctl restart cron.service
  • $ sudo systemctl disable bla.service

Storage

# mkfs.ext4 /dev/sda1 # mkdir /media/dir # mount /dev/sda1 /media/dir/ # nano /etc/fstab

Cron

$ sudo nano /etc/crontab $ sudo service cron restart

Wireless

  1. # cd /etc/network
  2. # cp interfaces interfaces.orig
  3. # nano interfaces
    auto lo eth0
    
    iface lo inet loopback
    iface eth0 inet dhcp
    
    #iface wlan0 inet static
    #      address 192.168.1.4
    #      netmask 255.255.255.0
    #      gateway 192.168.1.24
    #      dns-nameservers 208.67.222.222 208.67.220.220
    #      wpa-ssid SSID
    #      wpa-psk
  4. # wpa_passphrase SSID passphrase » interfaces
  5. # nano interfaces
  6. # service networking restart
  7. wlanup.sh

Lighttpd

  • apt-get install lighttpd php5-cgi
  • $ sudo mv 10-dir-listing.conf ../conf-enabled/
  • $ sudo service lighttpd restart
  • # systemctl restart lighttpd.service
  • $ sudo ln -s /media/dir /var/www/dir
  • <?php phpinfo(); ?>
  • lighty-enable-mod dir-listing
  • lighty-enable-mod fastcgi
  • lighty-enable-mod fastcgi-php
  • lighty-enable-mod mod-rewrite
  • lighty-enable-mod accesslog
  • server.modules = (
            ...
            "mod_rewrite",
            ...
    )
    ...
    $HTTP["host"] == "stwn.duniasemu.org" {
            server.document-root = "/home/user/public_html/"
    }

Managed DNS

  1. Change nameservers in your domain panel
  2. Add hosts in your managed DNS panel, i.e. CNAME
  3. Add CNAME in Pagekite

MariaDB

  • mysql -u root -p
  • create database db
  • grant all on db.* to 'db'@'localhost' identified by 'greatpassword';

PHP

  • opcache/xcache

systemctl

  • systemctl enable/disable [service]
  • systemctl start/stop/restart/status [service].service

Applications

  • aria2
  • screen -S tes
  • screen -r tes
 
doc/raspi2.1447504997.txt.gz · Last modified: 2015/11/14 12:43 by stwn · [Old revisions]
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki