Her er et par linjer til en smb.conf hvis man har behov for at share en mappe uden at der skal være login.
Det kan være praktisk steder hvor lidt større filer skal udveksel mellem forskellige afdelinger som f.eks ikke har adgang til de samme drev.

Denne eksempel er hentet fra et deployment share i et test miljø, hvor folk kan lave unattended installationer fra, hvilket er grunden til  at folk har write access. 

#======================= Global Settings =======================

[global]

####### Authentication #######


       security = user
        map to guest = bad user
        guest account = nobody

 
[Deploy]
   comment = whatever you want to call it
   path = /DeploymentShare
   public = yes
   writable = yes
   printable = no
   create mask = 0777
   directory mask = 0777
   force create mode = 0777
   force directory mode = 0777
   force user = nobody
   force group = nogroup

Man skal tweeke lidt med tftp-hpa hvis man vil have den til at understøtte PxeBoot af Microsoft WinPe som idag er baggrund for installation af alle versioner at M$ Windows klient os og Server os fra en linux box, i mit tilfælde er det en debian box.

Først installer Tftpd-hpa:
 apt-get install tftpd-hpa

Derefter inetd også installeres, hvis man vælger at skriver apt-get install netkit-inetd, får man besked om at der er 2 pakker som dækker over denne virtuelle pakke, nemlig   openbsd-inetd og  inetutils-inetd

Jeg installer derefter normalt openbsd-inetd pakken.
 apt-get install openbsd-inetd

Da windows verdenen bruger \ når linux verden brugere / skal vi have bragt disse 2 ting sammen via en remap file til tftp-hpa, hvilket gøres nemt samtidig med at tftp-hpa daemonen sættes op i  etc/default/tftpd-hpa config filen.
 vi /etc/default/tftpd-hpa
efter jeg har redigeret i filen ser min fil sådan du.
#Defaults for tftpd-hpa
RUN_DAEMON="yes"
OPTIONS="-l -m /var/lib/tftpboot/tftpdremap  -s /var/lib/tftpboot -vvv"

-m /var/lib/tftpboot/trftpremap  angiver remap filen, hvor \ bliver til /
-vvv   sikre at der komme godt med loggin på til syslog sådan at der kan fejlsøges.

Efter dette skal /var/lib/tftpboot/tftpdremap filen dannes
 vi /var/lib/tftpboot/tftpdremap
indsæt følgende tekst.
rg \\ / # Converts backslashes to slashes

Nu mangler der faktisk kun få ting.

Tftp-hpa skal startes.
 /etc/init.d/tftpd-hpa start

Hvis tftpd-hpa køre så bør man se følgende når men køre netstat:
 netstat -uap |grep tftp
udp        0      0 *:tftp                  *:*                                 29961/in.tftpd

Der skal ligges filer ind under /var/lib/tftpboot 
Dhcp serveren skal have informationer omkring PXE opsætningen.
Begge ting som er velbeskrevet på www.howtoforge.com

http://www.howtoforge.com/setting-up-a-pxe-install-server-for-multiple-linux-distributions-on-debian-lenny
http://www.howtoforge.com/install-multiple-linux-distributions-via-pxe-the-easy-way
http://www.howtoforge.com/setting-up-a-pxe-install-server-on-ubuntu-9.10

WinPe delen komme lidt sendere under Windows på denne side, men basalt set gælder det om at lave en korrkt BCD file med BCDedit.exe og placeret filerne i de korrekt mapper.

 


 

 

Overvågning er vigtig hvis man vil sikre sine data, specielt kritisk er det at vide hvordan ens diske har det.
Til dette formål findes SmortMonTools

Installering af SmartMonTools er nem og hurtig.

apt-get install smartmontools

Herefter skal man sikre at ens diske understøtter S.M.A.R.T og dette er enabled.
Denne LinuxServer har 2 Sata diske, derfor køre jeg

smartctl -a /dev/sda

smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Momentus 5400.3
Device Model:     ST9120822AS
Serial Number:    5RM0P9MJ
Firmware Version: 3.ALC
User Capacity:    120.034.123.776 bytes
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   7
ATA Standard is:  Exact ATA specification draft version not indicated
Local Time is:    Mon May 10 18:36:16 2010 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever
                                        been run.
Total time to complete Offline
data collection:                 ( 426) seconds.
Offline data collection
capabilities:                    (0x5b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        No Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        No General Purpose Logging support.
Short self-test routine
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 111) minutes.
SCT capabilities:              (0x0001) SCT Status supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   105   100   006    Pre-fail  Always       -       8715641
  3 Spin_Up_Time            0x0003   099   099   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       697
  5 Reallocated_Sector_Ct   0x0033   100   100   036    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   073   060   030    Pre-fail  Always       -       22244561
  9 Power_On_Hours          0x0032   096   096   000    Old_age   Always       -       3935
 10 Spin_Retry_Count        0x0013   100   100   034    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       225
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   071   057   045    Old_age   Always       -       29 (Lifetime Min/Max 24/29)
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       220
193 Load_Cycle_Count        0x0032   001   001   000    Old_age   Always       -       537324
194 Temperature_Celsius     0x0022   029   043   000    Old_age   Always       -       29 (0 20 0 0)
195 Hardware_ECC_Recovered  0x001a   067   062   000    Old_age   Always       -       56797568
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0
200 Multi_Zone_Error_Rate   0x0000   100   253   000    Old_age   Offline      -       0
202 TA_Increase_Count       0x0032   100   253   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      3575         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

 det samme gøres naturligvis også for sdb, hvilket forhåbentlig giver det samme output.

smartctl -a /dev/sdb

For at få servicen til at køre skal der tilpasset lidt i /etc/default/smartmontools

 vi /etc/default/smartmontools

# uncomment to start smartd on system startup
start_smartd=yes

# uncomment to pass additional options to smartd on startup
smartd_opts="--interval=1800"

Herefter bør man kigge forbi /etc/smartd.conf og sikre at smartmontools sender emails til en konto som overvåget, gør man ikke noget er det Root som vil modtage emails.

 vi /etc/smartd.conf

# The word DEVICESCAN will cause any remaining lines in this
# configuration file to be ignored: it tells smartd to scan for all
# ATA and SCSI devices.  DEVICESCAN may be followed by any of the
# Directives listed below, which will be applied to all devices that
# are found.  Most users should comment out DEVICESCAN and explicitly
# list the devices that they wish to monitor.
DEVICESCAN -m This email address is being protected from spambots. You need JavaScript enabled to view it. -M exec /usr/share/smartmontools/smartd-runner

Tilsidst start smartmontools

/etc/init.d/smartmontools start

Herefter skulle man gerne se noget a'la dette i syslog

tail -n45 /var/log/syslog


May 10 18:35:48 LinuxServer smartd[2909]: smartd version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
May 10 18:35:48 LinuxServer smartd[2909]: Home page is http://smartmontools.sourceforge.net/#012
May 10 18:35:48 LinuxServer smartd[2909]: Opened configuration file /etc/smartd.conf
May 10 18:35:48 LinuxServer smartd[2909]: Drive: DEVICESCAN, implied '-a' Directive on line 22 of file /etc/smartd.conf
May 10 18:35:48 LinuxServer smartd[2909]: Configuration file /etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
May 10 18:35:48 LinuxServer smartd[2909]: Problem creating device name scan list
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sda, opened
May 10 18:35:48 LinuxServer smartd[2909]: Device /dev/sda: using '-d sat' for ATA disk behind SAT layer.
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sda, opened
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sda, found in smartd database.
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sda, is SMART capable. Adding to "monitor" list.
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sdb, opened
May 10 18:35:48 LinuxServer smartd[2909]: Device /dev/sdb: using '-d sat' for ATA disk behind SAT layer.
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sdb, opened
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sdb, found in smartd database.
May 10 18:35:48 LinuxServer smartd[2909]: Device: /dev/sdb, is SMART capable. Adding to "monitor" list.
May 10 18:35:48 LinuxServer smartd[2909]: Monitoring 0 ATA and 2 SCSI devices
May 10 18:35:48 LinuxServer smartd[2912]: smartd has fork()ed into background mode. New PID=2912.
May 10 18:35:48 LinuxServer smartd[2912]: file /var/run/smartd.pid written containing PID 2912
May 10 18:41:00 LinuxServer smartd[2912]: smartd received signal 15: Terminated
May 10 18:41:00 LinuxServer smartd[2912]: smartd is exiting (exit status 0)
May 10 18:41:00 LinuxServer smartd[2941]: smartd version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen
May 10 18:41:00 LinuxServer smartd[2941]: Home page is http://smartmontools.sourceforge.net/#012
May 10 18:41:00 LinuxServer smartd[2941]: Opened configuration file /etc/smartd.conf
May 10 18:41:00 LinuxServer smartd[2941]: Drive: DEVICESCAN, implied '-a' Directive on line 22 of file /etc/smartd.conf
May 10 18:41:00 LinuxServer smartd[2941]: Configuration file /etc/smartd.conf was parsed, found DEVICESCAN, scanning devices
May 10 18:41:00 LinuxServer smartd[2941]: Problem creating device name scan list
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sda, opened
May 10 18:41:00 LinuxServer smartd[2941]: Device /dev/sda: using '-d sat' for ATA disk behind SAT layer.
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sda, opened
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sda, found in smartd database.
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sda, is SMART capable. Adding to "monitor" list.
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sdb, opened
May 10 18:41:00 LinuxServer smartd[2941]: Device /dev/sdb: using '-d sat' for ATA disk behind SAT layer.
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sdb, opened
May 10 18:41:00 LinuxServer smartd[2941]: Device: /dev/sdb, found in smartd database.
May 10 18:41:01 LinuxServer smartd[2941]: Device: /dev/sdb, is SMART capable. Adding to "monitor" list.
May 10 18:41:01 LinuxServer smartd[2941]: Monitoring 0 ATA and 2 SCSI devices
May 10 18:41:02 LinuxServer smartd[2943]: smartd has fork()ed into background mode. New PID=2943.
May 10 18:41:02 LinuxServer smartd[2943]: file /var/run/smartd.pid written containing PID 2943

Vi man have en stabil server er det vigtig at overvåge hardwaren, temperatur er vigtig.
Nogle af disse data er forholdsvis nem at hente ud andre kræver at man installer et par pakker.

installer sensors pakken

apt-get install sensors-applet lm-sensors

Søg efter kende hardware moduler som kan loades i /etc/modules

sensors-detect

svar Yes til de spørgsmål som guiden stiller og lad guiden loade de ekstra moduler til modules filen

Genstart serveren ved først kommende lejlighed.

reboot

Herefter er dette output for mit Intel D945GCLF2D bundkort som hoster denne webside.

sensors

smsc47m192-i2c-0-2d
Adapter: SMBus I801 adapter at 2000
+2.5V:       +2.51 V  (min =  +0.00 V, max =  +3.32 V)   
VCore:       +1.15 V  (min =  +0.00 V, max =  +2.99 V)   
+3.3V:       +3.28 V  (min =  +0.00 V, max =  +4.38 V)   
+5V:         +4.95 V  (min =  +0.00 V, max =  +6.64 V)   
+12V:       +12.31 V  (min =  +0.00 V, max = +15.94 V)   
VCC:         +3.28 V  (min =  +0.00 V, max =  +4.38 V)   
+1.5V:       +1.56 V  (min =  +0.00 V, max =  +1.99 V)   
+1.8V:       +1.77 V  (min =  +0.00 V, max =  +2.39 V)   
Chip Temp:   +36.0°C  (low  = -127.0°C, high = +127.0°C)  
CPU Temp:    +48.0°C  (low  = -127.0°C, high = +127.0°C)  
Sys Temp:    +41.0°C  (low  = -127.0°C, high = +127.0°C)  
cpu0_vid:   +2.050 V

smsc47m1-isa-0680
Adapter: ISA adapter
fan1:       1350 RPM  (min = 1280 RPM, div = 4)
fan2:       4726 RPM  (min = 1280 RPM, div = 4)

Hvorsvært er det nu lige at lave mrtg grafer udfra disse informationer :-)

En lille guide i at lave en PXE installations server.

apt-get install tftpd-hpa dhcp3-server openbsd-inetd

dhcp3-server behøves ev. ikke hvis man har anden dhcp server kørende.

Ændre default/tftpd-hpd til at køre som daemon

vi /etc/default/tftpd-hpa

Ret

RUN_DAEMON="no"

til

RUN_DAEMON="yes"

Start Tftpd-pha daemonen,

/etc/init.d/tftpd-hpa restart

Sikre at daemonen køre

netstat -ul

Output bør være noget a'la

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
udp        0      0 *:45067                 *:*                                
udp        0      0 *:790                   *:*                                
udp        0      0 *:bootpc                *:*                                
udp        0      0 *:tftp                  *:*                                
udp        0      0 *:sunrpc                *:* 

hent sidste version af syslinux, herfra skal vi bruge et par filer lidt senere

cd /usr/src

wget ftp://ftp.kernel.org/pub/linux/utils/boot/syslinux/syslinux-3.86.tar.gz

tar -zxvf syslinux-3.86.tar.gz

cp /usr/src/syslinux-3.86/com32/menu/menu.c32 /var/lib/tftpboot/
cp /usr/src/syslinux-3.86/com32/menu/menu.c32 /var/lib/tftpboot/
cp /usr/src/syslinux-3.86/core/pxelinux.0 /var/lib/tftpboot/

Opret drev struktur for PXE filer.

mkdir -p //var/lib/tftpboot/pxelinux.cfg

mkdir -p /var/lib/tftpboot/debian/5.0.4/i386
mkdir -p /var/lib/tftpboot/debian/5.0.4/amd64

mkdir -p /var/lib/tftpboot/ubuntu/10.4/amd64
mkdir -p /var/lib/tftpboot/ubuntu/10.4/amd64

mkdir -p /tmp/debian

cd /tmp/debian

wget http://ftp.debian.org/debian/dists/Debian5.0.4/main/installer-i386/current/images/netboot/netboot.tar.gz
tar -zxvf netboot.tar.gz
rm netboot.tar.gz

xxxxxxxxxxxxxx   cp -R ./* /var/lib/tftpboot/   xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
cp -R ./* /var/lib/tftpboot/debian/5.0.4/i386/

rm -rf /tmp/debian/*

amd64 installationer.

wget http://ftp.debian.org/debian/dists/Debian5.0.4/main/installer-amd64/current/images/netboot/netboot.tar.gz
tar -zxvf netboot.tar.gz
rm netboot.tar.gz
cp -R ./* /var/lib/tftpboot/debian/5.0.4/amd64/
rm -rf /tmp/debian/*

Opbyg en ordenlig menu struktur

rm /var/lib/tftpboot/pxelinux.cfg/default

vi /var/lib/tftpboot/pxelinux.cfg/default

indsæt

MENU TITLE Net-Help Install Menu


DEFAULT menu.c32
;DEFAULT vesamenu.c32
#PROMPT 0
TIMEOUT 500
ONTIMEOUT local
ALLOWOPTIONS 0
;MENU ROWS 4
MENU WIDTH 80
MENU MARGIN 15
MENU PASSWORDMARGIN 20
MENU TIMEOUTROW 20

LABEL local
MENU LABEL LocalDisk
localboot 0

LABEL Debian
MENU LABEL Debian
KERNEL menu.c32
APPEND pxelinux.cfg/Debian

LABEL Ubuntu
MENU LABEL Ubuntu
KERNEL menu.c32
APPEND pxelinux.cfg/Ubuntu

vi /var/lib/tftpboot/pxelinux.cfg/debian

MENU TITLE Net-Help Debian install menu

LABEL Main
MENU LABEL Main Manu
KERNEL menu.c32
append pxelinux.cfg/default

label install
menu label Debian Lenny I386 install
menu default
kernel debian/5.0.4/i386/debian-installer/i386/linux
append vga=normal initrd=debian/5.0.4/i386/debian-installer/i386/initrd.gz -- quiet

label install
menu label Debian Lenny amd64 install
menu default
kernel debian/5.0.4/amd64/debian-installer/amd64/linux
append vga=normal initrd=debian/5.0.4/amd64/debian-installer/amd64/initrd.gz -- quiet

vi /var/lib/tftpboot/pxelinux.cfg/ubuntu

MENU TITLE Net-Help Ubuntu install menu

LABEL Main
MENU LABEL Main Manu
KERNEL menu.c32
append pxelinux.cfg/default

label install
menu label ubuntu Lucid I386 install
menu default
kernel ubuntu/10.4/i386/debian-installer/i386/linux
append vga=normal initrd=ubuntu/10.4/i386/debian-installer/i386/initrd.gz -- quiet

label install
menu label Ubuntu Lucid amd64 install
menu default
kernel ubuntu/10.4/amd64/debian-installer/amd64/linux
append vga=normal initrd=ubuntu/10.4/amd64/debian-installer/amd64/initrd.gz -- quiet

 Text not compleded..............................