Download - Intel Day1

Transcript
  • 8/2/2019 Intel Day1

    1/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    Red Hat Linux

    Administration & ProgrammingIntel, Portland, OR

    Jan 16-19 2012

    2

    Content

    Linux History

    Distributions

    Linux and Unix

    Installation

    System Initialization

    File system

    Management

    Booting Linux

    Graphical Desktops

    Command Line

    Linux-Administration

  • 8/2/2019 Intel Day1

    2/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    3

    Unit 1: History Linux Is Not UniX

    Developed by Linus Torvalds

    8/25/1991

    Based on Minix, a Unix clone

    Free to use, install & modify Based on GNU tools

    Licensed under GNU GPL

    Linux-Administration

    4

    What Could You Do With Linux?

    VPN link to remote site

    Linux

    Web server

    Linux

    router

    Linux mail server

    Linux print server

    for UNIX clients

    Linux DHCP

    server

    Linux

    FTP server

    Linux

    NFS file server

    NIS server

    DNS server

    Linux

    firewall

    Linux

    VPN gateway

    Linux file and

    print server for

    Windows clientsTo the

    Internet

    Linux

    DataBase

    Linux

    Application

    serverLinux-Administration

  • 8/2/2019 Intel Day1

    3/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    5

    What Can You Do With Linux?

    Linux Tablets

    & Readers

    Linux Cloud Services

    Linux

    Gaming

    Linux Android for

    Mobile Phones

    Linux Arduino

    Linux-Administration

    Linux-Administration 6

    Linux Operating System

    Linux

    kernel

    GNU tools,

    compiler,

    libraries

    X graphics :

    KDE GNOME

    Other:

    Apache, Database,

    Multimedia

    Linux

    operating

    system

  • 8/2/2019 Intel Day1

    4/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    Linux-Administration 7

    The GNU System Free Software Foundation: FSF.ORG

    Objectives were to create freely distributable

    UNIX tools

    Software should be free from patents & commercial

    ownership

    GNU provides many UNIX commands & useful

    applications

    Linux-Administration 8

    The Linux Kernel Began as Linus Torvalds personal project to

    Run a UNIX-like operating system on an i386 PC

    Offered as FREE to use & modify (GPL)

    Version 0.02 was made public on Oct 1991

    www.Kernel.org

    Linux was originally written forIntel processorsbut now supports over 30 processors!

  • 8/2/2019 Intel Day1

    5/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    Linux-Administration 9

    X11A powerful networked graphical environment Developed at MIT, freely distributable

    X.org - complete implementation of X based on

    the X11R7.6 standard

    Servers typically do not require graphics

    Some useful system administration tools are

    graphical

    X graphical tools can be run on a server anddisplayed remotely

    MIT = Massachusetts Institute of Technology

    Linux-Administration 10

    Other Linux Applications UNIX software packages have been ported

    Korn Shell, emacs, zip, chkconfig

    Many server components are generic UNIX

    software: Apache, sendmail, BIND, Samba

    Free implementations of commercial applications

    OpenSSH, OpenMotif, GNUPG

    Internationalization

    Multiple languages

    Unicode support!

  • 8/2/2019 Intel Day1

    6/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    Linux-Administration 11

    Hardware Utilization Linux runs without problems on older

    computers

    Linux works well on high-performance

    modern hardware

    Linux can run on many embedded systems!

    https://openwrt.org

    http://arduino.org

    Linux-Administration 12

    Security Linux supports many security features

    UNIX security to control access resources

    Pluggable Authentication Modules (PAMs)

    Kerberos

    Firewall protection for the Internet

    IPsec

    Hardened shared libraries

    Downloaded software can be verified for

    authenticityIPsec = IP security

  • 8/2/2019 Intel Day1

    7/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    Linux-Administration 13

    Low Cost Linux & most Linux software are free Commercial software for Linux is low cost (or free)

    Often no need to purchase new hardware

    Software updates are also free (or low cost)

    Support by distributors and other organizations

    available at reasonable cost

    Enterprise Linux provides the reliability and

    support of commercial UNIX at a reasonable price FREE as in FREEDOM!

    14

    Classic Linux Distributions

    Red Hat (Fedora)

    Suse (Novell)

    Debian

    Knoppix

    Slackware

    Linux-Administration

  • 8/2/2019 Intel Day1

    8/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    15

    Popular Linux Distributions Ubuntu

    Mint

    CentOS

    Puppy

    http://distrowatch.com

    Linux-Administration

    Linux-Administration 16

    Linux Distrubution

    Linux

    kernel

    GNU tools,

    compiler,

    libraries

    X graphics :

    KDE GNOME

    Other:

    Apache, Database,

    Multimedia

    Linux

    operating

    system +

    Installation tools,

    configuration tools,

    Support, Applications

    Red

    Hat

    Debian

    SUSE

  • 8/2/2019 Intel Day1

    9/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day

    Linux-Administration 17

    What Is a Linux Distribution?A Linux distribution is:

    A preconfigured kernel

    GNU utilities

    X graphical environment (KDE, GNOME)

    Other generic software components

    Distributor-specific installation & configuration

    Support

    Linux-Administration 18

    Red Hat

    Worlds leading open source application platform

    Started as a consumer distribution in NC

    After 10 years it decided to focus on the enterprise

    Red Hat Enterprise Linux (www.redhat.com/rhel)

    18-24 month release cycle

    Purchased with one year Red Hat Network / support contract

    CLIENT or SERVER versions

    Fedora (fedoraproject.org)

    Updates every 6 months

    Unsupported, community based

    Red Hat

  • 8/2/2019 Intel Day1

    10/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 19

    Red Hat Products

    Linux-Administration 20

    Red Hat Network

    Provides software updates (up to 7 years)

    Management & Monitoring Modules

    Extended capabilities for large deployments

    Provisioning Module

    Bare-metal installation, configuration

    management, & multi-state

  • 8/2/2019 Intel Day1

    11/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 21

    Red Hat Installation Installer

    Multi-tasking Linux

    Anaconda, a python script

    Source

    CD, DVD, USB drive

    Network: FTP, NFS, HTTP

    Kickstart file simplifies similar installs

    Linux-Administration 22

    Package Manager: RPM

    Red Hat Package Manager has:

    Compiled or Source Software

    Documentation & program help

    Installation / un-install scripts

    Its classified by group or family

    Disadvantage: dependencies

  • 8/2/2019 Intel Day1

    12/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 23

    Package Manager: YUM Newer Red Hat versions use: YUM

    Solves Dependencies

    Can have multiple repositories

    One click Update of:

    Operating System

    Applications

    Utilities

    Linux-Administration 24

    Running Commands

    Commands have the following syntax:

    command options arguments

    Options modify a command's behavior

    Single-letter options usually preceded by -

    Can be passed as -a -b -c or -abc

    Full-word options usually preceded by --

    Example: --help

    Arguments data needed by the command (filenames)

    Multiple commands can be separated by ;

  • 8/2/2019 Intel Day1

    13/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 25

    Getting Help Two important commands: man & info

    commandhelp

    Others (x = command):

    whatis x - short descriptions of command

    which x displays command location

    locate x finds a file

    Program help (F1) Red Hat Documentation or web site!

    Linux-Administration 26

    Hands-on Lab 1a Exploring Linux

    Boot from Fedora CD or DVD

    Login as fedora

    Select Applications, System Tools, Terminal or start

    a terminal window by pressing CTRL-ALT-F2)

    From command line type: w (or uptime; who)

    to find who is logged in & server uptime

    From command line type: dmesg | more

    to read kernel log

  • 8/2/2019 Intel Day1

    14/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 27

    Hands-on Lab1b

    From command line type: freeto find out about memory utilization

    From command line type: df hto find out about free disk space on mounteddevices

    From command line type: mountto find out about available mounted devices

    From command line type: ps axto display running processes

    Linux-Administration 28

    Hands-on Lab1c From command line type: more /etc/inittab

    to read operating system defaults

    From command line type: more /etc/fstabto read file system defaults

    Try the man command for any of the previouscommands, or even help to get more detail on the

    previous commands! Try the GUI tool from Applications, System

    Tools, System Monitor and look at the differenttabs.

  • 8/2/2019 Intel Day1

    15/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux Installation

    29Linux-Administration

    30

    Linux Installation Steps

    Source: CD/DVD/USB/LAN installation

    Target: Supported Hardware

    CPU, RAM

    Hard drive, Array

    Network & Video

    Network Configuration

    Software Selection

    Linux-Administration

  • 8/2/2019 Intel Day1

    16/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    31

    HW: CPU & Memory Support Intel, AMD, MIPS, PowerPC, SPARC

    Itanium, Alpha, UltraSPARC, IBM z90

    SMP support: up to 64 CPUs

    RAM: min 256MB up to 64GB

    Linux-Administration

    32

    Bus Support

    System & Hot swappable

    Plug & Play

    USB

    Firewire (IEE1394)

    Older Buses: EIDE, SCSI, PCMCIA,ISA

    Linux-Administration

  • 8/2/2019 Intel Day1

    17/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    33

    Laptops, Mobile

    Tricky installations

    Custom bus, Video and/or Sound

    chipsets

    Older laptops may be difficult to install

    Boot from CD, floppy or network

    URL: www.linux-laptop.net

    Linux-Administration

    34

    Configuring RAID

    RAID levels supported

    Level 0: striping w/o parity

    Level 1: disk mirroring

    Level 5: striping with parity

    Linux-Administration

  • 8/2/2019 Intel Day1

    18/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    35

    Configuring Flexible

    Filesystems with LVM LVM allows easy partition grow or

    resizing

    ONLY available in RHEL in GUI mode

    Physical/Logical Volume (PV, LV)

    Physical/Logical Extent (PE, LE)

    Volume Group (VG)

    Linux-Administration

    36

    Red Hat Installer Features GUI or text modes

    CD or network install; kickstart install

    Modes:

    Rescue, Desktop, Workstation, Laptop,Server, Custom, Upgrade options.

    Runs Anaconda, a Python script Multi-tasking kernel

    Linux-Administration

  • 8/2/2019 Intel Day1

    19/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    37

    Partitioning Hard Drives GUI or text tools available during install

    Auto or Manual modes

    /boot partition

    Dual boot systems

    Swap partition (2x RAM)

    Create LVM or RAIDs

    Linux-Administration

    38

    Network Configuration andFirewall Setup

    ifconfig

    redhat-config-network

    Dynamic IP (DHCP)

    Static IP

    iptables

    Linux-Administration

  • 8/2/2019 Intel Day1

    20/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    39

    Package Selection GUI: X, KDE, GNOME

    Servers

    Tools

    Programming

    Multimedia

    Applications

    Linux-Administration

    Linux-Administration 40

    System Initialization

    BIOS Boot Kernel init services Login

  • 8/2/2019 Intel Day1

    21/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    41

    BIOS Initialization Power On Self Test recognizes hardware,

    CPU, memory, bootable config from CMOS.

    bootable devices:

    CD ROM

    Floppy

    Hard Drive

    Network USB devices

    Linux-Administration

    42

    The Boot Loader

    Last step in BIOS

    Loads first partition of bootable device

    It can present a preset menu of choices

    Under Linux:

    LILO (Linux Loader) older, static GRUB more dynamic, reads ext2

    Linux-Administration

  • 8/2/2019 Intel Day1

    22/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    43

    Kernel Initialization Kernel loads based on parameters passed

    All logging goes to /var/log/dmesg

    Detects hardware

    Loads initrd (if necessary)

    Mounts root

    Loads /lib/2.6.x/modules

    Passes control to /sbin/init

    Linux-Administration

    44

    init Initialization

    Init loads scripts from /etc/rc.d

    init.rc is the master script

    Based on parameter or /etc/inittab

    default, it will execute scripts in rc.x

    All boot scripts live in init.d, can be

    configured via chkconfig

    Last script is rc.local

    Linux-Administration

  • 8/2/2019 Intel Day1

    23/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    45

    Run levels Depending on the server usage or

    situation you may want to start at:

    Text (Console) login

    Graphical login

    Maintenance mode

    Default is controlled by /etc/inittab

    id:3:initdefault:

    Linux-Administration

    46

    Daemon Processes

    Run unattended

    Do not write to console

    Write via logging facility, usually to

    /var/log/messages

    Can be started via service command

    service sendmail start

    service sendmail stop

    Linux-Administration

  • 8/2/2019 Intel Day1

    24/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    47

    The rc.sysinit Script Controls the initial mounting of

    filesystems, repairing if needed

    rc.local allows local customization

    Linux-Administration

    48

    System V run levels

    0 - Halt

    1 - Single user mode

    2 - Multiuser, without network

    3 - Full multiuser mode

    5 - X11 (graphical login) 6 - Reboot

    Linux-Administration

  • 8/2/2019 Intel Day1

    25/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    49

    The rc.local Script Backdoor for customization of your

    system

    Red Hat uses it to build /etc/issue at

    boot time

    Can be used to configure additional

    hardware or new scripts

    Linux-Administration

    50

    Virtual Consoles

    Linux starts with 6 default virtual

    consoles

    Alt-F1 to Alt-F6 (or CTRL )

    Can have up to 63 consoles

    Linux-Administration

  • 8/2/2019 Intel Day1

    26/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    51

    System Shutdown and Reboot To reboot:

    shutdown r to reboot

    reboot or init 6

    To halt:

    shutdown s to halt

    halt or init 0

    Linux-Administration

    Linux-Administration 52

    Controlling Services service servicename function

    Function: start / stop / restart / status

    kill PID

    nice level process

    GUI: System Tools,System Monitor

  • 8/2/2019 Intel Day1

    27/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    53

    Configuring Services chkconfig servicename function

    Function add del list

    Try: chkconfig list | sort

    system-config-services

    From GUI: Applications, System

    Settings, Server Settings, Services

    Linux-Administration

    54

    System Monitoring andProcess Control

    uptime + ps = w

    ps ax

    kill signal PID

    killall process

    top

    Linux-Administration

  • 8/2/2019 Intel Day1

    28/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    55

    Hands-on Lab 2

    Exploring Linux

    Boot from Red Hat CD or USB

    From command line type:

    dmesg | more to read kernel log

    From command line type:

    runlevel to find current run level

    From command line type:less /etc/inittab to read system defaults

    Linux-Administration

    Linux Graphical Environments

    X Window System

    GNOME

    KDE

    56Linux-Administration

  • 8/2/2019 Intel Day1

    29/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    GUI Components X Server

    X Client

    X Tools

    GUI Tools

    Calendar

    CalculatorFile Manager

    57Linux-Administration

    X Server OverviewClient

    application

    Xlib

    X server

    Device drivers

    Client

    (window

    manager)

    Xlib

    Client

    application

    Xlib

    Toolkit

    Network X11

    protocol

    Linux-Administration 58

  • 8/2/2019 Intel Day1

    30/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    X Principles X is considered inappropriate on a server

    GUI tools can be very useful and convenient

    An X server manages a physical display

    Controls who can use the display

    Controls who can receive events from a display

    Communicates using the X11 protocol

    Implements device drivers for drawing and handling

    mouse and keyboard events

    Linux-Administration 59

    Linux X Servers XFree86 implements X11R6

    Comes with Slackware and other flavors of

    Linux

    Also available for other operating systems

    XFree86 actually has a separate X server for

    each display controller type

    MetroX and AcceleratedX are other types ofcommercial X servers

    Linux-Administration 60

  • 8/2/2019 Intel Day1

    31/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Virtual Displays and Desktops Screens containing a lot of windows become cluttered

    Some window managers have a larger display area than

    screen

    Visible area pans when the cursor gets near the edges

    Display area

    Screen

    Linux-Administration 61

    Configuring X

    Various tools are available for configuring X

    xf86config comes with XFree86 but is difficult

    to use

    xf86cfg is available on some distributions

    Red Hat uses redhat-config-xfree86

    Linux-Administration 62

  • 8/2/2019 Intel Day1

    32/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 63

    Network Configuration

    Linux-Administration 64

    Network Device Recognition

    All Standard devices are recognized bythe kernel at boot time

    Odd or extra hardware can be turn on oroff by loading modules

    Red Hat customized networking:

    /etc/sysconfig/network /etc/sysconfig/network-scripts directory

  • 8/2/2019 Intel Day1

    33/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 65

    Network Interfaces lo or dummy 127.0.0.1

    eth0, tr0 are aliases to real kernel

    modules, defined in /etc/modules

    Network devices can be configured

    with: system-config-network

    Linux-Administration 66

    Address Resolution Protocol

    ARP is used in the TCP/P network to

    find other systems

    We query a server for a hostname & we

    get an IP address

  • 8/2/2019 Intel Day1

    34/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 67

    Enabling Network Interfaces To start: ifup device

    To stop: ifdown device

    To start network device & services:

    service network start

    To stop network device & services:

    service network stop

    Linux-Administration 68

    Multiple NICs

    Each card will have its own

    configuration file

    Can be enabled/disabled at boot time

  • 8/2/2019 Intel Day1

    35/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 69

    Binding Multiple IP Addresses Many ISPs use multiple IP to provide

    many hosts or domains from 1 system

    Its a kernel feature

    ifconfig eth0 10.0.0.1

    ifconfig eth0:1 10.0.1.1

    ifconfig eth0:X 10.0.X.1

    Linux-Administration 70

    Interface Configuration Files

    In the /etc/sysconfig/network-scripts

    directory there are text files for each

    device detected:

    ifcfg-eth0 foreth0

    ifcfg-lo forloopback (lo)

    Which contain the IP or DHCP setting,netmask & if device should start at boot

  • 8/2/2019 Intel Day1

    36/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 71

    Configuration Utilities ifup, ifdown

    system-config-network

    ifconfig

    arp

    nslookup, dig

    hostname netstat

    Linux-Administration 72

    DHCP/BOOTP

    Dynamic Host Control Program is thenewer version of the Boot Protocol

    A client requests from a server an IPaddress at boot time

    If granted, the server provides a leasefor the IP address, the netmask, & canprovide name server & gateway info

  • 8/2/2019 Intel Day1

    37/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 73

    Network ScriptsAllowing User Control of Network

    Interfaces

    The ifup & ifdown interface scripts are

    the only scripts that the user should use

    to bring up & take down network

    interfaces

    Linux-Administration 74

    System Default Route

    The route command displays & configs route

    information

    Newer kernels set default route automatically

    For troubleshooting:

    route shows / configs the IP routing

    static tables can be set to host or net default keyword specifies a route which will be

    used if no other route matches

  • 8/2/2019 Intel Day1

    38/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 75

    IP Forwarding There are kernel variables you can alter to change

    the way the kernel behaves while its running

    To configure a Linux computer as a router between

    networks, you may want to activate IP forwarding

    with the following command:

    # echo 1 >> /proc/sys/net/ipv4/ip_forward

    Linux-Administration 76

    Global Network Parameters

    The interesting bits are in /proc/sys/net

    Reverse Path Filtering

    Generic ipv4 /proc/sys/net/ipv4/icmp_echo_ignore_all

    /proc/sys/net/ipv4/ip_default_ttl

  • 8/2/2019 Intel Day1

    39/40

    Linux Administration

    Copyright 2012: All Rights Reserved. Day 1-

    Linux-Administration 77

    Name Resolution Berkley Internet Name Domain (bind)

    from www.isc.org

    Server name: named uses

    /etc/named.conf

    4 modes: master, slave, caching-only,

    forwarding-only

    Linux-Administration 78

    DNS Client Configuration

    /etc/resolv.conf

    nameserver 10.0.1.254

    /etc/hosts.conf

    order hosts, bind

    /etc/nsswitch.conf

  • 8/2/2019 Intel Day1

    40/40

    Linux Administration

    Linux-Administration 79

    DNS & Network Diagnostics arp

    nslookup

    dig

    host

    netstat nr

    tcpdump or ethereal

    80

    Summary

    Linux History

    Distributions

    Linux and Unix

    Installation

    System Initialization

    File system

    Management

    Booting Linux

    Graphical Desktops

    Command Line

    Linux-Administration


Top Related