Dieser Artikel ist veraltet!\\
Seit September 2019 findet Ihr unter **Projekte** -> **Cubietruck** -> **Neuauflage #3** [[https://www.von-thuelen.de/doku.php/wiki/projekte/cubietruck/cubietruck_debian_stretch| 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 =====
- [[https://wiki.debian.org/InstallingDebianOn/Allwinner|https://wiki.debian.org/InstallingDebianOn/Allwinner]]
- [[http://ftp.uk.debian.org/debian/dists/jessie/main/installer-armhf/current/images/netboot/SD-card-images/|http://ftp.uk.debian.org/debian/dists/jessie/main/installer-armhf/current/images/netboot/SD-card-images/]]
- [[https://www.debinux.de/2014/12/debian-basics-mit-systemd/|https://www.debinux.de/2014/12/debian-basics-mit-systemd/]]
- [[https://e-tobi.net/blog/2015/09/13/vdr-pakete-fur-raspberrypi|https://e-tobi.net/blog/2015/09/13/vdr-pakete-fur-raspberrypi]]
- [[http://www.milaw.biz/wiki/arch/cubietruck|http://www.milaw.biz/wiki/arch/cubietruck]] - Pimp my CubieTruck ;-)
- [[https://docs.armbian.com/|https://docs.armbian.com/]]
===== 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
* Serielles Kabel (FTDI-Kabel) anschließen um die folgenden Schritte auf der Konsole beobachten zu können
* sudo minicom -b 115200 -o -D /dev/ttyUSB0
* Cubietruck mit der neu erstellten SD-Karte booten
* Installation nach [1] fortführen
* Reboot
===== 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).
#
#
# / 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
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 ... ====
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 \"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 \"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 "" >> /var/www/html/phpinfo.php
# Im Browser öffnen: http:// /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://
==== /var/www/html/radiorecorder/res/settings.php ====
===== 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 ====
#======================= 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 [[https://www.von-thuelen.de/doku.php/wiki/linux/messaging/uebersicht|hier]]\\
echo "vdr ALL = NOPASSWD: /bin/telegram-cli" >> /etc/sudoers
===== Nextcloud =====
Aktuelle Version siehe hier: [[https://www.von-thuelen.de/doku.php/wiki/projekte/raspberrypi/uebersicht#nextcloud|https://www.von-thuelen.de/doku.php/wiki/projekte/raspberrypi/uebersicht#nextcloud]]
Quellen:
* [[https://www.howtoforge.com/tutorial/installing-lighttpd-with-php-fpm-and-mysql-or-mariadb-on-ubuntu/|https://www.howtoforge.com/tutorial/installing-lighttpd-with-php-fpm-and-mysql-or-mariadb-on-ubuntu/]]
* [[https://pimylifeup.com/raspberry-pi-nextcloud-server/|https://pimylifeup.com/raspberry-pi-nextcloud-server/]]
* [[https://stackoverflow.com/questions/33470753/create-mysql-database-and-user-in-bash-script|https://stackoverflow.com/questions/33470753/create-mysql-database-and-user-in-bash-script]]
==== 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 ====
* aktuelle Version von Nextcloud von [[http://www.nextcloud.com|www.nextcloud.com]] herunterladen
wget https://download.nextcloud.com/server/releases/nextcloud-13.0.0.tar.bz2
* entpacken
tar xfj nextcloud-13.0.0.tar.bz2
* entpackten Ordner per FTP in das Web-Root Verzeichnis hochladen
* Datenverzeichnis parallel zum Nextcloud Verzeichnis anlegen um Benutzerdaten und Nextcloud Installation voneinander zu trennen
* ''/tmp'' Verzeichnis innerhalb des Nextcloud-Verzeichnisses anlegen
* URL des Web-Root Verzeichnis in Browser aufrufen und die neue Nextcloud Instanz mit den richtigen Parametern für das Datenverzeichnis, den Benutzernamen und das Passwort des Administrators sowie den Datenbankparametern konfigurieren
* In der Datei ''/nextcloud/config/config.php'' den Pfad zum Datenverzeichnis anpassen und den Pfad zum ''/tmp'' Verzeichnis ergänzen
'tempdirectory' => '/.../.../.../htdocs/.../nextcloud/tmp',
* ''php.ini'' unterhalb von /nextcloud mit folgendem Inhalt anlegen:
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