Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
notes:lpic-1_notes [2014/02/09 22:24] smthng |
notes:lpic-1_notes [2014/03/03 01:49] (current) smthng [102 Installation and Package Management 18%] |
||
---|---|---|---|
Line 16: | Line 16: | ||
* Conceptual understanding of sysfs, udev, hald, dbus | * Conceptual understanding of sysfs, udev, hald, dbus | ||
* Terms: /sys, /proc, /dev, modprobe, lsmod, lspci, lsusb | * Terms: /sys, /proc, /dev, modprobe, lsmod, lspci, lsusb | ||
+ | |||
+ | == Notes == | ||
+ | |||
+ | * BIOS - Basic I/O System - systim init, memory testing, low-level system-config, | ||
+ | * /proc fs is kernel' | ||
+ | * Universal Serial Bus (USB) | ||
+ | * //lsusb [-t] [-vv] // - t-tree view, vv-very verbose | ||
+ | * Open Host Controller Interface (OHCI) - USB 1.1 | ||
+ | * Universal Host Controller Interface (UHCI) - USB 1.1 - 12 MBps - low+full speed | ||
+ | * Enhanced Host Controller Interface (EHCI) - USB 2.0 - 480 MBps - high speed | ||
+ | * Extensible Host Controller Interface (XHCI) - USB 3.0 - 4 GBps - super speed | ||
+ | * Wireless Host Controller Interface (WHCI) - Wireless USB 1.0 - 480 MBps | ||
+ | * Effective speed is lowest speed of device, cable and hub | ||
+ | * Classes of USB devices : | ||
+ | * Human Interface Device (HID) - Input devices: mice, keyboards, etc.) | ||
+ | * Communications device - Modems | ||
+ | * Mass storage device - Disk devices, flash readers, etc. | ||
+ | * Audio - Sound devices | ||
+ | * IrDA - Infrared devices | ||
+ | * Printer - Printers and USB-to-parallel cables | ||
+ | * Linux kernel supported USB in v2.3.x, backported to 2.2.18 | ||
+ | * Linux drivers may be host controller drivers (e.g. usb-ohci.o), | ||
+ | * usbcore.o -> host controller driver -> class/ | ||
+ | * Modularized USB drivers are loaded by the generic / | ||
+ | * //lsdev// - shows hardware including IRQ info, I/O ports and DMA channels | ||
+ | * //lspci [-t] [-vv]// - info about system’s PCI buses and installed PCI devices | ||
+ | * A module is dynamically linked into the running kernel when it is loaded | ||
+ | * // | ||
+ | * //modprobe [-r] [-a] [-t type]// - list, insert or remove modules. Does dependency checking. | ||
+ | * //lsmod// - list modules //modinfo module-object-file.o// | ||
+ | * sysfs is a RAM-based filesystem derived from ramfs. It provides a means to export kernel data structures to user space. // mount -t sysfs sysfs /sys// | ||
+ | * The udev process uses sysfs info to create dynamic device files as kernel modules are loaded. /etc/udev.d holds rules to be applied when adding or removing a device. | ||
+ | * D-Bus is an IPC system that uses sysfs to implement a message bus daemon used for broadcasting system events e.g.“new device added” or “printer queue changed”. | ||
+ | * hal was a hw abstraction layer (hw access API) on top of udev using D-Bus. It has been deprecated and rolled into udev and the kernel. | ||
=== 101.2 Boot the System (LCN-4 CTL-5) === | === 101.2 Boot the System (LCN-4 CTL-5) === | ||
Line 22: | Line 56: | ||
* Check boot events in the log file | * Check boot events in the log file | ||
* Terms: / | * Terms: / | ||
+ | |||
+ | == Notes == | ||
+ | * Boot Loader (LILO or GRUB) launches the linux kernel, passing kernel parameters if needed (/ | ||
+ | * Module options (as well as aliases and post-install and pre-remove actions) are stored in / | ||
+ | * //dmesg// displays kernel messages logged at last system boot. | ||
+ | * // / | ||
=== 101.3 Change runlevels and shutdown or reboot system (LCN-4 CTL-5) === | === 101.3 Change runlevels and shutdown or reboot system (LCN-4 CTL-5) === | ||
Line 31: | Line 71: | ||
* Knowledge of basic features of systemd and Upstart | * Knowledge of basic features of systemd and Upstart | ||
* Terms: / | * Terms: / | ||
- | < | + | |
+ | == Notes == | ||
+ | * When linux boots, first process is the //init// process which selects and switches to default runlevel. | ||
+ | * Runlevels - 0=shutdown, 1/ | ||
+ | * On Debian, 2 is default and 3,5 are not used. On Redhat, 3 is the default. | ||
+ | * /etc/rc script to change runlevels on redhat (also init/ | ||
+ | * / | ||
+ | * / | ||
+ | * /etc/init.d contains startup/ | ||
+ | * /etc/rc0.d - /etc/rc6.d contain softlinks KNNservice or SNNservice specifying whether to start or stop services and in what order for that runlevel (done by init process). Kills done before starts. | ||
+ | * / | ||
+ | * // | ||
+ | * //shutdown [options] time [warning message]// | ||
==== 102 Installation and Package Management 18% ==== | ==== 102 Installation and Package Management 18% ==== | ||
Line 40: | Line 92: | ||
* Knowledge of basic features of LVM | * Knowledge of basic features of LVM | ||
* Terms: / (root) filesystem, /var filesystem, /home filesystem, swap space, mount points, partitions | * Terms: / (root) filesystem, /var filesystem, /home filesystem, swap space, mount points, partitions | ||
+ | |||
+ | ==Notes== | ||
+ | |||
+ | * choosing a disk layout for linux depends on amount of disk space, purpose of the system, size of the system and backup strategy. Some general guidelines are | ||
+ | * If diskspace is limited, just /boot, / and /swap | ||
+ | * /boot is a separate 50MB partition because older kernels/ | ||
+ | * For larger systems keep / smaller/ | ||
+ | * Can use separate partitions for /var (to isolate system logs), /tmp (to isolate tempfiles), /home (for backup and RAIDing of user's data) | ||
+ | * Using a separate partition for /usr allows it to be shared via read-only NFS which allows for saving space and easier maintenance of apps/ | ||
+ | * Superblock on filesystem contains critical metadata so multiple redundant copies are kept. | ||
+ | * Filesystems must be mounted (listed in filesystem table) before being accessible. /etc/fstab is a list of filesystems to mount on boot up. | ||
+ | * Master Boot Record on first 512 bytes of first sector of disk contains info on partitions and bootup. Can be backed up and restored with < | ||
+ | dd if=/dev/hda of=~/ | ||
+ | dd if=~/ | ||
+ | </ | ||
+ | * To backup/ | ||
+ | sfdisk -d /dev/hda > partition_backup.txt | ||
+ | sfdisk /dev/hda < partition_backup.txt | ||
+ | </ | ||
+ | * Linux may also be booted from Live USB which allows for persistent modifications. If the BIOS does nto support this, a bootable CD can be used first. | ||
+ | * Swap space allows main memory to be temporarily copied to disk. As a starting point set swap to twice the memory size (at least the same size). | ||
=== 102.2 Install a boot manager (LCN-5 CTL-5) === | === 102.2 Install a boot manager (LCN-5 CTL-5) === | ||
Line 47: | Line 120: | ||
* Interact with the boot loader | * Interact with the boot loader | ||
* Terms: / | * Terms: / | ||
+ | |||
+ | ==Notes== | ||
+ | * BIOS looks for and runs boot loader from first specified boot device. | ||
+ | * Boot loader find and loads specified kernel (with specified kernel options) which loads required modules and starts system processes. | ||
+ | * LILO is a 2-stage program | ||
+ | * First stage is in 512-byte MBR or in the boot sector of a partition (if it is a secondary boot loader). | ||
+ | * Second stage is in / | ||
+ | * Map file locating kernel is in /boot/map | ||
+ | * //lilo// command reads / | ||
+ | * GRUB is a multi-stage boot loader, more flexible than LILO. | ||
+ | * Changes take effect immediately. | ||
+ | * (hd0,1) -> 2nd partition on the 1st hard disk. Refers only to the order of the disks as seen by the BIOS so order may change if BIOS boot order is changed. | ||
+ | * // | ||
+ | * Grub command-line expects a specific order of commands to boot kernel < | ||
+ | grub> kernel / | ||
+ | grub> initrd / | ||
+ | grub> boot</ | ||
=== 102.3 Manage shared libraries (LCN-5 CTL-2) === | === 102.3 Manage shared libraries (LCN-5 CTL-2) === | ||
Line 53: | Line 143: | ||
* Load shared libraries | * Load shared libraries | ||
* Terms: ldd, ldconfig, / | * Terms: ldd, ldconfig, / | ||
+ | |||
+ | ==Notes== | ||
+ | * Most programs on Linux use common system libraries. | ||
+ | * These can be statically linked into the program at compile-time - more disk, more memory, slower. | ||
+ | * Or can be dynamically loaded at runtime (shared libraries) - shared memory, smaller disksize, faster. | ||
+ | * //ldd// can be used to display required shared libraries for an executable | ||
+ | * Dynamically linked executables are examined at runtime by the shared object dynamic linker, //ld.so// | ||
+ | * // | ||
+ | * $LD_LIBRARY_PATH env variable can also be used | ||
=== 102.4 Use Debian package management (LCN-5 CTL-2) === | === 102.4 Use Debian package management (LCN-5 CTL-2) === | ||
Line 59: | Line 158: | ||
* Obtain package information like version, content, dependencies, | * Obtain package information like version, content, dependencies, | ||
* Terms: / | * Terms: / | ||
+ | |||
+ | ==Notes== | ||
+ | * .deb package names - pkgname_version-revision_arch.deb . version is typically major.minor.patchlevel e.g ncurses4_4.2.3-9_i386.deb | ||
+ | * //dpkg// operates directly on //.deb// packages | ||
+ | * uses / | ||
+ | * -i=install -r=remove --purge=purge | ||
+ | * -E=do not overwrite with same version or older | ||
+ | * -G=do not overwrite with older package version | ||
+ | * -l=list matching installed packages -L=list files from package | ||
+ | * -s=status of package -S=search for file in installed packages | ||
+ | * //apt-get// uses package names and sources and resolves dependencies | ||
+ | * -d=download only -s=simulate -y=assume yes | ||
+ | * install, remove, update (sources), upgrade (all packages), dist-upgrade (to new OS version) | ||
+ | * uses / | ||
+ | * //dselect// is a menu-based interface to //dpkg// | ||
+ | * //alien// converts other package types to .deb packages (or to rpm with -r) e.g. Slackware/ | ||
=== 102.5 Use RPM and YUM package management (LCN-5 CTL-2) === | === 102.5 Use RPM and YUM package management (LCN-5 CTL-2) === | ||
Line 65: | Line 180: | ||
* Determine what files a package provides, as well as find which package a specific file comes from | * Determine what files a package provides, as well as find which package a specific file comes from | ||
* Terms: rpm, rpm2cpio, / | * Terms: rpm, rpm2cpio, / | ||
- | |||
==== 103 GNU / Unix Commands 43% ==== | ==== 103 GNU / Unix Commands 43% ==== | ||