Beaglebone Black mit Ubuntu als SVN-Server einrichten

07.10.2015 - Lesezeit: 3 Minuten

Das SVN-Verzeichnis möchte ich auf einem USB-Stick am Beaglebone anlegen.

Jedoch war der USB-Stick nach dem Einstecken nicht sichtbar.

Make sure the usb device is plugged in before power on.. USB hotplug is not working

Also den Beaglebone nach 200 Tagen Uptime neu starten. Ein bisschen weh hat das schon getan.

Jetzt benutze ich doch eine 16GB-Micro-SDCard

Linux-Partition erstellen

$ sudo fdisk /dev/mmcblk0
Command (m for help): p

Disk /dev/mmcblk0: 30.9 GB, 30908350464 bytes
255 heads, 63 sectors/track, 3757 cylinders, total 60367872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            8192    60367871    30179840    c  W95 FAT32 (LBA)

Command (m for help): d
Selected partition 1

Command (m for help): p

Disk /dev/mmcblk0: 30.9 GB, 30908350464 bytes
255 heads, 63 sectors/track, 3757 cylinders, total 60367872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-60367871, default 2048): 
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-60367871, default 60367871): 
Using default value 60367871

Command (m for help): p   

Disk /dev/mmcblk0: 30.9 GB, 30908350464 bytes
255 heads, 63 sectors/track, 3757 cylinders, total 60367872 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048    60367871    30182912   83  Linux

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.

ext 4 Filesystem erstellen

$ sudo mkfs.ext4 /dev/mmcblk0p1

Mountpunkt erstellen

$ sudo mkdir /var/svn

BlkID anzeigen und kopieren

$ sudo blkid
[sudo] password for wnf: 
/dev/mmcblk0p1: UUID="a7735e75-307b-4223-8d28-9e454136fdd9" TYPE="ext4" 
/dev/mmcblk1p1: LABEL="rootfs" UUID="235d14e8-cf33-4c0e-ad4a-feeb81e0fe17" TYPE="ext4"

In die FSTAb eintragen

$ sudo nano /etc/fstab
UUID=a7735e75-307b-4223-8d28-9e454136fdd9 /var/svn/ ext4 noatime,errors=remount-ro  0  1

Mounten

$ sudo mount /var/svn
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/mmcblk1p1  1.8G  837M  842M  50% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            247M   12K  247M   1% /dev
tmpfs            50M  256K   50M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            249M     0  249M   0% /run/shm
none            100M     0  100M   0% /run/user
/dev/mmcblk0p1   29G   44M   27G   1% /var/svn
Tags: Linux-Grundlagen beaglebone

Cherrypy auf Beaglebone

11.02.2015 - Lesezeit: ~1 Minute

Der Beaglebone ist wieder im Netz zu erreichen: http://bone.nfix.de


Erst Cherrypy3 hat das Attribut quickstart

attributeerror 'module' object has no attribute 'quickstart'

$ sudo apt-get install python-cherrypy3

unsupported locale setting

Tags: beaglebone cherrypy

ssh auf Beaglebone erneut freischalten

10.02.2015 - Lesezeit: ~1 Minute

Da mein Beaglebone Black wegen einer fehlerhaften SD-Karte neu aufgesetzt werden musste, muss zuerst der alte Fingerprint entfernt werden.

$ ssh-keygen -f "/home/wnf/.ssh/known_hosts" -R bone2013

Danach wird der Publickey an den Beaglebone gesendet:

$ ssh-copy-id -i ~/.ssh/id_rsa.pub wnf@bone2013

und schon kann ich mich wieder ohne Eingabe eines Passworts auf dem Beaglebone einloggen.

wnf@c2012:~$ ssh wnf@bone2013
Welcome to Ubuntu 14.04.1 LTS (GNU/Linux 3.8.13-bone70 armv7l)
Last login: Tue Feb 10 16:47:23 2015 from c2012.fritz.box
wnf@bone2013:~$ 
Tags: beaglebone ssh

Auf Beaglebone Black Ubuntu installieren

10.02.2015 - Lesezeit: 2 Minuten

Die genaue Vorgehensweise ist bei elinux.org beschrieben.

Benötigte Pakete

  • git
  • wget
  • dosfstools
  • u-boot-tools
  • parted
    $ sudo apt-get install git wget dosfstools u-boot-tools parted

Die SD-Karte für den Beaglebone in den Rechner stecken. Die SD-Karte darf nicht gemounted werden.

kontrollieren, wie die SD-Karte erkannt wird

$ ls -l /dev/sd[TAB][TAB]

Es wird das neue Device sdc angezeigt.

$ cd /tmp

Holen der Installationsdateien mit Hilfe von git

$ git clone https://github.com/RobertCNelson/netinstall.git

Das System auf die SD-Karte installieren.

$ sudo ./mk_mmc.sh --mmc /dev/sdc --dtb am335x-boneblack --distro trusty --firmware --serial-mode

Die SD-Karte aus dem Rechner entfernen und im Beaglebone einlegen. Den Beaglebone per USB am Rechner anschließen . Die Verbindung über minicom herstellen.

$ sudo minicom -D /dev/ttyUSB0 

Die Reset-Taste des Beaglebone drücken (rechts außen neben dem Netzwerkstecker.)

Tags: beaglebone

bbb lighttpd und python

11.01.2014 - Lesezeit: 2 Minuten

Zum nachlesen

Kochbuch

$ sudo apt-get install lighttpd
  • diverse Änderungen in /etc/lighttpd/lighttpd.conf
    $ sudo nano /etc/lighttpd/lighttpd.conf
  • mod_cgi hinzufügen
    server.modules = (
        "mod_access",
        "mod_alias",
        "mod_compress",
        "mod_redirect",
    #       "mod_rewrite",
        "mod_cgi",
    )
  • Python dem cgi-Modul zur Verfügung stellen
    cgi.assign = ( ".py" => "/usr/bin/python" )
    static-file.exclude-extensions = ( ".php", ".pl", ".fcgi", ".py" )
  • Das Verzeichnis /var/www/cgi-bin anlegen
    $ sudo mkdir /var/www/cgi-bin
$ sudo /etc/init.d/lighttpd restart
  • In diesem Verzeichnis dieses Python Script ablegen (mit freundlicher Unterstützung von planzero.org
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#http://planzero.org/blog/2012/01/26/system_uptime_in_python,_a_better_way

from datetime import timedelta

print "Content-Type: text/html"
print
print "<title>Uptime des Beaglebone Black</title>"
print "<h1>Uptime des Beaglebone Black</h1>"

with open('/proc/uptime', 'r') as f:
    uptime_seconds = float(f.readline().split()[0])
    uptime_string = str(timedelta(seconds = uptime_seconds))

print(uptime_string)

Testaufruf mit http://bone.nfix.de/cgi-bin/wnfuptime.py

Tags: Python beaglebone

beaglebone black bbb und seafile

30.12.2013 - Lesezeit: 3 Minuten

Nach dieser Anleitung habe ich den seafile-server auf meinem Weihnachtsgeschenk installiert

$ sudo su
# useradd -r seafile
# cd /opt
# mkdir seafile
# cd /opt/seafile
# wget http://seafile.googlecode.com/files/seafile-server_2.0.3_pi.tar.gz
# tar -xvf seafile-server_2.0.3_pi.tar.gz
# rm seafile-server_2.0.3_pi.tar.gz
# mv seafile-server-2.0.3 seafile-server
# cd seafile-server/
# ./setup-seafile.sh
# mkdir /opt/seafile/logs
# chown seafile:seafile -R /opt/seafile/
# chown seafile:seafile -R /var/seafile-data/

Seafile Server

This is your config information:

server name:        bone2013
server ip/domain:   bone.nfix.de
server port:        10001
seafile data dir:   /var/seafile-data
seafile port:       12001
httpserver port:    8082

Seahub

Seahub is the web interface for seafile server.

-----------------------------------------------------------------
Your seafile server configuration has been finished successfully.
-----------------------------------------------------------------

run seafile server:     ./seafile.sh { start | stop | restart }
run seahub  server:     ./seahub.sh  { start <port> | stop | restart <port> }

-----------------------------------------------------------------
If you are behind a firewall, remember to allow input/output of these tcp ports:
-----------------------------------------------------------------

port of ccnet server:         10001
port of seafile server:       12001
port of seafile httpserver:   8082
port of seahub:               8000

When problems occur, Refer to https://github.com/haiwen/seafile/wiki for information.

Den server beim Booten starten

# nano /etc/init.d/seafile-server
#!/bin/sh

# Change the value of "user" to your linux user name
user=seafile

# Change the value of "script_path" to your path of seafile installation
seafile_dir=/opt/seafile
script_path=${seafile_dir}/seafile-server-2.0.4
seafile_init_log=${seafile_dir}/logs/seafile.init.log
seahub_init_log=${seafile_dir}/logs/seahub.init.log

# Change the value of fastcgi to true if fastcgi is to be used
fastcgi=false
# Set the port of fastcgi, default is 8000. Change it if you need different.
fastcgi_port=8000

case "$1" in
        start)
                sudo -u ${user} ${script_path}/seafile.sh start > ${seafile_init_log}
                if [  $fastcgi = true ];
                then
                        sudo -u ${user} ${script_path}/seahub.sh start-fastcgi ${fastcgi_port} > ${seahub_init_log}
                else
                        sudo -u ${user} ${script_path}/seahub.sh start > ${seahub_init_log}
                fi
        ;;
        restart)
                sudo -u ${user} ${script_path}/seafile.sh restart > ${seafile_init_log}
                if [  $fastcgi = true ];
                then
                        sudo -u ${user} ${script_path}/seahub.sh restart-fastcgi ${fastcgi_port} > ${seahub_init_log}
                else
                        sudo -u ${user} ${script_path}/seahub.sh restart > ${seahub_init_log}
                fi
        ;;
        stop)
                sudo -u ${user} ${script_path}/seafile.sh $1 > ${seafile_init_log}
                sudo -u ${user} ${script_path}/seahub.sh $1 > ${seahub_init_log}
        ;;
        *)
                echo "Usage: /etc/init.d/seafile {start|stop|restart}"
                exit 1
        ;;
esac
# /etc/init.d/seafile-server start
Tags: beaglebone