debian auf raspberry pi 2

Debian auf SD-Karte laden

Schritte von Juan:

  1. Download and extract the jessie-rpi2-*.img.gz to get an .img file
  2. On any debian-based linux type sudo apt-get install bmap-tools  and install it.
  3. Then type sudo bmaptool copy –nobmap jessie-rpi2.img /dev/sdx  (Change yourlocation to the location of the .img file and sdx for the letter where the SD is mounted, if you don’t know it type sudo fdisk -l  and look for it).
  4. Wait until it finishes and then put the SD on your rp2.

Erster SSH-Login zum Konfigurieren

  • Das RPi durch Ethernet mit dem Router verbinden und dann am Strom anschliesen zum booten.
  • Auf dem Router prüfen, welche  IP-Adresse das RPi bekommen hat (durch Namen der Maschine)
  • $ ssh root@192.168.1.158 mit Passwort debian

Grundsystem konfigurieren

  • Kontos für ale und katrin erstellen. Login ohne Passwort, nur mit key.
    • adduser katrin  (+ale)
    • auf Linux, SSH-key generieren: ssh-keygen  (fragt um ein Pfad)
    • scp id_rsa.pub katrin@192.168.1.158:.ssh/  (+ale)
    • auf den rpi: cat id_rsa.pub >> .ssh/authorized_keys
    • Zugangsrechte für ~.ssh/*  auf r–  setzen
  • kein login für root und nur key login für den users:
    • edit /etc/ssh/ssh_config ,
    • PasswordAuthentication no  und PermitRootLogin no  setzen.
  • Auf dem Router, Port forwarding für https einrichten

Owncloud installieren

  • die externe festplatte in /etc/fstab  hinzufügen
    • die uuid der festplatte mit blkid  auslesen
    • in /etc/fstab die folgende Zeile hinzufügen:
      UUID=375cae2c-e89e-45ef-80f3-ee65e54b27e2 /mnt/data ext4 defaults 0 2
    • ln -s /mnt/data/owncloud /var/www/owncloud/data  (falls data/ bereits exisitert, zuerst umbennen und dann den inhalt in den neuen data/  verzeichnis kopieren; es scheint nicht möglich zu sein, auf andere laufwerke zugreifen)
  • user owncloud  in der datenbank hinzufügen:
    $ mysql –user=root –password mysql
    create user ‚owncloud’@’localhost‘ identified by ‚owncloud‘ WITH GRANT OPTION;
    GRANT ALL PRIVILEGES ON *.* TO ‚owncloud’@’localhost‘;

    SELECT User FROM mysql.user;
    create database owncloud;
  • Community Debian Repository von Owncloud hinzufügen und das neuste Owncloud installieren
  • php5-mysql  dazu installieren
  • Frage: sollten wir nginx statt apache brauchen? (http://etapien.com/guides/how-to-install-owncloud-on-debian-7-with-nginx/)
  • 192.168.1.158/owncloud/ aufrufen, admin konto erstellen und unbedingt auf |> clicken um mysql als datenbank auszuwählen.
  • port für SSH auf nicht Standard setzen (22; https://www.adayinthelifeof.nl/2012/03/12/why-putting-ssh-on-another-port-than-22-is-bad-idea/)
  • Securing MySQL: MySQL ships with a few conveniences that are supposed to be removed when put on a real server, to do that type:
    sudo mysql_secure_installation

DNS

  • You need to log into your Domain Registra’s account and set the A-record for your domain (mysite.com) to point to your router’s public IP address.

SSL

  • https://blog.hasgeek.com/2013/https-everywhere-at-hasgeek/
  • https://hallard.me/enable-ssl-for-apache-server-in-5-minutes/
  • http://www.startssl.com/?app=1

VPN

  • You’ll need to forward port 1194 (UDP traffic) to your Raspberry Pi’s internal IP address.
  • Install openvpn
    • http://readwrite.com/2014/04/10/raspberry-pi-vpn-tutorial-server-secure-web-browsing
    • http://www.raspberrypihelp.net/tutorials/1-openvpn-server-tutorial
    • http://www.linuxuser.co.uk/news/create-a-vpn-with-the-raspberry-pi

WIFI als LAN-Verbindung zu Raspery Pi einrichten

  • wicd-curses  installieren (network manager)
  • die netdev  gruppe für beide users hinzufügen
  • das wifi sollte automatisch erkannt werden, falls nicht:
    • sudo iwlist eth2 scan  zeigt alle access points
    • in der Preferences von wicd wlan0 als device setzen und wicd neu starten

How to get the wifi to work: http://sjoerd.luon.net/posts/2015/02/debian-jessie-on-rpi2/#comment-2210d3fbce30bfee22ad73d751a14d31$

Andere programme

  • usbutils  for lsusb
  • vim
  • sudo update-alternatives –config editor
  • sudo nmap -sP 192.168.1.0/24  to discover the ip addresses around you