LPI-201
done!
- http://lpic2.unix.nl/index.html
- http://www.nongnu.org/lpi-manuals/manual/pdf/GNU-FDL-OO-LPI-201-0.1.pdf
- http://www.lpi.org/linux-certifications/programs/lpic-2/exam-201/
- http://www.lpice.eu/de/lpi-zertifizierungsinhalte/pruefung-201-lernziele.html
iostat
Debianpaket: sysstat !!
iostat 1 3 iostat -c (cpu info)
vmstat
vmstat 2 2 vmstat INTERVALL COUNT
netstat
netstat -g netstat --groups netstat -i netstat --interfaces netstat -s netstat --statistics netstat -aln --tcp netstat --al --tcp netstat -r --> equals route -e but is available for users
w
w w -s --> short format
free
free free -h
sar
sar -d --> disk statistics sar -b --> I/O and transfer rate statistics sar -c --> system calls sar -p --> paging activity sar -w --> swapping activity sar -r --> memory and swap over time
Steps to identify a bottleneck in the network
1. Create a map of the network 2. Identify time-dependent behaviour 3. Identify the problem 4. Identify deviating behaviour 5. Identify the cause
ps, pstree
ps ef --> BSD style option ps -ef --> UNIX style option ps --ef --> GNU style option
pstree PID
lsof
lsof lsof -F --> output format for C, perl, awk sudo lsof /var/run/tmp sudo lsof +d /var/log --> lists all files and directories at top level
swap
mkswap dd if=/dev/zero of=swapfile bs=1024 count=65535
swapon swapfile /etc/fstab swapon -a
free
cat /proc/meminfo
swapoff /dev/sda3
bzImage / zImage
- Beide sind mit gzip gepackt (nicht bzip2)
- bzImage = Big Zip Image
- Werden unterschiedlich geladen / bzImage kann größer sein
- bzImage --> made zImage obsolate
Kernelversionen
- Gerade Versionsnummer = stable 2.4,2.6,3.0,3.2
- Ungerade Versionsnummer = testing 2.5,2.7,...
uname
uname = uname -s
- -a / --all - alle Parameter
- -n / --nodename - Hostname
- -r / --kernel-release - Versionsnummer (z.B. 3.2.0-25-generic)
- -v / --kernel-version - Erstellungsdatum (z.B. #40-Ubuntu SMP Wed May 23 20:30:51 UTC 2012)
- -m / --machine - Hardwareplattform (z.B. x86_64)
- -p / processor - Prozessorname (z.B. x86_64)
- -i / --hardware-platform - Prozessorfamilie
- -o / --operating-system - Betriebssystem (z.B. GNU/Linux)
unamr -r --> equals /proc/sys/kernel/os-release
201.2 Compiling a kernel
Weight 2
Candidates should be able to properly configure a kernel to include or disable specific features of the Linux kernel as necessary. This objective includes compiling and recompiling the Linux kernel as needed, updating and noting changes in a new kernel, creating an initrd image and installing new kernels.
The kernel configuration file is located at /usr/src/linux/.config
Tarballs entpacken
tar xfvz --> gzip tar xjvf --> bzip2 tar Jxvf --> xz
/usr/src/linux
/usr/src/linux/ --> Symlink to latest kernel src
Module directory
/lib/modules/$(uname -r)/
GRUB configuration files
/etc/grub2/* /boot/grub2/grub.cfg /boot/grub/menu.lst
- grub entry
title=initrd test entry root (hd0,0) kernel /vmlinuz-2.6.28 initrd /initrd
mkinitrd
mkinitrd initrd-image kernel-version --> redhat mkinitrd --version mkinitrd -f mkinitrd --builtin= mkinitd --omit-lvm-modules --omit-raid-modules --omit-scsi-modules
mkinitramfs
mkinitramfs --> debian mkinitramfs -d confir mkinitramfs -k mkinitramfs -o outfile mkinitramfs -r root
create initrd manually
mkblk /dev/ram0 b 1 9 --> was bedeutet MINO MAJOR Nummer? mke2fs -m0 /dev/ram0 300 mount -t ext2 /dev/ram0 /mnt mkdir /mnt/dev mknod /mnt/dev/tty1 c 4 1
- copy needed files
ln -s /bin/sh /mnt/linuxrc umount /dev/ram0 dd if=/dev/ram0 bs=1k count=300 of=/boot/initrd freeramdisk /dev/ram0
make
make clean make mrproper --> best choice make distclean
make options
(config, xconfig, menuconfig, oldconfig, cloneconfig, prepare-all, mrproper zImage, bzImage, modules, modules_install)
make config menuconfig xconfig gconfig oldconfig
yes "" | make oldconfig
make zImage / bzImage make modules make_installke make rpm-pkg make binrpm-pkg make deb-pkg
201.3 Patching a kernel
Weight 1
Candidates should be able to properly patch a kernel to add support for new hardware. This objective also includes being able to properly remove kernel patches from already patched kernels.
Kernel Makefiles
patch
1. place patch file in /usr/src/ 2. cd /usr/src && gunzip / bunzip2 patchfile 3. patch -p1 <patchfile 4. build the kernel
- .rej file is created when the patch can't be applied
patch -R --> reverse to the old file
- alternatively just apply the patch again
gzip
bzip2
201.4 Customise, build and install a custom kernel and kernel modules
Weight 2
Candidates should be able to customise, build and install a 2.6 kernel for specific system requirements, by patching, compiling and editing configuration files as required. This objective includes being able to assess requirements for a kernel compile as well as build and configure kernel modules.
Customize the current kernel configuration
Build a new kernel and appropriate kernel modules
Install a new kernel and any modules
Ensure that the boot manager can locate the new kernel and associated files
/usr/src/linux/
Module configuration files
patch
make
module tools
insmod insmod -s --> write to syslog insmod -v --> verbose mode
rmmod
modprobe modprobe -r --> remove modules
modinfo
/etc/modules.conf --> module parameters
/lib/modules/$(uname -r)/modules.dep
depmod -a