weiter gegliedert

This commit is contained in:
Vater 2015-05-15 13:49:32 +00:00
parent 6ad91d0e02
commit 63bef7e3cc

View File

@ -2,12 +2,6 @@
Dieser Artikel wird bis 2015-05-18 massiv von [[Benutzer:vater|vater]] bespaßt.
Dennoch können (sollen) jederzeit Änderungen vorgenommen werden.
{{NiftyDiv|
Farbe=#aafd72|
Inhalt=
Das Skript ''[[HQ/c3d2-networking | c3d2-networking]]'' unterstützt bei der Verwendung vom [[Server/storage]] (für [[w:de:Server Message Block|smb]], [[w:de:Network File System|nfs]], [[w:de:WebDAV|webdav]], [[w:de:SSHFS|sshfs]] bei [[Debian GNU/Linux]]).
}}
begin ehemals [[Server/freenas]]
== Hardware ==
@ -55,18 +49,19 @@ Als Bezeichnung ergab sich ''feile'' nach der üblichen chaotischen Verballhornu
== Betriebssystem ==
=== [[FreeNAS]] ===
Der [[Server/storage]] wird mit [[FreeNAS]] betrieben.
begin ehemals [[Server/freenas/FreeNAS]]
==== Installation von [[FreeNAS]] ====
{{beinhaltet Abweichungen von der Realität}}
<!-- oder ist das tatsächlich noch so? -->
; Stand: {{#dateformat:2014-09-12}}
== Installation ==
* boot vom 8 GB USB Stick
* zpool import der 192 ZFS Datasets unter /mnt/zroot
== Dienste ==
==== Dienste mit dem [[FreeNAS]] ====
* Samba
* NFS
@ -83,8 +78,6 @@ Als Bezeichnung ergab sich ''feile'' nach der üblichen chaotischen Verballhornu
* owncloud.hq.c3d2.de
* minidlna.hq.c3d2.de
end ehemals [[Server/freenas/FreeNAS]]
== Zweck ==
=== aktuelle Verwendungen ===
@ -103,17 +96,33 @@ FreeBSD Jail Container
* minidlna
* nfs(3)
* samba(4)
* ftp (in arbeit)
* ftp (in Arbeit)
== Verwendungszweck ==
* DLNA Sharing
* File Sharing
== HOST: FreeBSD NFS Export / ZFS sharenfs ==
== HOST: crontab ==
<source lang=bash>
vi /etc/rc.conf
00 6 * * * root /usr/sbin/chown -R k-ot:k-ot /rpool
</source>
== Netzwerk ==
=== [[HQ/c3d2-networking | c3d2-networking]] ===
Das Skript ''[[HQ/c3d2-networking | c3d2-networking]]'' unterstützt bei der Verwendung vom [[Server/storage]] (für [[w:de:Server Message Block|smb]], [[w:de:Network File System|nfs]], [[w:de:WebDAV|webdav]], [[w:de:SSHFS|sshfs]] bei [[Debian GNU/Linux]]).
=== NFS ===
==== Exportieren von NFS ====
===== Exportieren von NFS bei FreeBSD =====
* mit ZFS sharenfs
: <source lang=bash>vi /etc/rc.conf</source>
<source lang=bash>
rpcbind_enable="YES"
nfs_server_enable="YES"
mountd_flags="-r"
@ -121,181 +130,88 @@ rpc_lockd_enable="YES"
rpc_statd_enable="YES"
</source>
dirkter ZFS Export
<source lang=bash>
zfs set sharenfs="-maproot=root -network=172.22.0.0 -mask=255.255.0.0" zroot/storage/rpool
</source>
(fstab beispiel)
<source lang=bash>172.22.99.10:/mnt/zroot/storage/rpool /mnt/freebert.nfs nfs noauto,soft,noatime,acl,users,timeo=15 0 0</source>
direkter ZFS Export
: <source lang=bash>zfs set sharenfs="-maproot=root -network=172.22.0.0 -mask=255.255.0.0" zroot/storage/rpool</source>
Beispiel ''fstab''
: <source lang=bash>172.22.99.10:/mnt/zroot/storage/rpool /mnt/freebert.nfs nfs noauto,soft,noatime,acl,users,timeo=15 0 0</source>
ZFS Clone Stand:
<source lang=bash>zfs clone zroot/storage/c3d2@_0009_system_07.04.2014 zroot/ezjail/storage.hq.c3d2.de/rpool</source>
==== Importieren von NFS ====
===== Importieren von NFS bei GNU/Linux =====
; Installieren der notwendigen Pakete ''nfs-common'' und ''portmap'':
: <source lang=bash>apt-get install nfs-common portmap</source>
; Einhängen bei der lokale Maschine:
: am Beispiel der Daten vom gesamten Unterverzeichnis ''rpool'' auf dem [[Server/storage]] (mit der IP-Adresse ''172.22.99.10'')
: <source lang=bash>mkdir /freebert-nfs</source>
: <source lang=bash>showmount -e 172.22.99.10</source>
: <source lang=bash>mount -t nfs 172.22.99.10:/mnt/zroot/storage/rpool /freebert-nfs -o soft,timeo=15,noatime</source>
: Hinweise:
:* setting noatime is not recomended if you want to use mutt inside your nfs mountpoint
Erstellen eines Eintrages in der Datei <code>/etc/fstab</code> für Verfügbarkeit beim Befehl <code>mount -a</code>
: <source lang=bash>vi /etc/fstab</source>
: am Beispiel der Daten vom gesamten Unterverzeichnis ''rpool'' auf dem [[Server/storage]] (mit der IP-Adresse ''172.22.99.10'')
<source lang=bash>
zfs clone zroot/storage/c3d2@_0009_system_07.04.2014 zroot/ezjail/storage.hq.c3d2.de/rpool
172.22.99.10:/mnt/zroot/storage/rpool /freebert-nfs nfs noauto,user,soft,timeo=15,noatime 0 0
</source>
== NFS Import unter Linux ==
===== Importieren von NFS bei FreeBSD =====
: <source lang=bash>vi /etc/rc.conf</source>
<source lang=bash>
apt-get install nfs-common portmap
</source>
mount:
<source lang=bash>
mkdir /freebert-nfs
showmount -e 172.22.99.10
mount -t nfs 172.22.99.10:/mnt/zroot/storage/rpool /freebert-nfs -o soft,timeo=15,noatime
</source>
setting noatime is not recomended if you want to use mutt inside your nfs mountpoint.
entry for <code>mount -a</code> in /etc/fstab:
:<code>172.22.99.10:/mnt/zroot/storage/rpool /freebert-nfs nfs noauto,user,soft,timeo=15,noatime 0 0</code>
== NFS Import unter FreeBSD ==
<source lang=bash>
vi /etc/rc.conf
nfs_client_enable="YES"
</source>
mount:
Einhängen am Beispiel der Daten im Unterverzeichnis ''rpool'' auf [[Server/storage]] an die lokale Maschine
: <source lang=bash>mount 172.22.99.10:/mnt/zroot/storage/rpool /freebert-nfs</source>
<source lang=bash>
mount 172.22.99.10:/mnt/zroot/storage/rpool /freebert-nfs
</source>
===== Importieren von NFS bei MacOS&nbsp;X =====
* Finder -> Gehe zu -> Mit Server verbinden (Apfel+K)
*: <code>nfs://172.22.99.10/mnt/zroot/storage/rpool</code> eintragen
== NFS Import unter MacOS X ==
; bei Problemen mit Schreibrechten:
: <source lang=bash>mkdir freebert-nfs</source>
: <source lang=bash>sudo mount -t nfs -o resvport,bg,nfc,nolocks,locallocks,intr,soft,wsize=32768,rsize=3276 172.22.99.10:/mnt/zroot/storage/rpool /Users/<DEIN NAME>/freebert-nfs</source>
:; Finder mit ROOT-Rechten!:
:: <source lang=bash>sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder</source>
<source lang=bash>
Finder -> Gehe zu -> Mit Server verbinden (Apfel+K)
===== Importieren von NFS bei Windows 8 =====
* Systemsteuerung -> Programme und Features (aktivieren/deaktivieren) -> Dienste für NFS (Client/Verwaltung) installieren
* Computer -> (Kontextmenü) Netzwerkadresse hinzufügen
*: <code>\\172.22.99.10\mnt\zroot\storage\rpool</code> eintragen
nfs://172.22.99.10/mnt/zroot/storage/rpool
</source>
=== Samba&nbsp;4 ===
==== Installieren von Samba&nbsp;4 ====
bei Problemen mit Schreibrechten ->
<source lang=bash>
mkdir freebert-nfs
sudo mount -t nfs -o resvport,bg,nfc,nolocks,locallocks,intr,soft,wsize=32768,rsize=3276 172.22.99.10:/mnt/zroot/storage/rpool /Users/<DEIN NAME>/freebert-nfs
</source>
Finder mit ROOT-Rechten!
<source lang=bash>
sudo /System/Library/CoreServices/Finder.app/Contents/MacOS/Finder
</source>
== NFS Import unter Windows (8) ==
<source lang=bash>
Systemsteuerung -> Programme und Features (aktivieren/deaktivieren) -> Dienste für NFS (Client/Verwaltung) installieren
Computer -> (Kontextmenü) Netzwerkadresse hinzufügen
\\172.22.99.10\mnt\zroot\storage\rpool
</source>
== DLNA ==
=== Berechtigungen für DLNA setzen ===
bei Änderungen / Upload bitte ein:
<source lang=bash>
chown 1003:1003: ~/file
</source>
=== Index für Fernseher neu schreiben ===
Um die DB (<code>/var/db/minidlna/files.db</code>) neu zu schreiben muss diese
* gelöscht/überschrieben werden
* während der Service nicht aktiv ist,
* bei Neustart wird sie neu geschrieben (dauert ca. 20min)
Dies wurde hier teilweise durch eine zweite Instanz umgangen.
das Script: unter <code>/usr/local/bin/minidlna_scan</code>:
<source lang=bash>
#!/bin/sh
# simple but buggy
#service minidlna stop
#rm /var/db/minidlna/files.db
#service minidlna start
# should do like that
#configure 2nd service just for rescanning
#start service 2nd instance with another pid
#start for rescanning the filestructure
#stop 2nd service and delete pid
#copy files.db over the existing one
#send sighub to dlna-process to make him use the new files.db
#
### ### ### C3D2 ### ### ###
PID=($(ps -ax | grep "/var/run/minidlna/minidlna_scan.pid -R" | head -1 | awk '{print $1}'))
# stage0
/usr/local/sbin/minidlnad -u dlna -f /usr/local/etc/minidlna_scan.conf -P /var/run/minidlna/minidlna_scan.pid -R
# stage1
### ps -ax | grep "/var/run/minidlna/minidlna_scan.pid -R" | head -1 | awk '{print $1}' | xargs -L 1 kill -9
# stage2
#cp -prfv /var/db/minidlna_scan /var/db/minidlna
# stage3
#pkill -HUP /var/run/minidlna/minidlna.pid
while ps -p ${PID[*]}; do sleep 1; done ; cp -prfv /var/db/minidlna_scan/* /var/db/minidlna/; pkill -HUP /var/run/minidlna/minidlna.pid
### ### ### C3D2 ### ### ###
# EOF
</source>
== Jail: Samba 4 ==
=== Samba4 Installation ===
===== Installieren von Samba4 bei FreeBSD =====
Hinweise:
* Samba 4.1 hat derzeit ein kaputtes s3fs, daher 4.0
<source lang=bash>
cd /usr/ports/net/samba4/ && make install clean
</source>
: <source lang=bash>cd /usr/ports/net/samba4/ && make install clean</source>
@HOST - Samba4 ADS sysvol Kompatibilität per UFS ZVOL
<source lang=bash>
rm -rfv /usr/jails/storage.hq.c3d2.de/var/db/samba4
zfs create -p -V 10g zroot/ezjail/storage.hq.c3d2.de/samba4db
newfs -U -O2 /dev/zvol/zroot/ezjail/storage.hq.c3d2.de/samba4db
mkdir /usr/jails/storage.hq.c3d2.de/var/db/samba4
mount -o acls /dev/zvol/zroot/ezjail/storage.hq.c3d2.de/samba4db /usr/jails/storage.hq.c3d2.de/var/db/samba4
zfs set aclmode=passthrough zroot/ezjail/storage.hq.c3d2.de/rpool
zfs set aclinherit=passthrough zroot/ezjail/storage.hq.c3d2.de/rpool
</source>
: <source lang=bash>rm -rfv /usr/jails/storage.hq.c3d2.de/var/db/samba4</source>
: <source lang=bash>zfs create -p -V 10g zroot/ezjail/storage.hq.c3d2.de/samba4db</source>
: <source lang=bash>newfs -U -O2 /dev/zvol/zroot/ezjail/storage.hq.c3d2.de/samba4db</source>
: <source lang=bash>mkdir /usr/jails/storage.hq.c3d2.de/var/db/samba4</source>
: <source lang=bash>mount -o acls /dev/zvol/zroot/ezjail/storage.hq.c3d2.de/samba4db /usr/jails/storage.hq.c3d2.de/var/db/samba4</source>
: <source lang=bash>zfs set aclmode=passthrough zroot/ezjail/storage.hq.c3d2.de/rpool</source>
: <source lang=bash>zfs set aclinherit=passthrough zroot/ezjail/storage.hq.c3d2.de/rpool</source>
ZVOL auf dem FreeBSD HOST mounten lassen
: <source lang=bash>vi /etc/fstab</source>
<source lang=bash>
vi /etc/fstab
# Device Mountpoint FStype Options Dump Pass#
/dev/gpt/swap0 none swap sw 0 0
#/dev/gpt/swap1 none swap sw 0 0
@ -308,16 +224,17 @@ proc /proc
# EOF
</source>
=== Samba4 Provisionierung ===
==== Provisionieren von Samba4 ====
<source lang=bash>
/usr/local/bin/samba-tool domain provision --use-rfc2307 --use-xattrs=yes --function-level=2008_R2 --realm=HQ.C3D2.DE --domain=HQ --adminpass='geheim' --server-role='dc' --dns-backend=SAMBA_INTERNAL
</source>
* angewendet bei FreeBSD
=== Samba4 Config ===
: <source lang=bash>/usr/local/bin/samba-tool domain provision --use-rfc2307 --use-xattrs=yes --function-level=2008_R2 --realm=HQ.C3D2.DE --domain=HQ --adminpass='geheim' --server-role='dc' --dns-backend=SAMBA_INTERNAL</source>
vi /usr/local/etc/smb4.conf
==== Konfiguration von Samba4 ====
* angewendet bei FreeBSD
: <source lang=bash>vi /usr/local/etc/smb4.conf</source>
<source lang=bash>
### ### ### C3D2 ### ### ###
@ -439,70 +356,119 @@ shadow: snapdir = .zfs/snapshot
# EOF
</source>
==== Samba4 Map Users to thier UNIX UID ====
=== Samba4 Map Users to thier UNIX UID ===
: <source lang=bash>id k-ot</source>
<source lang=bash>
id k-ot
uid=1003(k-ot) gid=1003(k-ot) groups=1003(k-ot)
</source>
samba-tool user add k-ot
: <source lang=bash>samba-tool user add k-ot</source>
<source lang=bash>
New Password:
Retype Password:
User 'k-ot' created successfully
</source>
service samba_server start
: <source lang=bash>service samba_server start</source>
<source lang=bash>
wbinfo --name-to-sid k-ot
S-1-5-21-2260217406-2925069997-4078739481-1108 SID_USER (1)
wbinfo --sid-to-uid S-1-5-21-2260217406-2925069997-4078739481-1108
3000022
</source>
service samba_server stop
ldbedit -e vi -H /var/db/samba4/private/idmap.ldb objectsid=S-1-5-21-2260217406-2925069997-4078739481-1108
: <source lang=bash>service samba_server stop</source>
: <source lang=bash>ldbedit -e vi -H /var/db/samba4/private/idmap.ldb objectsid=S-1-5-21-2260217406-2925069997-4078739481-1108</source>
<source lang=bash>
xidNumber: 1003
# 0 adds 1 modifies 0 deletes
/usr/local/bin/testparm
samba-tool dbcheck
samba-tool ntacl sysvolcheck
</source>
: <source lang=bash>/usr/local/bin/testparm</source>
: <source lang=bash>samba-tool dbcheck</source>
: <source lang=bash>samba-tool ntacl sysvolcheck</source>
== SMB Import unter Linux ==
===== Importieren von SMB bei GNU/Linux =====
<source lang=bash>
sudo apt-get install cifs-utils
: <source lang=bash>sudo apt-get install cifs-utils</source>
sudo mkdir /freebert-storage
: <source lang=bash>sudo mkdir /freebert-storage</source>
sudo mount -t cifs //172.22.99.10/rpool /freebert-storage -o user=k-ot
</source>
== HOST: crontab ==
<source lang=bash>
00 6 * * * root /usr/sbin/chown -R k-ot:k-ot /rpool
</source>
: <source lang=bash>sudo mount -t cifs //172.22.99.10/rpool /freebert-storage -o user=k-ot</source>
== Daten ==
=== Musik ===
=== übliche Arten von Daten auf [[Server/storage|storage]] ===
==== Musik ====
===== Musik für cider =====
[[cider]] nutzt Dateien von [[Server/storage|storage]] [[cider#storage als Quelle|als Quelle]].
=== Filme ===
==== Filme ====
=== andere Dateien ===
==== andere Dateien ====
==== Dateien für Installation von Betriebssystemen ====
===== Dateien für Installation von Betriebssystemen =====
=== Daten bereitstellen ===
==== DLNA ====
===== Berechtigungen für DLNA setzen =====
bei Änderungen / Upload bitte ein:
<source lang=bash>chown 1003:1003: ~/file</source>
===== Index für Fernseher neu schreiben =====
Um die Datenbank (<code>/var/db/minidlna/files.db</code>) neu zu schreiben,
* muss sie gelöscht/überschrieben werden;
* darf der Service nicht aktiv sein;
* braucht es einen Neustart, wobei sie neu geschrieben wird
*: Das dauert zirka 20&nbsp;min bei [[Server/storage|storage]].
.
Dies wurde hier teilweise durch eine zweite Instanz umgangen.
das Script: unter <code>/usr/local/bin/minidlna_scan</code>:
<source lang=bash>
#!/bin/sh
# simple but buggy
#service minidlna stop
#rm /var/db/minidlna/files.db
#service minidlna start
# should do like that
#configure 2nd service just for rescanning
#start service 2nd instance with another pid
#start for rescanning the filestructure
#stop 2nd service and delete pid
#copy files.db over the existing one
#send sighub to dlna-process to make him use the new files.db
#
### ### ### C3D2 ### ### ###
PID=($(ps -ax | grep "/var/run/minidlna/minidlna_scan.pid -R" | head -1 | awk '{print $1}'))
# stage0
/usr/local/sbin/minidlnad -u dlna -f /usr/local/etc/minidlna_scan.conf -P /var/run/minidlna/minidlna_scan.pid -R
# stage1
### ps -ax | grep "/var/run/minidlna/minidlna_scan.pid -R" | head -1 | awk '{print $1}' | xargs -L 1 kill -9
# stage2
#cp -prfv /var/db/minidlna_scan /var/db/minidlna
# stage3
#pkill -HUP /var/run/minidlna/minidlna.pid
while ps -p ${PID[*]}; do sleep 1; done ; cp -prfv /var/db/minidlna_scan/* /var/db/minidlna/; pkill -HUP /var/run/minidlna/minidlna.pid
### ### ### C3D2 ### ### ###
# EOF
</source>
== Log ==
* 10.05.2014 - Samba4 Support