Basis Linux (aan de hand van LPIC-1)

Embed Size (px)

DESCRIPTION

Bijna iedereen die wel eens op de command line dingen uitvoert, kent wel een paar Linux commando's. Deze presentatie behandelt de Linux basiskennis aan de hand van de LPIC-1 examenstof (volgens opbouw van "LPI Certification in a Nutshell"): Topic 101: System Architecture & Topic 102: Linux Installation and Package Management LPIC-1 is een certificaat dat wordt uitgegeven door Linux Professional Institute (LPI) en waarmee je jouw Linux kennis in de arbeidsmarkt kunt aantonen. http://www.linuxnijmegen.nl/bijeenkomsten/31-lugn18-dinsdag-11-februari-2014

Citation preview

  • 1. Basis Linux (aan de hand van LPIC-1) Peter Martin, twitter: @pe7er Linux User Group Nijmegen, 11 februari 2014

2. Overzicht Presentatie Introductie Topic 101: System Architecture Topic 101.1101.3 Topic 102: Linux Installation and Package Management Topic 102.1102.5 3. LPIC-1 Junior Level Linux Certification Basisvaardigheden Linux: Werken op de command line Eenvoudige onderhoudstaken uitvoeren: gebruikers ondersteunen, gebruikers toevoegen aan systeem, backup & restore, shutdown & reboot Installeren en configureren van een werkstation (incl. X) en aan LAN netwerk verbinden, of stand-alone PC via modem aan het Internet. Distributie onafhankelijk Gecertificeerd door National Commission For Certifying Agencies 4. Exam 101 + Exam 102 = LPIC-1 certificaat 5. LPIC-1 Exam 101 Topic 101: System Architecture Topic 102: Linux Installation and Package Management Topic 103: GNU and Unix Commands Topic 104: Devices, Linux Filesystems, Filesystem Hierarchy Standard 6. LPIC-1 Exam 102 Topic 105: Shells, Scripting and Data Management Topic 106: User Interfaces and Desktops Topic 107: Administrative Tasks Topic 108: Essential System Services Topic 109: Networking Fundamentals Topic 110: Security 7. Topic 101 + 102 van Exam 101 Topic 101: System Architecture 101.1 Determine and configure hardware settings 101.2 Boot the system 101.3 Change runlevels and shutdown or reboot system Topic 102: Linux Installation and Package Management 102.1 Design hard disk layout 102.2 Install a boot manager 102.3 Manage shared libraries 102.4 Use Debian package management 102.5 Use RPM and YUM package management 8. Topic 101: System Architecture 9. 101.1 Determine and configure hardware settings 10. 101.1 Determine and configure hardware settings (w-2) Candidates should be able to determine and configure fundamental system hardware. Key Knowledge Areas: Enable and disable integrated peripherals. Configure systems with or without external peripherals such as keyboards. Differentiate between the various types of mass storage devices. Set the correct hardware ID for different devices, especially the boot device. Know the differences between coldplug and hotplug devices. Determine hardware resources for devices. Tools and utilities to list various hardware information (e.g. lsusb, lspci, etc.) Tools and utilities to manipulate USB devices Conceptual understanding of sysfs, udev, hald, dbus Terms and Utilities: /sys /proc /dev modprobe lsmod lspci lsusb 11. 101.1 Determine and configure hardware settings (w-2) Opstarten van PC + besturingssysteem: BIOS Basic Input/Output System Power On Self Test (POST) Datum/tijd Configuratie (boot order) Inladen bootroutine Master Boot Record (MBR) Inladen boot manager (Lilo/Grub) Inladen van kernel Aanmaken RAM disk voor init Inladen van allerlei software 12. 101.1 Determine and configure hardware settings (w-2) HAL - Hardware Abstraction Layer (aka hald HAL daemon) Intel Centrino Advanced-N 6200 wlan0 dbus D-Bus = inter-process communication (IPC) system. Voornamelijk communicatie tussen componenten van Gnome, KDE, XFCE udev automatic hardware discovery and initialization device manager voor Linux kernel mounten van /dev/sda1 als bijv /dev/camera 13. 101.1 Determine and configure hardware settings (w-2) Sysfs = virtual filesystem = ~ system filesystem /sys HALs database Procfs = proc filesystem = over processes /proc Device File = interface for device driver that appears in a file system as if it were an ordinary file. /dev /dev/null /dev/random 14. 101.1 Determine and configure hardware settings (w-2) ls list files lsmod = list kernel modules lsusb = list usb devices lspci = list pci devices 15. 101.2 Boot the system 16. 101.2 Boot the system (w-2) Candidates should be able to guide the system through the booting process. Key Knowledge Areas: Provide common commands to the boot loader and options to the kernel at boot time. Demonstrate knowledge of the boot sequence from BIOS to boot completion. Check boot events in the log files. Terms and Utilities: /var/log/messages dmesg BIOS bootloader kernel init 17. 101.2 Boot the system (w-2) BIOS bootloader (GRUB / lilo) kernel init Tijdens opstarten ESC -> bootmenu: Opstart optie (kernel) kiezen Eventuele kernel modules inladen Parameters editen (e) o.a. runlevel /boot/ Kernel: vmlinuz-3.2.0-4-amd64 init ram disk: initrd.img-3.2.0-4-amd64 18. 101.2 Boot the system (w-2) init = initialization pstree commando Sys V sysvinit upstart (Ubuntu 8.10) Systemd Boot events in log files: /var/log/dmesg logt totdat RAM disk wordt gestart dmesg info live van RAM disk /var/log/messages algemene systeem activiteiten 19. 101.3 Change runlevels and shutdown or reboot system 20. 101.3 Change runlevels and shutdown or reboot system (w-3) Candidates should be able to manage the runlevel of the system. This objective includes changing to single user mode, shutdown or rebooting the system. Candidates should be able to alert users before switching run level and properly terminate processes. This objective also includes setting the default run level. It also includes basic feature knowledge of potential replacements to init. Key Knowledge Areas: Set the default runlevel. Change between run levels including single user mode. Shutdown and reboot from the command line. Alert users before switching runlevels or other major system event. Properly terminate processes. Knowledge of basic features of systemd and Upstart Terms and Utilities: /etc/inittab shutdown init /etc/init.d telinit 21. 101.3 Change runlevels and shutdown or reboot system (w-3) Runlevels manier om systeem verschillend te gebruiken. Runlevel bepaalt wat wel/niet wordt ingeladen /etc/inittab -> configuratie van runlevels & init process runlevels verschillen tussen distros! 0 Halt 1 single user mode (recovery) 2 .deb default (GUI/txt) 3 .rpm txt 4 wildcard (kun je zelf bepalen) 5 .rpm GUI 6 Reboot 22. 101.3 Change runlevels and shutdown or reboot system (w-3) /etc/init.d/ -> scripts om services te laden bijv /etc/init.d/exim4 status / stop / start /etc/rc.d/ bevat folders met scripts voor runlevels rc.local bij elke runlevel rc.sysinit bij elke runlevel /etc/rc.d/rc1.d scripts voor runlevel 1 (single user recover mode) Symbolic links naar scripts (Kill, Start) /etc/rc.d/rc2.d scripts voor runlevel 2 (debian default) Symbolic links naar scripts 23. 101.3 Change runlevels and shutdown or reboot system (w-3) Wisselen tussen runlevels: $ sudo init [runlevel nummer] telinit = init Shutdown / reboot shutdown -r now nu reboot shutdown -h +5 over 5 minuten shutdown shutdown -h 23:55 Some system maintenance message 24. Topic 102: Linux Installation and Package Management 25. 102.1 Design hard disk layout 26. 102.1 Design hard disk layout (w-2) Candidates should be able to design a disk partitioning scheme for a Linux system. Key Knowledge Areas: Allocate filesystems and swap space to separate partitions or disks. Tailor the design to the intended use of the system. Ensure the /boot partition conforms to the hardware architecture requirements for booting. Knowledge of basic features of LVM Terms and Utilities: / (root) filesystem /var filesystem /home filesystem swap space mount points partitions 27. 102.1 Design hard disk layout (w-2) Partitions / disks Filesystems Mount points mount /etc/fstab = file systems table, o.a. mountpoints bij startup SWAP space Superblock = meta info over filesysteem, soort FAT MBR Master Boot Record LVM logical volume manager for Linux kernel that manages disk drives and similar mass-storage devices volgens 3rd editie nog geen deel van examen 28. 102.1 Design hard disk layout (w-2) Opzet van Harddisk afhankelijk van: Grootte van diskruimte Grootte van het systeem Gebruik van systeem Hoe & waar backups 29. 102.1 Design hard disk layout (w-2) Desktop /boot/ 100MB swap (not mounted) swap size = 2x RAM Network workstation / /boot/ /home/ ->NFS, SMB, SSH. Elke gebruiker eigen /home/subfolder/ swap (not mounted) Server / /boot/ /home/ /opt/ /usr/ bijv /usr/bin/apache -> zelfde versie voor alle gebruikers /var/ swap (not mounted) 30. 102.2 Install a boot manager 31. 102.2 Install a boot manager (w-2) Candidates should be able to select, install and configure a boot manager. Key Knowledge Areas: Providing alternative boot locations and backup boot options. Install and configure a boot loader such as GRUB Legacy. Perform basic configuration changes for GRUB 2. Interact with the boot loader Terms and Utilities: /boot/grub/menu.lst grub-install MBR superblock 32. 102.2 Install a boot manager (w-2) Lilo (Linux Loader) bootloader & command Grub (GRand Unified Bootloader) /boot/grub/menu.lst (grub1) /boot/grub/grub.cfg (grub2) Grub-install MBR backup -> 1e hd bepalen $ mount Bit-voor-bit copy dmv disk dump: $ sudo dd if=/dev/sda of=/root/backup.mbr bs=512 count=1 33. 102.3 Manage shared libraries 34. 102.3 Manage shared libraries (w-1) Candidates should be able to determine the shared libraries that executable programs depend on and install them when necessary. Key Knowledge Areas: Identify shared libraries Identify the typical locations of system libraries Load shared libraries Terms and Utilities: ldd ldconfig /etc/ld.so.conf LD_LIBRARY_PATH 35. 102.4 Use Debian package management 36. 102.4 Use Debian package management (w-3) Candidates should be able to perform package management using the Debian package tools. Key Knowledge Areas: Install, upgrade and uninstall Debian binary packages. Find packages containing specific files or libraries which may or may not be installed. Obtain package information like version, content, dependencies, package integrity and installation status (whether or not the package is installed). Terms and Utilities: /etc/apt/sources.list dpkg dpkg- reconfigure apt-get apt-cache aptitude 37. 102.5 Use RPM and YUM package management 38. 102.5 Use RPM and YUM package management (w-3) Candidates should be able to perform package management using RPM and YUM tools. Key Knowledge Areas: Install, re-install, upgrade and remove packages using RPM and YUM. Obtain information on RPM packages such as version, status, dependencies, integrity and signatures. Determine what files a package provides, as well as find which package a specific file comes from. Terms and Utilities: rpm rpm2cpio /etc/yum.conf /etc/yum.repos.d/ yum yumdownloader 39. Vragen? Peter Martin e-mail: info at db8.nl website: www.db8.nl twitter: @pe7er 40. Used Photos Penguin - Priit Kallas http://www.sxc.hu/photo/361999 note paper - ilker http://www.sxc.hu/photo/1266532 Motherboard 4 - Lisa Zanchi http://www.sxc.hu/photo/103914 power button - "gerard79" http://www.sxc.hu/photo/1009485 Runners - Meeting - Christophe Libert http://www.sxc.hu/photo/618947 hard disk - ilker http://www.sxc.hu/photo/1144734 Boys old boots with lace undone - Katerina Chuchuva http://www.sxc.hu/photo/1243521 lots of files 2 - Michael & Christa Richert http://www.sxc.hu/photo/1370555 Sparks - Hector Landaeta http://www.sxc.hu/photo/1184243 Fragile Parcel - Richard Dudley http://www.sxc.hu/photo/1279274