LPIC-2-Scratchpad

From Training Material
Revision as of 17:51, 3 August 2017 by Łukasz Sokołowski (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Nobleprog.svg

LPIC-2-Scratchpad



title
LPIC-2
author


Tytus Kurek (NobleProg)

201.2 Compiling a kernel⌘

LPIC-201-03.png
https://www.lpi.org/linux-certifications/programs/lpic-2/exam-201

Why to compile the kernel?⌘

  • To enable specific drivers / modules
  • To enable experimental features and drivers
  • To modularize the kernel
  • To reduce kernel size
  • To develop kernel modules
  • To reproduce the kernel used by someone else
  • To pick up a girl :)

Kernel compilation and installation⌘

  • Download kernel source code from the official Linux kernel website
  • Extract kernel archive inside the /usr/src directory
  • Configure the kernel using proper make target
  • Compile the kernel into a desired format
  • Compile kernel modules
  • Install kernel modules
  • Install the kernel
  • Create initrd or initramfs
  • Point the bootloader at the new kernel

Make targets⌘

  • make config - configures the kernel using a CLI-base dialog
  • make menuconfig - configures the kernel using a CLI-based menu
  • make xconfig - configures the kernel using a GUI-based menu
  • make oldconfig - configures the kernel using the .config file
  • make - compiles the kernel in the vmlinux format
  • make zimage - compiles the kernel in the zImage form
  • make bzimage - compiles the kernel in the bzImage format
  • make modules - compiles kernel modules
  • make modules_install - installs kernel modules into the /lib/modules/ directory
  • make mrproper - restores the build directory to its original state

Initrd and Initramfs⌘

  • INITRD (INITial Ram Disk):
    • initrd.img-[kernel version]
    • image containing temporary file system binaries
    • loaded into memory (/dev/ram device) during the boot process and mounted as an initial root filesystem
    • contains programs necessary for hardware detection, kernel modules loading and hardware detection
  • INITRAMFS (INITial RAM FileSystem):
    • initramfs.img-[kernel version]
    • cpio archive fulfilling the same functions as initrd, but omitting some of its limitations
  • Management tools:
    • mkinitrd - creates initrd
    • mkinitramfs - creates initramfs
  • Lab Exercise 201.2

204.3 Logical Volume Manager⌘

LPIC-201-02.png
https://www.lpi.org/linux-certifications/programs/lpic-2/exam-201

General concept and basic terms⌘

  • LVM structure:
    • Physical Volume - physical block device (e.g. partition, disk, RAID device)
    • Volume Group - virtual container consisting of one or more Physical Volumes
    • Logical Volume - virtual block device provided by the Volume Group
  • Device Mapper - kernel driver which passes data from virtual device to block device
  • /dev/mapper - contains files of virtual devices provided by the Device Mapper
  • lvm2 - package containing LVM binaries and libraries

Physical Volume management tools⌘

  • pvcreate - initializes a Physical Volume on the physical device
  • pvremove - removes the Physical Volume
  • pvdisplay - displays Physical Volume's attributes
  • pvchange - changes Physical Volume's attributes
  • pvs - displays Physical Volume's information
  • pvresize - changes size of the Physical Volume
  • pvscan - scans all system devices for Physical Volumes
  • pvmove - moves physical extents from one Physical Volume to another

Volume Group management tools⌘

  • vgcreate - creates a Volume Group from the Physical Volumes
  • vgremove - removes the Volume Group
  • vgdisplay - displays Volume Group's attributes
  • vgchange - changes Volume Group's attributes
  • vgrename - changes name of the Volume Group
  • vgs - displays Volume Group's information
  • vgextend - adds a Physical Volume to the Volume Group
  • vgreduce - removes a Physical Volume from the Volume Group
  • vgscan - scans all system devices for Volume Groups
  • vgmerge - merges two separate Volume Groups into a single Volume Group
  • vgsplit - splits the Volume Group into two separate Volume Groups

Logical Volume management tools⌘

  • lvcreate - creates a Logical Volume from the Volume Group
  • lvremove - removes the Logical Volume
  • lvdisplay - displays Logical Volume's attributes
  • lvchange - changes Logical Volume's attributes
  • lvrename - changes name of the Logical Volume
  • lvresize - changes size of the Logical Volume
  • lvs - displays Logical Volume's information
  • lvextend - extends size of the Logical Volume
  • lvreduce - reduces size of the Logical Volume
  • lvscan - scans all system devices for Logical Volumes
  • Lab Exercise 204.3

205.1 Basic networking configuration⌘

LPIC-201-01.png
https://www.lpi.org/linux-certifications/programs/lpic-2/exam-201

Network interfaces configuration⌘

  • Configuration files:
    • /etc/network/interfaces - on Debian systems
    • /etc/sysconfig/network-scripts/ifcfg-[interface name] - on RedHat systems
  • Configuration tools:
    • ifconfig - network interface configuration tool
    • ifup - brings network interface up
    • ifdown - brings network interface down
  • Supporting tools"
    • arp - displays ARP table

Wireless network interfaces configuration⌘

  • Wireless network specific parameters:
    • ESSID - wireless network name
    • PSK - pre-shared key
    • frequency, channel, modulation, etc.
  • Configuration files:
    • /etc/wpa_supplicant/wpa_supplicant.conf - wpa_supplicant configuration file
  • Configuration tools:
    • iwconfig - wireless network interface configuration tool
    • iwlist - displays parameters of wireless network interfaces
  • Most often configured via Desktop environment

Routing configuration⌘

  • Manual:
    • route command:
route add -net [network IP] netmask [SM] gw [next hop IP] [interface name]
    • ip route command:
ip route add [network IP / SM] via [next hop IP] dev [interface name]
  • Via configuration files:
    • Debian (/etc/network/interfaces):
up [manual command]
    • RedHat (/etc/sysconfig/network-scripts/route-[interface name]):
[network IP/ SM] via [next hop IP] dev [interface name]
  • Lab Exercise 205.1