RaspberryPi3B: Difference between revisions
(→Backup) |
(→Backup) |
||
| Line 188: | Line 188: | ||
Because of rsync errors this approach seems not to work, therefore relying on [[RaspberryPi3B#Backup]] | Because of rsync errors this approach seems not to work, therefore relying on [[RaspberryPi3B#Backup]] | ||
Create DB backup by: | |||
* create /media/ubunturoot permanently | * create /media/ubunturoot permanently | ||
* start Ubuntu HomePC | * start Ubuntu HomePC | ||
| Line 197: | Line 197: | ||
* change to Owncloud directory by | * change to Owncloud directory by | ||
cd /var/www/html/owncloud/ | cd /var/www/html/owncloud/ | ||
* backup DB by | * backup DB by | ||
mysqldump --single-transaction -h localhost -u root -p owncloud > /media/ubunturoot/media/uwe/Data/backup/raspberry/owncloud/DB_<YYYY-MM-DD>.txt | mysqldump --single-transaction -h localhost -u root -p owncloud > /media/ubunturoot/media/uwe/Data/backup/raspberry/owncloud/DB_<YYYY-MM-DD>.txt | ||
Revision as of 22:07, 1 January 2019
Specification
- package bought at amazon
- Quad Core 1.2GHz Broadcom BCM2837 64bit CPU
- 1GB RAM
- BCM43438 wireless LAN and Bluetooth Low Energy (BLE) on board
- 40-pin extended GPIO
- 4 USB 2 ports
- 4 Pole stereo output and composite video port
- Full size HDMI
- CSI camera port for connecting a Raspberry Pi camera
- DSI display port for connecting a Raspberry Pi touchscreen display
- Micro SD port for loading your operating system and storing data
- Upgraded switched Micro USB power source up to 2.5A
- 16GB Micro SD card
Configuration
- 192.168.178.34 for WLAN
- 192.168.178.35 for LAN
- SSH credentials (e.g. for WinSCP or Putty) user=pi pwd=raspberry for both IP
- enable SSH access for root by
sudo su passwd Halloo0@1 // edit /etc/ssh/sshd_config // decommend PermitRootLogin without-password // add PermitRootLogin yes sudo service ssh restart
- SD Card is file /dev/mmcblk0 and mmcblk0p[1-7] are the partitions, see them
fdisk /dev/mmcblk0 p q
Timezone
set to Berlin by:
sudo timedatectl set-timezone Europe/Berlin
check with
timedatectl
USB stick 1
- pluged-in 64GB USB stick -> USB stick is sda1 (see lsblk)
- windows partition table changed to Linux according to here
- format USB stick to ext4 filesystem by
umount /dev/sda1 mkfs.ext4 /dev/sda1 -L USBSTICK
- mount the USB stick by
cd /media mkdir usbstick mount /dev/sda1 /media/usbstick
- make the mount permanent by
nano -Bw /etc/fstab add line /dev/sda1 /media/usbdisk auto defaults,user 0 1
USB stick 2
- pluged-in 128GB USB stick for backup of raspberry -> USB stick device is sdb, partition is sdb1 (see output of tail -f /var/log/messages)
- the stick is formatted with FAT filesystem and is changed to ext4 by:
fdisk /dev/sdb d n + p w reboot mkfs.ext4 /dev/sdb1 -L USBSTICK2
- mount it
cd /media mkdir usbstick2 mount /dev/sda1 /media/usbstick2
- and for mounting it permanently add the following line /etc/fstab
/dev/sdb1 /media/usbstick2 auto defaults,user 0 1
Fritz NAS
- mount the USB disk of the Fritz.Box
cd /media mkdir fritzNAS
Software
Apache
- verion 2.4 installed by
sudo apt-get install apache2 chmod 777 /var/www/html
- to setup Apache as reverse proxy for Wildfly
sudo a2enmod proxy_ajp
- creates proxy.conf, proxy.load and proxy_ajp.load in /etc/apache2/mods-enabled
- restart
sudo /etc/init.d/apache2 restart or service apache2 restart
- find out version
apache2ctl -v
Logging
- see /var/log/apache2
Backup
Installation
- installation according to here as user root
curl -sSLO https://www.linux-tips-and-tricks.de/raspiBackupInstall.sh && sudo bash raspiBackupInstall.sh EN N (normal mode) RSYNC (backup type) 5 (number of backups) Y (verbose message)
installs raspiBackup.sh and raspiBackupInstall.sh to /usr/local/bin and raspiBackup.conf to /usr/local/etc.
- changed in /usr/local/etc/raspiBackup.conf to
DEFAULT_BACKUPPATH="/media/usbstick2/raspibackup"
Operation
- call backup by
/usr/local/bin# ./raspiBackup.sh -a : -o : -m detailed -P
Mediawiki
- download mediawiki-1.25.1.tar.gz and copy it to /tmp
- extract it by
tar -xzf mediawiki-1.25.1.tar.gz
- rename directory mediawiki-1.25.1 to mediawiki by
mv mediawiki-1.25.1 mediawiki
- move directory to the html directory by
mv /tmp/mediawiki /var/www/html/mediawiki
- change /var/www/html/mediawiki/LocalSettings.php
$wgServer = "http://uweheuer.goip.de";
- call http://192.168.178.35/mediawiki/
- to avoid not logged-in users to view or edit anything added the following lines to LocalSettings.php
$wgGroupPermissions['*']['read'] = false; $wgGroupPermissions['*']['edit'] = false; $wgGroupPermissions['*']['createaccount'] = false;
- install ImageMagick for picture rendering by
sudo apt-get update sudo apt-get install imagemagick
- copy C:\Uwes\Programme\xampp\htdocs\mediawiki-1.16.0\images to /var/www/html/mediawiki/images
- set images folder permissions right by
sudo chown -R www-data:www-data images/ sudo chmod -R 755 images/
- prabably forget to describe DB copy from EON laptop to Raspberry
MySQL
- install by
sudo apt-get install mysql-server php5-mysql mysql-client root root
- decomment in /etc/mysql/my.cnf
#bind-address = 127.0.0.1
- login with local client
mysql -u root -p
Backup
- map directory like in owncloud backup
mysqldump --all-databases --single-transaction -h localhost -u root -p > /media/ubunturoot/media/uwe/Data/backup/raspberry/mysql/DB_<YYYY-MM-DD>.txt
OwnCloud
ownCloud installed according to here]:
apt-get install apache2 php5 php5-gd php-xml-parser php5-intl apt-get install php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl usermod -a -G www-data www-data
- download owncloud-10.0.3.tar.bz2
cd /var/www/html tar xfj /home/pi/owncloud-10.0.2.tar.bz2 chown -R www-data:www-data /var/www/html service apache2 restart
- call <IP>/owncloud, admin user uwe.heuer@gmail.com Halloo0@1, DB root root owncloud localhost:3306
- change data directory according to here by
mkdir /media/usbstick/owncloud/data chown -R www-data:www-data /media/usbstick/owncloud/data apachectl -k stop rsync -avz /var/www/html/owncloud/data /media/usbstick/owncloud/ mv data data_obsolete ln -s /media/usbstick/owncloud/data/ /var/www/html/owncloud/data apachectl -k graceful
- to make owncloud accessible via goip uweheuer domain added to /var/www/html/owncloud/config/config.php in trusted domains
'trusted_domains' => array ( 0 => '192.168.178.35', 1 => 'uweheuer.goip.de', )
- to make it accessible only via SSL added to /etc/apache2/sites-enabled/000-default.conf
Redirect /owncloud https://uweheuer.goip.de/owncloud
Contacts
- Contacts-App via Market installed
- CardDav URL https://uweheuer.goip.de/owncloud/remote.php/dav/addressbooks/users/uwe.heuer@gmail.com/contacts/ by Contacts -> Settings -> ... -> Link -> Copy URL to Clipboard
- for client configuration see e.g. Samsung Tablet
Calendar
- Calendar-App via Market installed
- CalDav URL https://uweheuer.goip.de/owncloud/remote.php/dav/
- for client configuration see e.g. Samsung Tablet
Upgrade
- user (right top corner) -> settings
- admin area (left area) -> General -> Scroll down to Updater
- install apps again
Backup
Because of rsync errors this approach seems not to work, therefore relying on RaspberryPi3B#Backup
Create DB backup by:
- create /media/ubunturoot permanently
- start Ubuntu HomePC
- login (as root) to Raspberry e.g. by Putty from Windows or Ubuntu
- mount directory for backup by
sudo mount -t cifs -o username=uwe //192.168.178.202/shareroot /media/ubunturoot/ <ROOT_PWD>
- change to Owncloud directory by
cd /var/www/html/owncloud/
- backup DB by
mysqldump --single-transaction -h localhost -u root -p owncloud > /media/ubunturoot/media/uwe/Data/backup/raspberry/owncloud/DB_<YYYY-MM-DD>.txt
- unmount directory by
umount /media/ubunturoot
PHP
upload_max_filesize = 4M // before 2M service apache2 restart
PHPMyAdmin
- installed by
apt-get install phpmyadmin root root
- add to /etc/apache2/apache2.conf at the end (marked by UH)
Include /etc/phpmyadmin/apache.conf
- changed URL in /etc/phpmyadmin/apache.conf by
Alias /phpxmyadmin /usr/share/phpmyadmin
- restart apache
SSL
- edit /etc/apt/sources.list and add
deb http://ftp.debian.org/debian jessie-backports main
- update
apt-get update
- install
sudo apt-get install python-certbot-apache sudo apt-get install certbot -t jessie-backports sudo certbot --apache uweheuer.goip.de uwe.heuer@gmail.com
- creates among others /etc/letsencrypt
UweHeuer
- create database mysql505 with PHPMyAdmin
- export and import database
- create /wildfly/wildfly-11.0.0.Final/standalone/data/uweheuer
- copy abc.tmp and /wildfly/wildfly-11.0.0.Final/standalone/data
- download mysql-connector-java-5.1.44-bin.jar from MySQL site
- deploy it via the Wildfly admin console
- create datasources via Web admin console with
MySQLDS jdbc:mysql://localhost/mysql505?autoReconnect=true root root ... UwesWikiDS ...
- after SSL setup added to /etc/apache2/sites-enabled/000-default-le-ssl.conf
ProxyPass /uweheuer ajp://localhost:8009/uweheuer ProxyPassReverse /uweheuer http://localhost/uweheuer
- /etc/apache2/000-default.conf permanent redirect to SSL
Redirect permanent /uweheuer https://uweheuer.goip.de/uweheuer
- create
/myprogsand copy DisAndEnableUweHeuer.bat - Wildfly logger configuratoin according to here
Wildfly
- create /wildfly directory and chmod 777
- copy wildfly-11.0.0.Final.zip to /wildfly
- unzip
- enable remote access to Wildfly by editing /wildfly/wildfly-11.0.0.Final/standalone/configuration/standalone.xml and replace (save old version to standalone.xml_20171110):
<interface name="management">
<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface name="public">
<inet-address value="${jboss.bind.address:0.0.0.0}"/>
</interface>
with
<interface name="management">
<any-address/>
</interface>
<interface name="public">
<any-address/>
</interface>
- enable remote CLI access by adding native interface configuration to /wildfly/wildfly-11.0.0.Final/standalone/configuration/standalone.xml (save old version to standalone.xml_20171112)
- set Wildfly as a service by (there is a debian script in the doc directory and a description in the internet, but it didn't work, so used the approach from HomePC New):
create /etc/init.d/uweswildfly sudo chmod 755 /etc/init.d/uweswildfly sudo update-rc.d uweswildfly defaults // log goes to /var/log/uwes.log
- enable ajp communication to Apache2 by Web admin -> Configuration -> Subsystems -> Web/HTTP - Untertow -> Http -> View -> default server -> View -> AJP Listeners -> Add 'ajp' 'ajp'
Manual Operation
- cd /wildfly/wildfly-11.0.0.Final/bin
- start server by
./standalone.sh & disown
- stop server by
./jboss-cli.sh --connect command=:shutdown
- restart server by
./jboss-cli.sh --connect command=:reload
- get server status by
./jboss-cli.sh -c --commands="read-attribute server-state"
Wordpress
Installation
cd /var/wwww/html wget https://wordpress.org/latest.zip unzip latest.zip sudo chown -R www-data:www-data wordpress
- create database wordpress via phpmyadmin
- call https://uweheuer.goip.de/wordpress
user = uwe.heuer@gmail.com password = Halloo0@1
Increased maximum upload file size by editing PHP.INI.
Plugins
UpdraftPlus - Backup/Restore
- stores backup to Google Drive
Table of Contents Plus
- automatically inserts a table of content if the number of headings is high
Operation
Show Free Diskspace
df -h
Ports
netstat -tulnp
Analyze Network Access
From http://www.lug-erding.de/artikel/nts.html:
telnet <IP|Domain> 80 GET / HTTP/1.1 <ENTER> Host: <Domain> <ENTER><ENTER>
If
Trying <IP>
then name resolution works and if
Connected to <IP|Domain>
then TCP is fine and errors are located in higher layers. If
Connection refused
then probably no one listening at port or firewall otherwise see answer.
ping -c <NumberOfPings> -s <Size>
If size is e.g. 4000 pakets have to fragmented which could give hints for the error.
traceroute -n <IP> // Linux tracert <IP> // Windows
DNS problems could be checked
nslookup <Domain>
Detailled analysis via
tcpdump
Reboot
sudo reboot
Shutdown
sudo shutdown -h 0
Update
sudo apt-get update
Error corrected according to here
Version
cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)" NAME="Raspbian GNU/Linux" VERSION_ID="8" VERSION="8 (jessie)" ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"