Inhaltsverzeichnis

Dieser Artikel ist veraltet!
Seit September 2019 findet Ihr unter ProjekteCubietruckNeuauflage #3 oder hier eine komplett überabeitet Anleitung.

Cubietruck als headless Video Disk Recorder (VDR)

Installation von GNU Debian 8.x aka Jessie auf dem Cubietruck (ARMv7 AllWinner A20)

Quellen

Debian 8.x Jessie Installation

Installation wie in [1] beschrieben durchführen.

wget http://ftp.uk.debian.org/debian/dists/jessie/main/installer-armhf/current/images/netboot/SD-card-images/firmware.Cubietruck.img.gz
wget http://ftp.uk.debian.org/debian/dists/jessie/main/installer-armhf/current/images/netboot/SD-card-images/partition.img.gz
zcat firmware.Cubietruck.img.gz partition.img.gz > /dev/sde

Konfiguration des Grundsystems

#login als root via serieller Konsole
apt-get update
apt-get upgrade
apt-get install mc apt-transport-https ntpdate sudo
dpkg-reconfigure locales
 [*] de_DE.UTF-8
 [*] en_GB.UTF-8
#
#
nano /etc/fstab
#
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/mmcblk0p2 during installation
UUID=855ca3a0-0307-45e5-8ac7-020275c8801f /               ext4    errors=remount-ro 0       1
# /boot was on /dev/mmcblk0p1 during installation
UUID=42146a70-75a6-4ee7-b315-ffad2d408385 /boot           ext2    defaults        0       2
# swap was on /dev/mmcblk0p5 during installation
UUID=2f3771cc-68e2-4e44-a97d-6fe99eea34f0 none            swap    sw              0       0
#
UUID=afeb5bfa-bf16-42f0-a8d0-8f57619746a8 /mnt/sda1 ext4 defaults 1 1
#
#
#
cd /home/
mv christoph __christoph
ln -s /mnt/sda1/christoph christoph

Netzwerkkonfiguration

nano /etc/systemd/resolved.conf
[Resolve]
DNS=192.168.100.1
#
ln -sf /run/systemd/resolve/resolv.conf /etc/resolv.conf
#
# falls ''systemd-resolved'' schon läuft: 
systemctl restart systemd-resolved.service
#
# sonst:
systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
#
# nach [3]
nano /etc/systemd/network/eth0.network
#
[Match]
Name=eth0
[Network]
Address=192.168.100.3/24
Gateway=192.168.100.1
DNS=192.168.100.1
#
# LAN Schnittstelle abschalten:
ifdown eth0
#
cp /etc/network/{interfaces,interfaces_bak}
cat /dev/null > /etc/network/interfaces
update-rc.d networking remove
systemctl enable systemd-networkd.service
systemctl start systemd-networkd.service
#
# Login für den Benutzer ''root'' via SSH ermöglichen:
nano /etc/ssh/sshd_config
...
PermitRootLogin without-password -> PermitRootLogin yes
...
#

Zeitserver

echo "NTPDATE_USE_NTP_CONF=no" > /etc/default/ntpdate
echo "NTPSERVERS=\"192.168.100.1\"" >> /etc/default/ntpdate
echo "NTPOPTIONS=\"\"" >> /etc/default/ntpdate

Sundtek DVB-C Tuner

Installation

ssh -l root <VDR-IP>
cd /root
wget http://www.sundtek.de/media/sundtek_netinst.sh
chmod +x sundtek_netinst.sh
./sundtek_netinst.sh
/opt/bin/mediaclient --dtvtransfermode=bulk -d /dev/dvb/adapter0/frontend0
# Reconnect Tuner #1
/opt/bin/mediaclient --dtvtransfermode=bulk -d /dev/dvb/adapter1/frontend0
# Reconnect Tuner #2
#
# VDR erneut starten wenn DVB-Tuner Treiber geladen sind:
echo "device_attach=service vdr restart" >> /etc/sundtek.conf

VDR

Auf keinen Fall die automatisch generierte Kanalkonfiguration (channels.conf für vdr) aus dem Kabel Deutschland Forum verwenden - die Parameter für die HD Sender der Öffentlich-Rechtlichen sind fehlerhaft und bringen den VDR regelmäßig zum Absturz (data stream broken → emergency exit).
echo "deb https://packages.e-tobi.net/vdr-experimental jessie base vdr-multipatch" >> /etc/apt/sources.list
gpg --keyserver keyring.debian.org --recv-keys 041390BC
gpg --armor --export 041390BC | apt-key add -
apt-get update
apt-get install vdr vdr-plugin-streamdev-server vdr-plugin-vnsiserver vdradmin-am vdr-plugin-epgsearch dvb-apps
#
# VDR und VDRadmin-am Dienst via sytemctl starten:
systemctl start vdr && systemctl start vdradmin-am
#
# VDR und VDRadmin-am Dienst via sytemctl stoppen:
systemctl stop vdr && systemctl stop vdradmin-am
#

Sendersuche

sudo su
apt-get install w-scan
w_scan -fc -c DE >> channels.conf

Konfiguration

nano /etc/default/vdradmin-am
... ENABLED="1"
#
nano /etc/vdr/setup.conf
# automatische Kanalsuche abschalten:
UpdateChannels = 0
#
nano /etc/vdradmin-am/vdradmind.conf
LANG = 
LANGUAGE = Deutsch
VDR_PORT = 6419
#
nano /etc/vdr/conf.d/00-vdr.conf
[vdr]
#--video=/var/lib/video
--video=/mnt/sda1/video0
--config=/var/lib/vdr
--lib=/usr/lib/vdr/plugins
--record=/usr/lib/vdr/vdr-recordingaction
--epgfile=/var/cache/vdr/epg.data
--user=vdr
--grab=/tmp
--port=6419
--watchdog=60
#--lirc
#--vfat
#--shutdown=/usr/lib/vdr/vdr-shutdown.wrapper
#--userdump
#
#
nano /etc/default/vdr
#VDR_CHARSET_OVERRIDE=ISO-8859-9
#

vor und nach Aufnahmen ...

/etc/vdr/recording-hooks/R90.custom
case $1 in
    before)
        # do here whatever you would like to do right BEFORE
        # the recording $2 STARTS
        echo 1 > /sys/class/leds/blue\:ph21\:led1/brightness
        sudo telegram-cli -W -e "msg <EMPFÄNGER> \"VDR: Aufnahme $2 gestartet!\""
        ;;
 
    started)
        # do here whatever you would like to do right AFTER
        # the recording $2 STARTED
        ;;
 
    after)
        # do here whatever you would like to do right AFTER
        # the recording $2 ENDED
        echo 0 > /sys/class/leds/blue\:ph21\:led1/brightness
        chmod -R g+w $2/..
        sudo telegram-cli -W -e "msg <EMPFÄNGER> \"VDR: Aufnahme $2 beendet!\""
        ;;
 
    edited)
        # do here whatever you would like to do right AFTER
        # the recording $2 has been EDITED
        # $3 is the original recording
        ;;
    deleted)
        # do here whatever you would like to do right AFTER
        # the recording $2 has been DELETED
        ;;
esac

Radiorecorder Web GUI

sudo su
apt-get install lighttpd streamripper at
systemctl status lighttpd
usermod -G vdr -a www-data
#chown -R www-data:www-data /var/www/html
#chmod -R 775 /var/www/html
# zuerst lighttpd installieren da sonst auf Grund von Abhängigkeiten evtl. der apache2 Webserver installiert wird!
apt-get install php5-common php5-cgi php5
lighty-enable-mod fastcgi
lighty-enable-mod fastcgi-php
systemctl restart lighttpd
echo "<?php phpinfo(); ?>" >> /var/www/html/phpinfo.php
# Im Browser öffnen: http://<RASPBERRYPI-IP/phpinfo.php
# www-data aus /etc/at.deny entfernen
sed -i -e '/www-data/d' /etc/at.deny
cd ~
wget https://netcologne.dl.sourceforge.net/project/radiorecwebgui/0.3.x/radiorecorder_0.3.1.tar.gz
tar xfz radiorecorder_0.3.1.tar.gz
mkdir -p /var/www/html/radiorecorder
cp -R radiorecorder_0.3.1/* /var/www/html/radiorecorder/
#
echo "NDR2;http://ndr-ndr2-niedersachsen.cast.addradio.de/ndr/ndr2/niedersachsen/mp3/128/stream.mp3" > /var/www/html/radiorecorder/res/streams.txt
echo "NDR Kultur;http://ndr-ndrkultur-live.cast.addradio.de/ndr/ndrkultur/live/mp3/128/stream.mp3" > /var/www/html/radiorecorder/res/streams.txt
echo "NDR Info;http://ndr-ndrinfo-niedersachsen.cast.addradio.de/ndr/ndrinfo/niedersachsen/mp3/128/stream.mp3" > /var/www/html/radiorecorder/res/streams.txt
echo "N-Joy;http://ndr-njoy-live.cast.addradio.de/ndr/njoy/live/mp3/128/stream.mp3" > /var/www/html/radiorecorder/res/streams.txt
echo "NDR Blue;http://ndr-ndrblue-live.cast.addradio.de/ndr/ndrblue/live/mp3/128/stream.mp3" > /var/www/html/radiorecorder/res/streams.txt
echo "NDR Plus;http://ndr-ndrplus-live.cast.addradio.de/ndr/ndrplus/live/mp3/128/stream.mp3" > /var/www/html/radiorecorder/res/streams.txt
#
chown -R www-data:www-data /var/www/html/
mkdir /mnt/video0/radiorecorder
chown -R vdr:vdr /mnt/video0/radiorecorder/
chmod -R g+w /mnt/video0/radiorecorder/
#
systemctl restart lighttpd
# Im Browser öffnen: http://<RASPBERRYPI-IP/

/var/www/html/radiorecorder/res/settings.php

settings.php
<?php
 
class Settings {
 
  public static $siteRoot = '/var/www/html/radiorecorder';
  public static $recordedFilesDestination = '/mnt/sda1/video0/radiorecorder';
  public static $language = 'de'; //"de" for german or "en" for english
  public static $locale = 'C'; // default is "C"; other possible locales: "de_AT.UTF-8" to enable all corresponding characters for the filename
  public static $defaultStreamripperParams = '';	// adds streamripper params to each call
  public static $addDatePrefixToFilename = null;	// prefix format (e.g. 'Y-m-d') or null if no prefix to add
  public static $postCommand = '';	// command to be executed after the recording is finished
  public static $logThreshold = 3; //Level of log messages, possible values : LEVEL_DEBUG=4, LEVEL_INFO=3, LEVEL_WARN=2, LEVEL_ERROR=1
 
}
 
?> 

SAMBA installieren und einrichten

aptitude install samba
echo "wins server = eth0:192.168.100.1" > /etc/samba/dhcp.conf
adduser christoph
smbpasswd -a christoph
aptitude install cifs-utils

Samba Konfiguration

smb.conf
#======================= Global Settings =======================
 
[global]
   workgroup = WG
   server string = %h server
   wins support = no
 
   wins server = 192.168.100.1
   dns proxy = no
   name resolve order = lmhosts host wins bcast
   unix extensions = no
 
#### Networking ####
;   interfaces = 127.0.0.0/8 eth0
;   bind interfaces only = yes
 
#### Logging ####
   log file = /var/log/samba/log.%m
 
# Cap the size of the individual log files (in KiB).
   max log size = 1000
   syslog = 0
   panic action = /usr/share/samba/panic-action %d
 
####### Authentication #######
   security = user
   encrypt passwords = true
   passdb backend = tdbsam
   obey pam restrictions = yes
   unix password sync = yes
   passwd program = /usr/bin/passwd %u
   passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
   pam password change = yes
   map to guest = bad user
 
#======================= Share Definitions =======================
[homes]
   comment = Home Directories
   browseable = yes
   writeable = yes
   read only = no
   create mask = 0700
   directory mask = 0700
   valid users = %S
 
[Aufnahmen]
   comment = VDR Aufnahmen
   path = /mnt/sda1/video0
   browseable = yes
   writeable = yes
   read only = no
   #create mask = 0700
   #directory mask = 0700
   #valid users = %S
   create mask = 0664
   directory mask = 0775
   force group = users
   follow symlinks = yes
   wide links = yes
 
 load printers = no
 printing = bsd
 printcap name = /dev/null
 disable spoolss = yes

Telegram für Benachrichtigungen

siehe hier

echo "vdr     ALL = NOPASSWD: /bin/telegram-cli" >> /etc/sudoers

Nextcloud

Quellen:

Installation

apt-get update
apt-get upgrade

MySQL Datenbank

aptitude install mysql-server mysql-client
mysql Datenbank, User und Passwort anlegen
mysql -uroot -p${mysqlrootpasswd} -e "CREATE DATABASE nextcloud;"
mysql -uroot -p${mysqlrootpasswd} -e "CREATE USER nextcloud@localhost IDENTIFIED BY '${PASSWDDB}';"
mysql -uroot -p${mysqlrootpasswd} -e "GRANT ALL PRIVILEGES ON nextcloud.* TO 'nextcloud'@'localhost';"
mysql -uroot -p${mysqlrootpasswd} -e "FLUSH PRIVILEGES;"

Lighttpd Webserver und PHP

aptitude install lighttpd

PHP

aptitude install php5-fpm php5
mcedit /etc/php5/fpm/php.ini
#  uncomment the line cgi.fix_pathinfo=1
cd /etc/lighttpd/conf-available/
cp 15-fastcgi-php.conf 15-fastcgi-php-spawnfcgi.conf
mcedit 15-fastcgi-php.conf
-----
## Start an FastCGI server for php (needs the php5-cgi package)
fastcgi.server += ( ".php" =>
        ((
                "socket" => "/var/run/php5-fpm.sock",
                "broken-scriptfilename" => "enable"
        ))
)
-----
lighttpd-enable-mod fastcgi
lighttpd-enable-mod fastcgi-php
 
aptitude install php5-mysqlnd php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
aptitude install php5-xcache
service php5-fpm reload
aptitude install phpmyadmin
 
#Web server to reconfigure automatically: <-- lighttpd
#Configure database for phpmyadmin with dbconfig-common? <-- yes
#
#Password of the database's administrative user: <-- Enter the MySQL/MariaDB root password
#MySQL application password for phpmyadmin: <-- Press ENTER
 
#Afterwards, you can access phpMyAdmin under http://192.168.100.3/phpmyadmin/
#
mkdir -p /var/www/html/nextcloud/data
chown www-data:www-data /var/www/html/nextcloud/data
chmod 750 /var/www/html/nextcloud/data
cd /var/www/html/nextcloud
chown www-data:www-data config apps

Nextcloud 13

 wget https://download.nextcloud.com/server/releases/nextcloud-13.0.0.tar.bz2 
 tar xfj nextcloud-13.0.0.tar.bz2 
 'tempdirectory' => '/.../.../.../htdocs/.../nextcloud/tmp', 
php.ini
opcache.enable=1
opcache.enable_cli=1
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=10000
opcache.memory_consumption=128
opcache.save_comments=1
opcache.revalidate_freq=1